diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md index f6230465e9620..de29d9d1efd95 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2022-01-05) +- Azure Resource Manager RecoveryServices client library for Java. This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2021-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2020-12-18) diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/README.md b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/README.md index 1520bad97953e..7b7493ab52915 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/README.md +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/README.md @@ -2,7 +2,21 @@ Azure Resource Manager RecoveryServices client library for Java. -This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2016-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2021-08. 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 @@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for RecoveryServices Management SDK. R com.azure.resourcemanager azure-resourcemanager-recoveryservices - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -60,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/recoveryservices/azure-resourcemanager-recoveryservices/SAMPLE.md) + + ## Troubleshooting ## Next steps @@ -75,6 +92,8 @@ For details on contributing to this repository, see the [contributing guide](htt 1. Create new Pull Request +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ [jdk]: https://docs.microsoft.com/java/azure/jdk/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/SAMPLE.md b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/SAMPLE.md new file mode 100644 index 0000000000000..cee200cfdd520 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/SAMPLE.md @@ -0,0 +1,769 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## PrivateLinkResourcesOperation + +- [Get](#privatelinkresourcesoperation_get) +- [List](#privatelinkresourcesoperation_list) + +## RecoveryServices + +- [CheckNameAvailability](#recoveryservices_checknameavailability) + +## RegisteredIdentities + +- [Delete](#registeredidentities_delete) + +## ReplicationUsages + +- [List](#replicationusages_list) + +## ResourceProvider + +- [GetOperationResult](#resourceprovider_getoperationresult) +- [GetOperationStatus](#resourceprovider_getoperationstatus) + +## Usages + +- [ListByVaults](#usages_listbyvaults) + +## VaultCertificates + +- [Create](#vaultcertificates_create) + +## VaultExtendedInfo + +- [CreateOrUpdate](#vaultextendedinfo_createorupdate) +- [Get](#vaultextendedinfo_get) +- [Update](#vaultextendedinfo_update) + +## Vaults + +- [CreateOrUpdate](#vaults_createorupdate) +- [Delete](#vaults_delete) +- [GetByResourceGroup](#vaults_getbyresourcegroup) +- [List](#vaults_list) +- [ListByResourceGroup](#vaults_listbyresourcegroup) +- [Update](#vaults_update) +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListOperations.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listOperations(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### PrivateLinkResourcesOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResourcesOperation Get. */ +public final class PrivateLinkResourcesOperationGetSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GetPrivateLinkResources.json + */ + /** + * Sample code: Get PrivateLinkResource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getPrivateLinkResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .privateLinkResourcesOperations() + .getWithResponse("petesting", "pemsi-ecy-rsv2", "backupResource", Context.NONE); + } +} +``` + +### PrivateLinkResourcesOperation_List + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResourcesOperation List. */ +public final class PrivateLinkResourcesOperationListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListPrivateLinkResources.json + */ + /** + * Sample code: List PrivateLinkResources. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listPrivateLinkResources( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.privateLinkResourcesOperations().list("petesting", "pemsi-ecy-rsv2", Context.NONE); + } +} +``` + +### RecoveryServices_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.recoveryservices.models.CheckNameAvailabilityParameters; + +/** Samples for RecoveryServices CheckNameAvailability. */ +public final class RecoveryServicesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/CheckNameAvailability_Available.json + */ + /** + * Sample code: Availability status of Resource Name when no resource with same name, type and subscription exists, + * nor has been deleted within last 24 hours. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void + availabilityStatusOfResourceNameWhenNoResourceWithSameNameTypeAndSubscriptionExistsNorHasBeenDeletedWithinLast24Hours( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .recoveryServices() + .checkNameAvailabilityWithResponse( + "resGroupFoo", + "westus", + new CheckNameAvailabilityParameters() + .withType("Microsoft.RecoveryServices/Vaults") + .withName("swaggerExample"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/CheckNameAvailability_NotAvailable.json + */ + /** + * Sample code: Availability status of Resource Name when resource with same name, type and subscription exists. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void availabilityStatusOfResourceNameWhenResourceWithSameNameTypeAndSubscriptionExists( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .recoveryServices() + .checkNameAvailabilityWithResponse( + "resGroupBar", + "westus", + new CheckNameAvailabilityParameters() + .withType("Microsoft.RecoveryServices/Vaults") + .withName("swaggerExample2"), + Context.NONE); + } +} +``` + +### RegisteredIdentities_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for RegisteredIdentities Delete. */ +public final class RegisteredIdentitiesDeleteSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/DeleteRegisteredIdentities.json + */ + /** + * Sample code: Delete registered Identity. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void deleteRegisteredIdentity( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.registeredIdentities().deleteWithResponse("BCDRIbzRG", "BCDRIbzVault", "dpmcontainer01", Context.NONE); + } +} +``` + +### ReplicationUsages_List + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationUsages List. */ +public final class ReplicationUsagesListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListReplicationUsages.json + */ + /** + * Sample code: Gets Replication usages of vault. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getsReplicationUsagesOfVault( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.replicationUsages().list("avrai7517RG1", "avrai7517Vault1", Context.NONE); + } +} +``` + +### ResourceProvider_GetOperationResult + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetOperationResult. */ +public final class ResourceProviderGetOperationResultSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GetOperationResult.json + */ + /** + * Sample code: Get Operation Result. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getOperationResult(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .resourceProviders() + .getOperationResultWithResponse( + "HelloWorld", + "swaggerExample", + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", + Context.NONE); + } +} +``` + +### ResourceProvider_GetOperationStatus + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetOperationStatus. */ +public final class ResourceProviderGetOperationStatusSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GetOperationStatus.json + */ + /** + * Sample code: Get Operation Status. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .resourceProviders() + .getOperationStatusWithResponse( + "HelloWorld", + "swaggerExample", + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", + Context.NONE); + } +} +``` + +### Usages_ListByVaults + +```java +import com.azure.core.util.Context; + +/** Samples for Usages ListByVaults. */ +public final class UsagesListByVaultsSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListUsages.json + */ + /** + * Sample code: Gets vault usages. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getsVaultUsages(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.usages().listByVaults("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} +``` + +### VaultCertificates_Create + +```java +import com.azure.resourcemanager.recoveryservices.models.AuthType; +import com.azure.resourcemanager.recoveryservices.models.RawCertificateData; + +/** Samples for VaultCertificates Create. */ +public final class VaultCertificatesCreateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVaultCred.json + */ + /** + * Sample code: Download vault credential file. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void downloadVaultCredentialFile( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultCertificates() + .define("BCDRIbzVault77777777-d41f-4550-9f70-7708a3a2283b-12-18-2017-vaultcredentials") + .withExistingVault("BCDRIbzRG", "BCDRIbzVault") + .withProperties( + new RawCertificateData() + .withAuthType(AuthType.AAD) + .withCertificate( + "MTTC3TCCAcWgAwIBAgIQEj9h+ZLlXK9KrqZX9UkAnzANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE3MTIxODA5MTc1M1oXDTE3MTIyMzA5Mjc1M1owHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK773/eZZ69RbZZAT05r9MjUxu9y1L1Pn1EgPk62IPJyHlO3OZA922eSBahhP4bgmFljN4LVReqQ5eT/wqO0Zhc+yFkUy4U4RdbQLeUZt2W7yy9XLXgVvqeYDgsjg/QhHetgHArQBW+tlQq5+zPdU7zchI4rbShSJrWhLrZFWiOyFPsuAE4joUQHNlRifdCTsBGKk8HRCY3j1S3c4bfEn3zxlrvrXXssRuW5mJM95rMk0tskoRxXSCi6i9bnlki2Cs9mpVMmBFeofs41KwzlWU0TgpdD8s1QEdvfGB5NbByfetPX7MfJaTBeHZEGbv/Iq8l72u8sPBoOhcaH7qDE/mECAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAILfgHluye1Q+WelhgWhpBBdIq2C0btfV8eFsZaTlBUrM0fwpxQSlAWc2oYHVMQI4A5iUjbDOY35O4yc+TnWKDBKf+laqDP+yos4aiUPuadGUZfvDk7kuw7xeECs64JpHAIEKdRHFW9rD3gwG+nIWaDnEL/7rTyhL3kXrRW2MSUAL8g3GX8Z45c+MQY0jmASIqWdhGn1vpAGyA9mKkzsqg7FXjg8GZb24tGl5Ky85+ip4dkBfXinDD8WwaGyjhGGK97ErvNmN36qly/H0H1Qngiovg1FbHDmkcFO5QclnEJsFFmcO2CcHp5Fqh2wXn5O1cQaxCIRTpQ/uXRpDjl2wKs=" + .getBytes())) + .create(); + } +} +``` + +### VaultExtendedInfo_CreateOrUpdate + +```java +import com.azure.core.util.Context; + +/** Samples for VaultExtendedInfo CreateOrUpdate. */ +public final class VaultExtendedInfoCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/UpdateVaultExtendedInfo.json + */ + /** + * Sample code: Put ExtendedInfo of Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void putExtendedInfoOfResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultExtendedInfoes() + .createOrUpdateWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", null, Context.NONE); + } +} +``` + +### VaultExtendedInfo_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VaultExtendedInfo Get. */ +public final class VaultExtendedInfoGetSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GETVaultExtendedInfo.json + */ + /** + * Sample code: Get ExtendedInfo of Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getExtendedInfoOfResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultExtendedInfoes() + .getWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} +``` + +### VaultExtendedInfo_Update + +```java +import com.azure.core.util.Context; + +/** Samples for VaultExtendedInfo Update. */ +public final class VaultExtendedInfoUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/UpdateVaultExtendedInfo.json + */ + /** + * Sample code: PATCH ExtendedInfo of Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void pATCHExtendedInfoOfResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultExtendedInfoes() + .updateWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", null, Context.NONE); + } +} +``` + +### Vaults_CreateOrUpdate + +```java +import com.azure.resourcemanager.recoveryservices.models.CmkKekIdentity; +import com.azure.resourcemanager.recoveryservices.models.CmkKeyVaultProperties; +import com.azure.resourcemanager.recoveryservices.models.IdentityData; +import com.azure.resourcemanager.recoveryservices.models.InfrastructureEncryptionState; +import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType; +import com.azure.resourcemanager.recoveryservices.models.Sku; +import com.azure.resourcemanager.recoveryservices.models.SkuName; +import com.azure.resourcemanager.recoveryservices.models.UserIdentity; +import com.azure.resourcemanager.recoveryservices.models.VaultProperties; +import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesEncryption; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Vaults CreateOrUpdate. */ +public final class VaultsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVault_WithCMK.json + */ + /** + * Sample code: Create or Update Vault with CustomerManagedKeys. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void createOrUpdateVaultWithCustomerManagedKeys( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .define("swaggerExample") + .withRegion("West US") + .withExistingResourceGroup("Default-RecoveryServices-ResourceGroup") + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKeyVaultProperties( + new CmkKeyVaultProperties() + .withKeyUri( + "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3")) + .withKekIdentity( + new CmkKekIdentity() + .withUserAssignedIdentity( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi")) + .withInfrastructureEncryption(InfrastructureEncryptionState.ENABLED))) + .withSku(new Sku().withName(SkuName.STANDARD)) + .create(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVault.json + */ + /** + * Sample code: Create or Update Recovery Services vault. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void createOrUpdateRecoveryServicesVault( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .define("swaggerExample") + .withRegion("West US") + .withExistingResourceGroup("Default-RecoveryServices-ResourceGroup") + .withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .withProperties(new VaultProperties()) + .withSku(new Sku().withName(SkuName.STANDARD)) + .create(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVault_WithUserAssignedIdentity.json + */ + /** + * Sample code: Create or Update Vault with User Assigned Identity. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void createOrUpdateVaultWithUserAssignedIdentity( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .define("swaggerExample") + .withRegion("West US") + .withExistingResourceGroup("Default-RecoveryServices-ResourceGroup") + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .withProperties(new VaultProperties()) + .withSku(new Sku().withName(SkuName.STANDARD)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Vaults_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Vaults Delete. */ +public final class VaultsDeleteSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/DeleteVault.json + */ + /** + * Sample code: Delete Recovery Services Vault. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void deleteRecoveryServicesVault( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.vaults().deleteWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} +``` + +### Vaults_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Vaults GetByResourceGroup. */ +public final class VaultsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GETVault.json + */ + /** + * Sample code: Get Recovery Services Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getRecoveryServicesResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .getByResourceGroupWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} +``` + +### Vaults_List + +```java +import com.azure.core.util.Context; + +/** Samples for Vaults List. */ +public final class VaultsListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListBySubscriptionIds.json + */ + /** + * Sample code: List of Recovery Services Resources in SubscriptionId. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listOfRecoveryServicesResourcesInSubscriptionId( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.vaults().list(Context.NONE); + } +} +``` + +### Vaults_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Vaults ListByResourceGroup. */ +public final class VaultsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListResources.json + */ + /** + * Sample code: List of Recovery Services Resources in ResourceGroup. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listOfRecoveryServicesResourcesInResourceGroup( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.vaults().listByResourceGroup("Default-RecoveryServices-ResourceGroup", Context.NONE); + } +} +``` + +### Vaults_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.recoveryservices.models.CmkKekIdentity; +import com.azure.resourcemanager.recoveryservices.models.CmkKeyVaultProperties; +import com.azure.resourcemanager.recoveryservices.models.IdentityData; +import com.azure.resourcemanager.recoveryservices.models.InfrastructureEncryptionState; +import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType; +import com.azure.resourcemanager.recoveryservices.models.UserIdentity; +import com.azure.resourcemanager.recoveryservices.models.Vault; +import com.azure.resourcemanager.recoveryservices.models.VaultProperties; +import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesEncryption; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Vaults Update. */ +public final class VaultsUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault_WithCMK.json + */ + /** + * Sample code: Update Resource With CustomerManagedKeys. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithCustomerManagedKeys( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKeyVaultProperties( + new CmkKeyVaultProperties() + .withKeyUri( + "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3")) + .withKekIdentity( + new CmkKekIdentity() + .withUserAssignedIdentity( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi")) + .withInfrastructureEncryption(InfrastructureEncryptionState.ENABLED))) + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PatchVault_WithCMK2.json + */ + /** + * Sample code: Update Resource With CustomerManagedKeys2. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithCustomerManagedKeys2( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKekIdentity(new CmkKekIdentity().withUseSystemAssignedIdentity(true)))) + .withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault_WithCMK3.json + */ + /** + * Sample code: Update Resource With CustomerManagedKeys3. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithCustomerManagedKeys3( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKeyVaultProperties( + new CmkKeyVaultProperties() + .withKeyUri( + "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3")))) + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault.json + */ + /** + * Sample code: Update Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResource(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource.update().withTags(mapOf("PatchKey", "PatchKeyUpdated")).apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault_WithUserAssignedIdentity.json + */ + /** + * Sample code: Update Resource With User Assigned Identity. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithUserAssignedIdentity( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml index 555524d9a1d76..58cf5efb981b5 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml @@ -1,53 +1,81 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-recoveryservices - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-recoveryservices + 1.0.0-beta.2 + jar - Microsoft Azure SDK for RecoveryServices Management - This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2016-06. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for RecoveryServices Management + This package contains Microsoft Azure SDK for RecoveryServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Recovery Services Client. Package tag package-2021-08. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + 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 - true + + 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 + true false - - - - com.azure - azure-core-management - 1.4.4 - - + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManager.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManager.java index 80e1cac928634..54d0e321e88b4 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManager.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManager.java @@ -8,8 +8,8 @@ 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.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -27,6 +28,7 @@ import com.azure.resourcemanager.recoveryservices.implementation.RecoveryServicesManagementClientBuilder; import com.azure.resourcemanager.recoveryservices.implementation.RegisteredIdentitiesImpl; import com.azure.resourcemanager.recoveryservices.implementation.ReplicationUsagesImpl; +import com.azure.resourcemanager.recoveryservices.implementation.ResourceProvidersImpl; import com.azure.resourcemanager.recoveryservices.implementation.UsagesImpl; import com.azure.resourcemanager.recoveryservices.implementation.VaultCertificatesImpl; import com.azure.resourcemanager.recoveryservices.implementation.VaultExtendedInfoesImpl; @@ -36,6 +38,7 @@ import com.azure.resourcemanager.recoveryservices.models.RecoveryServices; import com.azure.resourcemanager.recoveryservices.models.RegisteredIdentities; import com.azure.resourcemanager.recoveryservices.models.ReplicationUsages; +import com.azure.resourcemanager.recoveryservices.models.ResourceProviders; import com.azure.resourcemanager.recoveryservices.models.Usages; import com.azure.resourcemanager.recoveryservices.models.VaultCertificates; import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoes; @@ -45,6 +48,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** Entry point to RecoveryServicesManager. Recovery Services Client. */ public final class RecoveryServicesManager { @@ -64,6 +68,8 @@ public final class RecoveryServicesManager { private VaultExtendedInfoes vaultExtendedInfoes; + private ResourceProviders resourceProviders; + private Usages usages; private final RecoveryServicesManagementClient clientObject; @@ -109,6 +115,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -148,6 +155,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { 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. * @@ -184,25 +202,53 @@ public RecoveryServicesManager authenticate(TokenCredential credential, AzurePro Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.recoveryservices") + .append("/") + .append("1.0.0-beta.1"); + 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) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } List policies = new ArrayList<>(); - policies - .add( - new UserAgentPolicy( - null, - "com.azure.resourcemanager.recoveryservices", - "1.0.0-beta.1", - Configuration.getGlobalConfiguration())); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); 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 ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = @@ -279,6 +325,14 @@ public VaultExtendedInfoes vaultExtendedInfoes() { return vaultExtendedInfoes; } + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + /** @return Resource collection API of Usages. */ public Usages usages() { if (this.usages == null) { diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/RecoveryServicesManagementClient.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/RecoveryServicesManagementClient.java index e3e15634178d4..40080bea285f1 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/RecoveryServicesManagementClient.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/RecoveryServicesManagementClient.java @@ -100,6 +100,13 @@ public interface RecoveryServicesManagementClient { */ VaultExtendedInfoesClient getVaultExtendedInfoes(); + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + /** * Gets the UsagesClient object to access its operations. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/ResourceProvidersClient.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..3da7f26a4a416 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/ResourceProvidersClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.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.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationResourceInner getOperationStatus(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VaultInner getOperationResult(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/VaultsClient.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/VaultsClient.java index 23dda15b6a603..be503942857eb 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/VaultsClient.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/VaultsClient.java @@ -8,7 +8,9 @@ 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.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.PatchVault; @@ -88,6 +90,37 @@ public interface VaultsClient { @ServiceMethod(returns = ReturnType.SINGLE) Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VaultInner> beginCreateOrUpdate( + String resourceGroupName, String vaultName, VaultInner vault); + + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VaultInner> beginCreateOrUpdate( + String resourceGroupName, String vaultName, VaultInner vault, Context context); + /** * Creates or updates a Recovery Services vault. * @@ -115,8 +148,7 @@ public interface VaultsClient { * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse( - String resourceGroupName, String vaultName, VaultInner vault, Context context); + VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner vault, Context context); /** * Deletes a vault. @@ -144,6 +176,37 @@ Response createOrUpdateWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) Response deleteWithResponse(String resourceGroupName, String vaultName, Context context); + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VaultInner> beginUpdate( + String resourceGroupName, String vaultName, PatchVault vault); + + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VaultInner> beginUpdate( + String resourceGroupName, String vaultName, PatchVault vault, Context context); + /** * Updates the vault. * @@ -171,6 +234,5 @@ Response createOrUpdateWithResponse( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( - String resourceGroupName, String vaultName, PatchVault vault, Context context); + VaultInner update(String resourceGroupName, String vaultName, PatchVault vault, Context context); } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/OperationResourceInner.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/OperationResourceInner.java new file mode 100644 index 0000000000000..57018b2a1fa37 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/OperationResourceInner.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.recoveryservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Operation Resource. */ +@Fluent +public final class OperationResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResourceInner.class); + + /* + * End time of the operation + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * Required if status == failed or status == canceled. This is the OData v4 + * error format, used by the RPC and will go into the v2.2 Azure REST API + * guidelines. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /* + * It should match what is used to GET the operation result + */ + @JsonProperty(value = "id") + private String id; + + /* + * It must match the last segment of the "id" field, and will typically be + * a GUID / system generated value + */ + @JsonProperty(value = "name") + private String name; + + /* + * The status of the operation. (InProgress/Success/Failed/Cancelled) + */ + @JsonProperty(value = "status") + private String status; + + /* + * Start time of the operation + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /** + * Get the endTime property: End time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time of the operation. + * + * @param endTime the endTime value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the error property: Required if status == failed or status == canceled. This is the OData v4 error format, + * used by the RPC and will go into the v2.2 Azure REST API guidelines. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Required if status == failed or status == canceled. This is the OData v4 error format, + * used by the RPC and will go into the v2.2 Azure REST API guidelines. + * + * @param error the error value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Get the id property: It should match what is used to GET the operation result. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: It should match what is used to GET the operation result. + * + * @param id the id value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: It must match the last segment of the "id" field, and will typically be a GUID / system + * generated value. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: It must match the last segment of the "id" field, and will typically be a GUID / system + * generated value. + * + * @param name the name value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: The status of the operation. (InProgress/Success/Failed/Cancelled). + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the operation. (InProgress/Success/Failed/Cancelled). + * + * @param status the status value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time of the operation. + * + * @param startTime the startTime value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceInner.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceInner.java index 2b62e074729b1..d58155de5201d 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceInner.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceInner.java @@ -4,19 +4,23 @@ package com.azure.resourcemanager.recoveryservices.fluent.models; -import com.azure.core.annotation.Immutable; -import com.azure.core.annotation.JsonFlatten; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Information of the private link resource. */ -@JsonFlatten -@Immutable -public class PrivateLinkResourceInner { +@Fluent +public final class PrivateLinkResourceInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + /* + * Resource properties + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + /* * Fully qualified identifier of the resource. */ @@ -35,24 +39,14 @@ public class PrivateLinkResourceInner { @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; - /* - * e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or - * f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery) - */ - @JsonProperty(value = "properties.groupId", access = JsonProperty.Access.WRITE_ONLY) - private String groupId; - - /* - * [backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1] - */ - @JsonProperty(value = "properties.requiredMembers", access = JsonProperty.Access.WRITE_ONLY) - private List requiredMembers; - - /* - * The private link resource Private link DNS zone name. + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) - private List requiredZoneNames; + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } /** * Get the id property: Fully qualified identifier of the resource. @@ -88,7 +82,7 @@ public String type() { * @return the groupId value. */ public String groupId() { - return this.groupId; + return this.innerProperties() == null ? null : this.innerProperties().groupId(); } /** @@ -97,7 +91,7 @@ public String groupId() { * @return the requiredMembers value. */ public List requiredMembers() { - return this.requiredMembers; + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); } /** @@ -106,7 +100,7 @@ public List requiredMembers() { * @return the requiredZoneNames value. */ public List requiredZoneNames() { - return this.requiredZoneNames; + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); } /** @@ -115,5 +109,8 @@ public List requiredZoneNames() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..d424ad95a4065 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/PrivateLinkResourceProperties.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.recoveryservices.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or + * f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery) + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * [backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1] + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource Private link DNS zone name. + */ + @JsonProperty(value = "requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /** + * Get the groupId property: e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or + * f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery). + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: [backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1]. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfo.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfo.java new file mode 100644 index 0000000000000..854e1a74e5392 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfo.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Vault extended information. */ +@Fluent +public final class VaultExtendedInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultExtendedInfo.class); + + /* + * Integrity key. + */ + @JsonProperty(value = "integrityKey") + private String integrityKey; + + /* + * Encryption key. + */ + @JsonProperty(value = "encryptionKey") + private String encryptionKey; + + /* + * Encryption key thumbprint. + */ + @JsonProperty(value = "encryptionKeyThumbprint") + private String encryptionKeyThumbprint; + + /* + * Algorithm for Vault ExtendedInfo + */ + @JsonProperty(value = "algorithm") + private String algorithm; + + /** + * Get the integrityKey property: Integrity key. + * + * @return the integrityKey value. + */ + public String integrityKey() { + return this.integrityKey; + } + + /** + * Set the integrityKey property: Integrity key. + * + * @param integrityKey the integrityKey value to set. + * @return the VaultExtendedInfo object itself. + */ + public VaultExtendedInfo withIntegrityKey(String integrityKey) { + this.integrityKey = integrityKey; + return this; + } + + /** + * Get the encryptionKey property: Encryption key. + * + * @return the encryptionKey value. + */ + public String encryptionKey() { + return this.encryptionKey; + } + + /** + * Set the encryptionKey property: Encryption key. + * + * @param encryptionKey the encryptionKey value to set. + * @return the VaultExtendedInfo object itself. + */ + public VaultExtendedInfo withEncryptionKey(String encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * Get the encryptionKeyThumbprint property: Encryption key thumbprint. + * + * @return the encryptionKeyThumbprint value. + */ + public String encryptionKeyThumbprint() { + return this.encryptionKeyThumbprint; + } + + /** + * Set the encryptionKeyThumbprint property: Encryption key thumbprint. + * + * @param encryptionKeyThumbprint the encryptionKeyThumbprint value to set. + * @return the VaultExtendedInfo object itself. + */ + public VaultExtendedInfo withEncryptionKeyThumbprint(String encryptionKeyThumbprint) { + this.encryptionKeyThumbprint = encryptionKeyThumbprint; + return this; + } + + /** + * Get the algorithm property: Algorithm for Vault ExtendedInfo. + * + * @return the algorithm value. + */ + public String algorithm() { + return this.algorithm; + } + + /** + * Set the algorithm property: Algorithm for Vault ExtendedInfo. + * + * @param algorithm the algorithm value to set. + * @return the VaultExtendedInfo object itself. + */ + public VaultExtendedInfo withAlgorithm(String algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfoResourceInner.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfoResourceInner.java index 2a6489d1bec26..56073da43941e 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfoResourceInner.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfoResourceInner.java @@ -5,47 +5,56 @@ package com.azure.resourcemanager.recoveryservices.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Vault extended information. */ -@JsonFlatten @Fluent -public class VaultExtendedInfoResourceInner extends ProxyResource { +public final class VaultExtendedInfoResourceInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultExtendedInfoResourceInner.class); /* - * Integrity key. + * Vault extended information. */ - @JsonProperty(value = "properties.integrityKey") - private String integrityKey; + @JsonProperty(value = "properties") + private VaultExtendedInfo innerProperties; /* - * Encryption key. + * Optional ETag. */ - @JsonProperty(value = "properties.encryptionKey") - private String encryptionKey; + @JsonProperty(value = "etag") + private String etag; - /* - * Encryption key thumbprint. + /** + * Get the innerProperties property: Vault extended information. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.encryptionKeyThumbprint") - private String encryptionKeyThumbprint; + private VaultExtendedInfo innerProperties() { + return this.innerProperties; + } - /* - * Algorithm for Vault ExtendedInfo + /** + * Get the etag property: Optional ETag. + * + * @return the etag value. */ - @JsonProperty(value = "properties.algorithm") - private String algorithm; + public String etag() { + return this.etag; + } - /* - * Optional ETag. + /** + * Set the etag property: Optional ETag. + * + * @param etag the etag value to set. + * @return the VaultExtendedInfoResourceInner object itself. */ - @JsonProperty(value = "eTag") - private String etag; + public VaultExtendedInfoResourceInner withEtag(String etag) { + this.etag = etag; + return this; + } /** * Get the integrityKey property: Integrity key. @@ -53,7 +62,7 @@ public class VaultExtendedInfoResourceInner extends ProxyResource { * @return the integrityKey value. */ public String integrityKey() { - return this.integrityKey; + return this.innerProperties() == null ? null : this.innerProperties().integrityKey(); } /** @@ -63,7 +72,10 @@ public String integrityKey() { * @return the VaultExtendedInfoResourceInner object itself. */ public VaultExtendedInfoResourceInner withIntegrityKey(String integrityKey) { - this.integrityKey = integrityKey; + if (this.innerProperties() == null) { + this.innerProperties = new VaultExtendedInfo(); + } + this.innerProperties().withIntegrityKey(integrityKey); return this; } @@ -73,7 +85,7 @@ public VaultExtendedInfoResourceInner withIntegrityKey(String integrityKey) { * @return the encryptionKey value. */ public String encryptionKey() { - return this.encryptionKey; + return this.innerProperties() == null ? null : this.innerProperties().encryptionKey(); } /** @@ -83,7 +95,10 @@ public String encryptionKey() { * @return the VaultExtendedInfoResourceInner object itself. */ public VaultExtendedInfoResourceInner withEncryptionKey(String encryptionKey) { - this.encryptionKey = encryptionKey; + if (this.innerProperties() == null) { + this.innerProperties = new VaultExtendedInfo(); + } + this.innerProperties().withEncryptionKey(encryptionKey); return this; } @@ -93,7 +108,7 @@ public VaultExtendedInfoResourceInner withEncryptionKey(String encryptionKey) { * @return the encryptionKeyThumbprint value. */ public String encryptionKeyThumbprint() { - return this.encryptionKeyThumbprint; + return this.innerProperties() == null ? null : this.innerProperties().encryptionKeyThumbprint(); } /** @@ -103,7 +118,10 @@ public String encryptionKeyThumbprint() { * @return the VaultExtendedInfoResourceInner object itself. */ public VaultExtendedInfoResourceInner withEncryptionKeyThumbprint(String encryptionKeyThumbprint) { - this.encryptionKeyThumbprint = encryptionKeyThumbprint; + if (this.innerProperties() == null) { + this.innerProperties = new VaultExtendedInfo(); + } + this.innerProperties().withEncryptionKeyThumbprint(encryptionKeyThumbprint); return this; } @@ -113,7 +131,7 @@ public VaultExtendedInfoResourceInner withEncryptionKeyThumbprint(String encrypt * @return the algorithm value. */ public String algorithm() { - return this.algorithm; + return this.innerProperties() == null ? null : this.innerProperties().algorithm(); } /** @@ -123,27 +141,10 @@ public String algorithm() { * @return the VaultExtendedInfoResourceInner object itself. */ public VaultExtendedInfoResourceInner withAlgorithm(String algorithm) { - this.algorithm = algorithm; - return this; - } - - /** - * Get the etag property: Optional ETag. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: Optional ETag. - * - * @param etag the etag value to set. - * @return the VaultExtendedInfoResourceInner object itself. - */ - public VaultExtendedInfoResourceInner withEtag(String etag) { - this.etag = etag; + if (this.innerProperties() == null) { + this.innerProperties = new VaultExtendedInfo(); + } + this.innerProperties().withAlgorithm(algorithm); return this; } @@ -153,5 +154,8 @@ public VaultExtendedInfoResourceInner withEtag(String etag) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java index 7c26f78d82a69..99b2b7e63c395 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java @@ -6,6 +6,7 @@ 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.resourcemanager.recoveryservices.models.IdentityData; import com.azure.resourcemanager.recoveryservices.models.Sku; @@ -37,6 +38,12 @@ public final class VaultInner extends Resource { @JsonProperty(value = "sku") private Sku sku; + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + /** * Get the identity property: Identity for the resource. * @@ -97,6 +104,15 @@ public VaultInner withSku(Sku sku) { return this; } + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** {@inheritDoc} */ @Override public VaultInner withLocation(String location) { diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java index aa46670c680f0..1e79442173568 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java @@ -4,17 +4,17 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.CheckNameAvailabilityResultInner; import com.azure.resourcemanager.recoveryservices.models.CheckNameAvailabilityResult; public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { private CheckNameAvailabilityResultInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; CheckNameAvailabilityResultImpl( - CheckNameAvailabilityResultInner innerObject, RecoveryServicesManager serviceManager) { + CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -35,7 +35,7 @@ public CheckNameAvailabilityResultInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java index a0981d42816e2..e63a23e609d41 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.ClientDiscoveryValueForSingleApiInner; import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryDisplay; import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryForProperties; @@ -13,10 +12,11 @@ public final class ClientDiscoveryValueForSingleApiImpl implements ClientDiscoveryValueForSingleApi { private ClientDiscoveryValueForSingleApiInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; ClientDiscoveryValueForSingleApiImpl( - ClientDiscoveryValueForSingleApiInner innerObject, RecoveryServicesManager serviceManager) { + ClientDiscoveryValueForSingleApiInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -41,7 +41,7 @@ public ClientDiscoveryValueForSingleApiInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.java new file mode 100644 index 0000000000000..5a069ebf8e35e --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.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.recoveryservices.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.models.OperationResource; +import java.time.OffsetDateTime; + +public final class OperationResourceImpl implements OperationResource { + private OperationResourceInner innerObject; + + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; + + OperationResourceImpl( + OperationResourceInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OperationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java index ed1d7cdb0ce67..cc7d2129c6906 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java @@ -108,7 +108,7 @@ private Mono> listSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -228,7 +228,7 @@ private Mono> listNextSingl res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java index 4ebae3e740cbc..befb26b49b70c 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.OperationsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.ClientDiscoveryValueForSingleApiInner; import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryValueForSingleApi; @@ -19,28 +18,30 @@ public final class OperationsImpl implements Operations { private final OperationsClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public OperationsImpl(OperationsClient innerClient, RecoveryServicesManager serviceManager) { + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); } private OperationsClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java index 61b0f0a3718bc..ab67030f7269b 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.recoveryservices.models.PrivateLinkResource; import java.util.Collections; @@ -13,9 +12,11 @@ public final class PrivateLinkResourceImpl implements PrivateLinkResource { private PrivateLinkResourceInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, RecoveryServicesManager serviceManager) { + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -58,7 +59,7 @@ public PrivateLinkResourceInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java index 49fde72c0b025..5bc79ec844f81 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java @@ -159,7 +159,7 @@ private Mono> listSinglePageAsync( res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -334,7 +334,7 @@ private Mono> getWithResponseAsync( privateLinkResourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -481,7 +481,7 @@ private Mono> listNextSinglePageAsync(St res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java index 4e31a2abc9b68..240475b4d3b73 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.PrivateLinkResourcesOperationsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.recoveryservices.models.PrivateLinkResource; @@ -21,23 +20,24 @@ public final class PrivateLinkResourcesOperationsImpl implements PrivateLinkReso private final PrivateLinkResourcesOperationsClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; public PrivateLinkResourcesOperationsImpl( - PrivateLinkResourcesOperationsClient innerClient, RecoveryServicesManager serviceManager) { + PrivateLinkResourcesOperationsClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String resourceGroupName, String vaultName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName); - return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String vaultName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName, context); - return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); } public PrivateLinkResource get(String resourceGroupName, String vaultName, String privateLinkResourceName) { @@ -69,7 +69,7 @@ private PrivateLinkResourcesOperationsClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java index 0a81507c431e5..add3842dd58fc 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java @@ -127,7 +127,7 @@ private Mono> checkNameAvailabilityWi input, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java index 2f4c179924caa..134615bc97510 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.RecoveryServicesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.CheckNameAvailabilityResultInner; import com.azure.resourcemanager.recoveryservices.models.CheckNameAvailabilityParameters; @@ -21,9 +20,11 @@ public final class RecoveryServicesImpl implements RecoveryServices { private final RecoveryServicesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public RecoveryServicesImpl(RecoveryServicesClient innerClient, RecoveryServicesManager serviceManager) { + public RecoveryServicesImpl( + RecoveryServicesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -58,7 +59,7 @@ private RecoveryServicesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java index 73ec143fc2ce9..ff4e6a3a7bd48 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java @@ -27,6 +27,7 @@ import com.azure.resourcemanager.recoveryservices.fluent.RecoveryServicesManagementClient; import com.azure.resourcemanager.recoveryservices.fluent.RegisteredIdentitiesClient; import com.azure.resourcemanager.recoveryservices.fluent.ReplicationUsagesClient; +import com.azure.resourcemanager.recoveryservices.fluent.ResourceProvidersClient; import com.azure.resourcemanager.recoveryservices.fluent.UsagesClient; import com.azure.resourcemanager.recoveryservices.fluent.VaultCertificatesClient; import com.azure.resourcemanager.recoveryservices.fluent.VaultExtendedInfoesClient; @@ -214,6 +215,18 @@ public VaultExtendedInfoesClient getVaultExtendedInfoes() { return this.vaultExtendedInfoes; } + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + /** The UsagesClient object to access its operations. */ private final UsagesClient usages; @@ -248,7 +261,7 @@ public UsagesClient getUsages() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2016-06-01"; + this.apiVersion = "2021-08-01"; this.vaultCertificates = new VaultCertificatesClientImpl(this); this.registeredIdentities = new RegisteredIdentitiesClientImpl(this); this.replicationUsages = new ReplicationUsagesClientImpl(this); @@ -257,6 +270,7 @@ public UsagesClient getUsages() { this.vaults = new VaultsClientImpl(this); this.operations = new OperationsClientImpl(this); this.vaultExtendedInfoes = new VaultExtendedInfoesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); this.usages = new UsagesClientImpl(this); } @@ -342,7 +356,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, if (managementError.getCode() == null || managementError.getMessage() == null) { managementError = null; } - } catch (IOException ioe) { + } catch (IOException | RuntimeException ioe) { logger.logThrowableAsWarning(ioe); } } @@ -371,7 +385,7 @@ private static final class HttpResponseImpl extends HttpResponse { super(null); this.statusCode = statusCode; this.httpHeaders = httpHeaders; - this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); } public int getStatusCode() { diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java index 205ec3f49aee7..85e8a70cfc451 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java @@ -117,7 +117,7 @@ private Mono> deleteWithResponseAsync( vaultName, identityName, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java index b7936e9800eb0..0a2da7bece01a 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.RegisteredIdentitiesClient; import com.azure.resourcemanager.recoveryservices.models.RegisteredIdentities; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -17,9 +16,11 @@ public final class RegisteredIdentitiesImpl implements RegisteredIdentities { private final RegisteredIdentitiesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public RegisteredIdentitiesImpl(RegisteredIdentitiesClient innerClient, RecoveryServicesManager serviceManager) { + public RegisteredIdentitiesImpl( + RegisteredIdentitiesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -37,7 +38,7 @@ private RegisteredIdentitiesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java index 897377356682a..f2c067f0ca925 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.ReplicationUsageInner; import com.azure.resourcemanager.recoveryservices.models.JobsSummary; import com.azure.resourcemanager.recoveryservices.models.MonitoringSummary; @@ -13,9 +12,11 @@ public final class ReplicationUsageImpl implements ReplicationUsage { private ReplicationUsageInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - ReplicationUsageImpl(ReplicationUsageInner innerObject, RecoveryServicesManager serviceManager) { + ReplicationUsageImpl( + ReplicationUsageInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -48,7 +49,7 @@ public ReplicationUsageInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java index 8df6493090ac0..a18df09470384 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java @@ -123,7 +123,7 @@ private Mono> listSinglePageAsync(String re res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java index ef0eec19a1cf8..10281740305c4 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.ReplicationUsagesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.ReplicationUsageInner; import com.azure.resourcemanager.recoveryservices.models.ReplicationUsage; @@ -19,28 +18,30 @@ public final class ReplicationUsagesImpl implements ReplicationUsages { private final ReplicationUsagesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public ReplicationUsagesImpl(ReplicationUsagesClient innerClient, RecoveryServicesManager serviceManager) { + public ReplicationUsagesImpl( + ReplicationUsagesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String resourceGroupName, String vaultName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName); - return inner.mapPage(inner1 -> new ReplicationUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ReplicationUsageImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String vaultName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName, context); - return inner.mapPage(inner1 -> new ReplicationUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ReplicationUsageImpl(inner1, this.manager())); } private ReplicationUsagesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..0152fa7b8a76f --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.recoveryservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final RecoveryServicesManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(RecoveryServicesManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RecoveryServicesManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RecoveryServicesMana") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + + "/vaults/{vaultName}/operationStatus/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOperationStatus( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + + "/vaults/{vaultName}/operationResults/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOperationResult( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationStatusWithResponseAsync( + String resourceGroupName, String vaultName, String operationId) { + 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOperationStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationStatusWithResponseAsync( + String resourceGroupName, String vaultName, String operationId, 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOperationStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationStatusAsync( + String resourceGroupName, String vaultName, String operationId) { + return getOperationStatusWithResponseAsync(resourceGroupName, vaultName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationResourceInner getOperationStatus(String resourceGroupName, String vaultName, String operationId) { + return getOperationStatusAsync(resourceGroupName, vaultName, operationId).block(); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + return getOperationStatusWithResponseAsync(resourceGroupName, vaultName, operationId, context).block(); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String resourceGroupName, String vaultName, String operationId) { + 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOperationResult( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String resourceGroupName, String vaultName, String operationId, 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOperationResult( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationResultAsync(String resourceGroupName, String vaultName, String operationId) { + return getOperationResultWithResponseAsync(resourceGroupName, vaultName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VaultInner getOperationResult(String resourceGroupName, String vaultName, String operationId) { + return getOperationResultAsync(resourceGroupName, vaultName, operationId).block(); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + return getOperationResultWithResponseAsync(resourceGroupName, vaultName, operationId, context).block(); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..677324986442e --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.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.recoveryservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; +import com.azure.resourcemanager.recoveryservices.models.OperationResource; +import com.azure.resourcemanager.recoveryservices.models.ResourceProviders; +import com.azure.resourcemanager.recoveryservices.models.Vault; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResource getOperationStatus(String resourceGroupName, String vaultName, String operationId) { + OperationResourceInner inner = + this.serviceClient().getOperationStatus(resourceGroupName, vaultName, operationId); + if (inner != null) { + return new OperationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + Response inner = + this.serviceClient().getOperationStatusWithResponse(resourceGroupName, vaultName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Vault getOperationResult(String resourceGroupName, String vaultName, String operationId) { + VaultInner inner = this.serviceClient().getOperationResult(resourceGroupName, vaultName, operationId); + if (inner != null) { + return new VaultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + Response inner = + this.serviceClient().getOperationResultWithResponse(resourceGroupName, vaultName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VaultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java index 2a580ba90e530..9e7c12be0929b 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java @@ -123,7 +123,7 @@ private Mono> listByVaultsSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java index ab8988c3b9950..bb6ab82a3c538 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.UsagesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultUsageInner; import com.azure.resourcemanager.recoveryservices.models.Usages; @@ -19,28 +18,29 @@ public final class UsagesImpl implements Usages { private final UsagesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public UsagesImpl(UsagesClient innerClient, RecoveryServicesManager serviceManager) { + public UsagesImpl( + UsagesClient innerClient, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable listByVaults(String resourceGroupName, String vaultName) { PagedIterable inner = this.serviceClient().listByVaults(resourceGroupName, vaultName); - return inner.mapPage(inner1 -> new VaultUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultUsageImpl(inner1, this.manager())); } public PagedIterable listByVaults(String resourceGroupName, String vaultName, Context context) { PagedIterable inner = this.serviceClient().listByVaults(resourceGroupName, vaultName, context); - return inner.mapPage(inner1 -> new VaultUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultUsageImpl(inner1, this.manager())); } private UsagesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java index 59bc1e9d88f0f..177f5ec5a638e 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java @@ -4,12 +4,20 @@ package com.azure.resourcemanager.recoveryservices.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 Utils { static String getValueFromIdByName(String id, String name) { @@ -64,4 +72,133 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java index 80f2bbe1518df..c25a10862eb07 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultCertificateResponseInner; import com.azure.resourcemanager.recoveryservices.models.CertificateRequest; import com.azure.resourcemanager.recoveryservices.models.RawCertificateData; @@ -16,9 +15,11 @@ public final class VaultCertificateResponseImpl implements VaultCertificateResponse, VaultCertificateResponse.Definition { private VaultCertificateResponseInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - VaultCertificateResponseImpl(VaultCertificateResponseInner innerObject, RecoveryServicesManager serviceManager) { + VaultCertificateResponseImpl( + VaultCertificateResponseInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -43,7 +44,7 @@ public VaultCertificateResponseInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } @@ -82,7 +83,8 @@ public VaultCertificateResponse create(Context context) { return this; } - VaultCertificateResponseImpl(String name, RecoveryServicesManager serviceManager) { + VaultCertificateResponseImpl( + String name, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = new VaultCertificateResponseInner(); this.serviceManager = serviceManager; this.certificateName = name; diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java index a846367624e94..a407f951a5613 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java @@ -133,7 +133,7 @@ private Mono> createWithResponseAsync( certificateRequest, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java index 9d19a96a85cad..89ceeafdfb91f 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.VaultCertificatesClient; import com.azure.resourcemanager.recoveryservices.models.VaultCertificates; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -15,9 +14,11 @@ public final class VaultCertificatesImpl implements VaultCertificates { private final VaultCertificatesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public VaultCertificatesImpl(VaultCertificatesClient innerClient, RecoveryServicesManager serviceManager) { + public VaultCertificatesImpl( + VaultCertificatesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -26,7 +27,7 @@ private VaultCertificatesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java index 39f747ebc18d2..874f8cfcce600 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java @@ -4,16 +4,17 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultExtendedInfoResourceInner; import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoResource; public final class VaultExtendedInfoResourceImpl implements VaultExtendedInfoResource { private VaultExtendedInfoResourceInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - VaultExtendedInfoResourceImpl(VaultExtendedInfoResourceInner innerObject, RecoveryServicesManager serviceManager) { + VaultExtendedInfoResourceImpl( + VaultExtendedInfoResourceInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -30,6 +31,10 @@ public String type() { return this.innerModel().type(); } + public String etag() { + return this.innerModel().etag(); + } + public String integrityKey() { return this.innerModel().integrityKey(); } @@ -46,15 +51,11 @@ public String algorithm() { return this.innerModel().algorithm(); } - public String etag() { - return this.innerModel().etag(); - } - public VaultExtendedInfoResourceInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java index d25a7f7225a98..a2ab3d985a05f 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java @@ -150,7 +150,7 @@ private Mono> getWithResponseAsync( vaultName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -309,7 +309,7 @@ private Mono> createOrUpdateWithRespons resourceExtendedInfoDetails, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -490,7 +490,7 @@ private Mono> updateWithResponseAsync( resourceExtendedInfoDetails, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java index 98e535d471b3e..fbc45c38861c6 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.VaultExtendedInfoesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultExtendedInfoResourceInner; import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoResource; @@ -20,9 +19,11 @@ public final class VaultExtendedInfoesImpl implements VaultExtendedInfoes { private final VaultExtendedInfoesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public VaultExtendedInfoesImpl(VaultExtendedInfoesClient innerClient, RecoveryServicesManager serviceManager) { + public VaultExtendedInfoesImpl( + VaultExtendedInfoesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -115,7 +116,7 @@ private VaultExtendedInfoesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java index d14a068b84caa..e006e29f2de4e 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java @@ -5,8 +5,8 @@ package com.azure.resourcemanager.recoveryservices.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.IdentityData; import com.azure.resourcemanager.recoveryservices.models.PatchVault; @@ -19,7 +19,7 @@ public final class VaultImpl implements Vault, Vault.Definition, Vault.Update { private VaultInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; public String id() { return this.innerModel().id(); @@ -58,6 +58,10 @@ public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -70,7 +74,7 @@ public VaultInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } @@ -90,8 +94,7 @@ public Vault create() { serviceManager .serviceClient() .getVaults() - .createOrUpdateWithResponse(resourceGroupName, vaultName, this.innerModel(), Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), Context.NONE); return this; } @@ -100,12 +103,11 @@ public Vault create(Context context) { serviceManager .serviceClient() .getVaults() - .createOrUpdateWithResponse(resourceGroupName, vaultName, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), context); return this; } - VaultImpl(String name, RecoveryServicesManager serviceManager) { + VaultImpl(String name, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = new VaultInner(); this.serviceManager = serviceManager; this.vaultName = name; @@ -118,25 +120,18 @@ public VaultImpl update() { public Vault apply() { this.innerObject = - serviceManager - .serviceClient() - .getVaults() - .updateWithResponse(resourceGroupName, vaultName, updateVault, Context.NONE) - .getValue(); + serviceManager.serviceClient().getVaults().update(resourceGroupName, vaultName, updateVault, Context.NONE); return this; } public Vault apply(Context context) { this.innerObject = - serviceManager - .serviceClient() - .getVaults() - .updateWithResponse(resourceGroupName, vaultName, updateVault, context) - .getValue(); + serviceManager.serviceClient().getVaults().update(resourceGroupName, vaultName, updateVault, context); return this; } - VaultImpl(VaultInner innerObject, RecoveryServicesManager serviceManager) { + VaultImpl( + VaultInner innerObject, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java index 1076156b80f49..b5d94308cc8b1 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultUsageInner; import com.azure.resourcemanager.recoveryservices.models.NameInfo; import com.azure.resourcemanager.recoveryservices.models.UsagesUnit; @@ -14,9 +13,11 @@ public final class VaultUsageImpl implements VaultUsage { private VaultUsageInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - VaultUsageImpl(VaultUsageInner innerObject, RecoveryServicesManager serviceManager) { + VaultUsageImpl( + VaultUsageInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -49,7 +50,7 @@ public VaultUsageInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java index 3b15c7a58b6cc..f577ca925495f 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java @@ -27,13 +27,18 @@ 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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.recoveryservices.fluent.VaultsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.PatchVault; import com.azure.resourcemanager.recoveryservices.models.VaultList; +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. */ @@ -109,7 +114,7 @@ Mono> getByResourceGroup( + "/vaults/{vaultName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @@ -119,7 +124,7 @@ Mono> createOrUpdate( @HeaderParam("Accept") String accept, Context context); - @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + "/vaults/{vaultName}") @@ -131,15 +136,16 @@ Mono> delete( @QueryParam("api-version") String apiVersion, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + "/vaults/{vaultName}") - @ExpectedResponses({200, 201}) + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @@ -211,7 +217,7 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -359,7 +365,7 @@ private Mono> listByResourceGroupSinglePageAsync(Strin res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -518,7 +524,7 @@ private Mono> getByResourceGroupWithResponseAsync(String re vaultName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -634,7 +640,7 @@ public Response getByResourceGroupWithResponse( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String vaultName, VaultInner vault) { if (this.client.getEndpoint() == null) { return Mono @@ -674,7 +680,7 @@ private Mono> createOrUpdateWithResponseAsync( vault, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -690,7 +696,7 @@ private Mono> createOrUpdateWithResponseAsync( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String vaultName, VaultInner vault, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -730,6 +736,86 @@ private Mono> createOrUpdateWithResponseAsync( context); } + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VaultInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vaultName, VaultInner vault) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vaultName, vault); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VaultInner.class, VaultInner.class, this.client.getContext()); + } + + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VaultInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vaultName, VaultInner vault, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vaultName, vault, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VaultInner.class, VaultInner.class, context); + } + + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VaultInner> beginCreateOrUpdate( + String resourceGroupName, String vaultName, VaultInner vault) { + return beginCreateOrUpdateAsync(resourceGroupName, vaultName, vault).getSyncPoller(); + } + + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VaultInner> beginCreateOrUpdate( + String resourceGroupName, String vaultName, VaultInner vault, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vaultName, vault, context).getSyncPoller(); + } + /** * Creates or updates a Recovery Services vault. * @@ -743,15 +829,29 @@ private Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String vaultName, VaultInner vault) { - return createOrUpdateWithResponseAsync(resourceGroupName, vaultName, vault) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return beginCreateOrUpdateAsync(resourceGroupName, vaultName, vault) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vaultName, VaultInner vault, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vaultName, vault, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -783,9 +883,8 @@ public VaultInner createOrUpdate(String resourceGroupName, String vaultName, Vau * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse( - String resourceGroupName, String vaultName, VaultInner vault, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, vaultName, vault, context).block(); + public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner vault, Context context) { + return createOrUpdateAsync(resourceGroupName, vaultName, vault, context).block(); } /** @@ -819,6 +918,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S 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 -> @@ -829,8 +929,9 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S this.client.getApiVersion(), resourceGroupName, vaultName, + accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -865,6 +966,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S 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( @@ -873,6 +975,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S this.client.getApiVersion(), resourceGroupName, vaultName, + accept, context); } @@ -933,7 +1036,7 @@ public Response deleteWithResponse(String resourceGroupName, String vaultN * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String vaultName, PatchVault vault) { if (this.client.getEndpoint() == null) { return Mono @@ -973,7 +1076,7 @@ private Mono> updateWithResponseAsync( vault, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -989,7 +1092,7 @@ private Mono> updateWithResponseAsync( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String vaultName, PatchVault vault, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1029,6 +1132,85 @@ private Mono> updateWithResponseAsync( context); } + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VaultInner> beginUpdateAsync( + String resourceGroupName, String vaultName, PatchVault vault) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, vaultName, vault); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VaultInner.class, VaultInner.class, this.client.getContext()); + } + + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VaultInner> beginUpdateAsync( + String resourceGroupName, String vaultName, PatchVault vault, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, vaultName, vault, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VaultInner.class, VaultInner.class, context); + } + + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VaultInner> beginUpdate( + String resourceGroupName, String vaultName, PatchVault vault) { + return beginUpdateAsync(resourceGroupName, vaultName, vault).getSyncPoller(); + } + + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VaultInner> beginUpdate( + String resourceGroupName, String vaultName, PatchVault vault, Context context) { + return beginUpdateAsync(resourceGroupName, vaultName, vault, context).getSyncPoller(); + } + /** * Updates the vault. * @@ -1042,15 +1224,29 @@ private Mono> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String vaultName, PatchVault vault) { - return updateWithResponseAsync(resourceGroupName, vaultName, vault) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return beginUpdateAsync(resourceGroupName, vaultName, vault) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @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, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vaultName, PatchVault vault, Context context) { + return beginUpdateAsync(resourceGroupName, vaultName, vault, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1082,9 +1278,8 @@ public VaultInner update(String resourceGroupName, String vaultName, PatchVault * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( - String resourceGroupName, String vaultName, PatchVault vault, Context context) { - return updateWithResponseAsync(resourceGroupName, vaultName, vault, context).block(); + public VaultInner update(String resourceGroupName, String vaultName, PatchVault vault, Context context) { + return updateAsync(resourceGroupName, vaultName, vault, context).block(); } /** @@ -1120,7 +1315,7 @@ private Mono> listBySubscriptionIdNextSinglePageAsync( res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1192,7 +1387,7 @@ private Mono> listByResourceGroupNextSinglePageAsync(S res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java index ddd785de7ea05..069f38b0442b2 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.VaultsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.Vault; @@ -21,31 +20,32 @@ public final class VaultsImpl implements Vaults { private final VaultsClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public VaultsImpl(VaultsClient innerClient, RecoveryServicesManager serviceManager) { + public VaultsImpl( + VaultsClient innerClient, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public Vault getByResourceGroup(String resourceGroupName, String vaultName) { @@ -133,7 +133,7 @@ public void deleteById(String id) { new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); } - this.deleteWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); + this.deleteWithResponse(resourceGroupName, vaultName, Context.NONE); } public Response deleteByIdWithResponse(String id, Context context) { @@ -159,7 +159,7 @@ private VaultsClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKekIdentity.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKekIdentity.java new file mode 100644 index 0000000000000..c44a5c7ebb94d --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKekIdentity.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of the identity used for CMK. */ +@Fluent +public class CmkKekIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CmkKekIdentity.class); + + /* + * Indicate that system assigned identity should be used. Mutually + * exclusive with 'userAssignedIdentity' field + */ + @JsonProperty(value = "useSystemAssignedIdentity") + private Boolean useSystemAssignedIdentity; + + /* + * The user assigned identity to be used to grant permissions in case the + * type of identity used is UserAssigned + */ + @JsonProperty(value = "userAssignedIdentity") + private String userAssignedIdentity; + + /** + * Get the useSystemAssignedIdentity property: Indicate that system assigned identity should be used. Mutually + * exclusive with 'userAssignedIdentity' field. + * + * @return the useSystemAssignedIdentity value. + */ + public Boolean useSystemAssignedIdentity() { + return this.useSystemAssignedIdentity; + } + + /** + * Set the useSystemAssignedIdentity property: Indicate that system assigned identity should be used. Mutually + * exclusive with 'userAssignedIdentity' field. + * + * @param useSystemAssignedIdentity the useSystemAssignedIdentity value to set. + * @return the CmkKekIdentity object itself. + */ + public CmkKekIdentity withUseSystemAssignedIdentity(Boolean useSystemAssignedIdentity) { + this.useSystemAssignedIdentity = useSystemAssignedIdentity; + return this; + } + + /** + * Get the userAssignedIdentity property: The user assigned identity to be used to grant permissions in case the + * type of identity used is UserAssigned. + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The user assigned identity to be used to grant permissions in case the + * type of identity used is UserAssigned. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the CmkKekIdentity object itself. + */ + public CmkKekIdentity withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKeyVaultProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKeyVaultProperties.java new file mode 100644 index 0000000000000..301258c1d2338 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKeyVaultProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the Key Vault which hosts CMK. */ +@Fluent +public final class CmkKeyVaultProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CmkKeyVaultProperties.class); + + /* + * The key uri of the Customer Managed Key + */ + @JsonProperty(value = "keyUri") + private String keyUri; + + /** + * Get the keyUri property: The key uri of the Customer Managed Key. + * + * @return the keyUri value. + */ + public String keyUri() { + return this.keyUri; + } + + /** + * Set the keyUri property: The key uri of the Customer Managed Key. + * + * @param keyUri the keyUri value to set. + * @return the CmkKeyVaultProperties object itself. + */ + public CmkKeyVaultProperties withKeyUri(String keyUri) { + this.keyUri = keyUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/IdentityData.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/IdentityData.java index e1c30df92c49b..359a5858eb82a 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/IdentityData.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/IdentityData.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; /** Identity for the resource. */ @Fluent @@ -27,11 +29,23 @@ public final class IdentityData { private String tenantId; /* - * The identity type. + * The type of managed identity used. The type 'SystemAssigned, + * UserAssigned' includes both an implicitly created identity and a set of + * user-assigned identities. The type 'None' will remove any identities. */ @JsonProperty(value = "type", required = true) private ResourceIdentityType type; + /* + * The list of user-assigned identities associated with the resource. The + * user-assigned identity dictionary keys will be ARM resource ids in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + /** * Get the principalId property: The principal ID of resource identity. * @@ -51,7 +65,8 @@ public String tenantId() { } /** - * Get the type property: The identity type. + * Get the type property: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both + * an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. * * @return the type value. */ @@ -60,7 +75,8 @@ public ResourceIdentityType type() { } /** - * Set the type property: The identity type. + * Set the type property: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both + * an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. * * @param type the type value to set. * @return the IdentityData object itself. @@ -70,6 +86,30 @@ public IdentityData withType(ResourceIdentityType type) { return this; } + /** + * Get the userAssignedIdentities property: The list of user-assigned identities associated with the resource. The + * user-assigned identity dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user-assigned identities associated with the resource. The + * user-assigned identity dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the IdentityData object itself. + */ + public IdentityData withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + /** * Validates the instance. * @@ -81,5 +121,15 @@ public void validate() { .logExceptionAsError( new IllegalArgumentException("Missing required property type in model IdentityData")); } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/InfrastructureEncryptionState.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/InfrastructureEncryptionState.java new file mode 100644 index 0000000000000..0e07676195c52 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/InfrastructureEncryptionState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InfrastructureEncryptionState. */ +public final class InfrastructureEncryptionState extends ExpandableStringEnum { + /** Static value Enabled for InfrastructureEncryptionState. */ + public static final InfrastructureEncryptionState ENABLED = fromString("Enabled"); + + /** Static value Disabled for InfrastructureEncryptionState. */ + public static final InfrastructureEncryptionState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a InfrastructureEncryptionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding InfrastructureEncryptionState. + */ + @JsonCreator + public static InfrastructureEncryptionState fromString(String name) { + return fromString(name, InfrastructureEncryptionState.class); + } + + /** @return known InfrastructureEncryptionState values. */ + public static Collection values() { + return values(InfrastructureEncryptionState.class); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/OperationResource.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/OperationResource.java new file mode 100644 index 0000000000000..a62bda1dc3640 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/OperationResource.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of OperationResource. */ +public interface OperationResource { + /** + * Gets the endTime property: End time of the operation. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the error property: Required if status == failed or status == canceled. This is the OData v4 error format, + * used by the RPC and will go into the v2.2 Azure REST API guidelines. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the id property: It should match what is used to GET the operation result. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: It must match the last segment of the "id" field, and will typically be a GUID / system + * generated value. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: The status of the operation. (InProgress/Success/Failed/Cancelled). + * + * @return the status value. + */ + String status(); + + /** + * Gets the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the inner com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner object. + * + * @return the inner object. + */ + OperationResourceInner innerModel(); +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PatchTrackedResource.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PatchTrackedResource.java index 7375d3bcd66de..788a86b76e5d8 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PatchTrackedResource.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PatchTrackedResource.java @@ -8,6 +8,7 @@ import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -26,12 +27,13 @@ public class PatchTrackedResource extends ProxyResource { * Resource tags. */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /* * Optional ETag. */ - @JsonProperty(value = "eTag") + @JsonProperty(value = "etag") private String etag; /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java index c2b2919356879..369946c21d379 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java @@ -27,6 +27,25 @@ public final class PrivateEndpointConnectionVaultProperties { @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private PrivateEndpointConnection properties; + /* + * The name of the private Endpoint Connection + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type, which will be of the format, + * Microsoft.RecoveryServices/vaults/privateEndpointConnections + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The location of the private Endpoint connection + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + /** * Get the id property: Format of id * subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}. @@ -46,6 +65,34 @@ public PrivateEndpointConnection properties() { return this.properties; } + /** + * Get the name property: The name of the private Endpoint Connection. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type, which will be of the format, + * Microsoft.RecoveryServices/vaults/privateEndpointConnections. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the location property: The location of the private Endpoint connection. + * + * @return the location value. + */ + public String location() { + return this.location; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java index d86dc76d5bd87..bbf81187a8922 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java @@ -49,6 +49,12 @@ public final class ResourceCertificateAndAadDetails extends ResourceCertificateD @JsonProperty(value = "azureManagementEndpointAudience", required = true) private String azureManagementEndpointAudience; + /* + * Service Resource Id. + */ + @JsonProperty(value = "serviceResourceId") + private String serviceResourceId; + /** * Get the aadAuthority property: AAD tenant authority. * @@ -150,6 +156,26 @@ public ResourceCertificateAndAadDetails withAzureManagementEndpointAudience( return this; } + /** + * Get the serviceResourceId property: Service Resource Id. + * + * @return the serviceResourceId value. + */ + public String serviceResourceId() { + return this.serviceResourceId; + } + + /** + * Set the serviceResourceId property: Service Resource Id. + * + * @param serviceResourceId the serviceResourceId value to set. + * @return the ResourceCertificateAndAadDetails object itself. + */ + public ResourceCertificateAndAadDetails withServiceResourceId(String serviceResourceId) { + this.serviceResourceId = serviceResourceId; + return this; + } + /** {@inheritDoc} */ @Override public ResourceCertificateAndAadDetails withCertificate(byte[] certificate) { diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceIdentityType.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceIdentityType.java index 4b920cd436f8f..afa21bba313ed 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceIdentityType.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceIdentityType.java @@ -16,6 +16,12 @@ public final class ResourceIdentityType extends ExpandableStringEnum { + /** Static value Unknown for ResourceMoveState. */ + public static final ResourceMoveState UNKNOWN = fromString("Unknown"); + + /** Static value InProgress for ResourceMoveState. */ + public static final ResourceMoveState IN_PROGRESS = fromString("InProgress"); + + /** Static value PrepareFailed for ResourceMoveState. */ + public static final ResourceMoveState PREPARE_FAILED = fromString("PrepareFailed"); + + /** Static value CommitFailed for ResourceMoveState. */ + public static final ResourceMoveState COMMIT_FAILED = fromString("CommitFailed"); + + /** Static value PrepareTimedout for ResourceMoveState. */ + public static final ResourceMoveState PREPARE_TIMEDOUT = fromString("PrepareTimedout"); + + /** Static value CommitTimedout for ResourceMoveState. */ + public static final ResourceMoveState COMMIT_TIMEDOUT = fromString("CommitTimedout"); + + /** Static value MoveSucceeded for ResourceMoveState. */ + public static final ResourceMoveState MOVE_SUCCEEDED = fromString("MoveSucceeded"); + + /** Static value Failure for ResourceMoveState. */ + public static final ResourceMoveState FAILURE = fromString("Failure"); + + /** Static value CriticalFailure for ResourceMoveState. */ + public static final ResourceMoveState CRITICAL_FAILURE = fromString("CriticalFailure"); + + /** Static value PartialSuccess for ResourceMoveState. */ + public static final ResourceMoveState PARTIAL_SUCCESS = fromString("PartialSuccess"); + + /** + * Creates or finds a ResourceMoveState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceMoveState. + */ + @JsonCreator + public static ResourceMoveState fromString(String name) { + return fromString(name, ResourceMoveState.class); + } + + /** @return known ResourceMoveState values. */ + public static Collection values() { + return values(ResourceMoveState.class); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceProviders.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceProviders.java new file mode 100644 index 0000000000000..f3f6a38d456af --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceProviders.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation status for a resource. + */ + OperationResource getOperationStatus(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation status for a resource. + */ + Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation result for a resource. + */ + Vault getOperationResult(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @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 operation result for a resource. + */ + Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java index 0f1005b290fb0..b0d557458bccb 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java @@ -20,6 +20,30 @@ public final class Sku { @JsonProperty(value = "name", required = true) private SkuName name; + /* + * The Sku tier. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * The sku family + */ + @JsonProperty(value = "family") + private String family; + + /* + * The sku size + */ + @JsonProperty(value = "size") + private String size; + + /* + * The sku capacity + */ + @JsonProperty(value = "capacity") + private String capacity; + /** * Get the name property: The Sku name. * @@ -40,6 +64,86 @@ public Sku withName(SkuName name) { return this; } + /** + * Get the tier property: The Sku tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The Sku tier. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the family property: The sku family. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The sku family. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the size property: The sku size. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The sku size. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the capacity property: The sku capacity. + * + * @return the capacity value. + */ + public String capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The sku capacity. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(String capacity) { + this.capacity = capacity; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/UserIdentity.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/UserIdentity.java new file mode 100644 index 0000000000000..3adeefb60778d --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/UserIdentity.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.recoveryservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A resource identity that is managed by the user of the service. */ +@Immutable +public class UserIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserIdentity.class); + + /* + * The principal ID of the user-assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client ID of the user-assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal ID of the user-assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the user-assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Vault.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Vault.java index 2f0622fb30955..4aa9fe1a96081 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Vault.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Vault.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.recoveryservices.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import java.util.Map; @@ -67,6 +68,13 @@ public interface Vault { */ Sku sku(); + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the region of the resource. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultExtendedInfoResource.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultExtendedInfoResource.java index a4ea1b0bbea7c..4847915d290bd 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultExtendedInfoResource.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultExtendedInfoResource.java @@ -29,6 +29,13 @@ public interface VaultExtendedInfoResource { */ String type(); + /** + * Gets the etag property: Optional ETag. + * + * @return the etag value. + */ + String etag(); + /** * Gets the integrityKey property: Integrity key. * @@ -57,13 +64,6 @@ public interface VaultExtendedInfoResource { */ String algorithm(); - /** - * Gets the etag property: Optional ETag. - * - * @return the etag value. - */ - String etag(); - /** * Gets the inner com.azure.resourcemanager.recoveryservices.fluent.models.VaultExtendedInfoResourceInner object. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java index a094519381c24..57a65488f3b33 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java @@ -45,6 +45,24 @@ public final class VaultProperties { @JsonProperty(value = "privateEndpointStateForSiteRecovery", access = JsonProperty.Access.WRITE_ONLY) private VaultPrivateEndpointState privateEndpointStateForSiteRecovery; + /* + * Customer Managed Key details of the resource. + */ + @JsonProperty(value = "encryption") + private VaultPropertiesEncryption encryption; + + /* + * The details of the latest move operation performed on the Azure Resource + */ + @JsonProperty(value = "moveDetails") + private VaultPropertiesMoveDetails moveDetails; + + /* + * The State of the Resource after the move operation + */ + @JsonProperty(value = "moveState", access = JsonProperty.Access.WRITE_ONLY) + private ResourceMoveState moveState; + /** * Get the provisioningState property: Provisioning State. * @@ -101,6 +119,55 @@ public VaultPrivateEndpointState privateEndpointStateForSiteRecovery() { return this.privateEndpointStateForSiteRecovery; } + /** + * Get the encryption property: Customer Managed Key details of the resource. + * + * @return the encryption value. + */ + public VaultPropertiesEncryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Customer Managed Key details of the resource. + * + * @param encryption the encryption value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEncryption(VaultPropertiesEncryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the moveDetails property: The details of the latest move operation performed on the Azure Resource. + * + * @return the moveDetails value. + */ + public VaultPropertiesMoveDetails moveDetails() { + return this.moveDetails; + } + + /** + * Set the moveDetails property: The details of the latest move operation performed on the Azure Resource. + * + * @param moveDetails the moveDetails value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withMoveDetails(VaultPropertiesMoveDetails moveDetails) { + this.moveDetails = moveDetails; + return this; + } + + /** + * Get the moveState property: The State of the Resource after the move operation. + * + * @return the moveState value. + */ + public ResourceMoveState moveState() { + return this.moveState; + } + /** * Validates the instance. * @@ -113,5 +180,11 @@ public void validate() { if (privateEndpointConnections() != null) { privateEndpointConnections().forEach(e -> e.validate()); } + if (encryption() != null) { + encryption().validate(); + } + if (moveDetails() != null) { + moveDetails().validate(); + } } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesEncryption.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesEncryption.java new file mode 100644 index 0000000000000..9daafacf9f84f --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesEncryption.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Customer Managed Key details of the resource. */ +@Fluent +public final class VaultPropertiesEncryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultPropertiesEncryption.class); + + /* + * The properties of the Key Vault which hosts CMK + */ + @JsonProperty(value = "keyVaultProperties") + private CmkKeyVaultProperties keyVaultProperties; + + /* + * The details of the identity used for CMK + */ + @JsonProperty(value = "kekIdentity") + private CmkKekIdentity kekIdentity; + + /* + * Enabling/Disabling the Double Encryption state + */ + @JsonProperty(value = "infrastructureEncryption") + private InfrastructureEncryptionState infrastructureEncryption; + + /** + * Get the keyVaultProperties property: The properties of the Key Vault which hosts CMK. + * + * @return the keyVaultProperties value. + */ + public CmkKeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The properties of the Key Vault which hosts CMK. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the VaultPropertiesEncryption object itself. + */ + public VaultPropertiesEncryption withKeyVaultProperties(CmkKeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the kekIdentity property: The details of the identity used for CMK. + * + * @return the kekIdentity value. + */ + public CmkKekIdentity kekIdentity() { + return this.kekIdentity; + } + + /** + * Set the kekIdentity property: The details of the identity used for CMK. + * + * @param kekIdentity the kekIdentity value to set. + * @return the VaultPropertiesEncryption object itself. + */ + public VaultPropertiesEncryption withKekIdentity(CmkKekIdentity kekIdentity) { + this.kekIdentity = kekIdentity; + return this; + } + + /** + * Get the infrastructureEncryption property: Enabling/Disabling the Double Encryption state. + * + * @return the infrastructureEncryption value. + */ + public InfrastructureEncryptionState infrastructureEncryption() { + return this.infrastructureEncryption; + } + + /** + * Set the infrastructureEncryption property: Enabling/Disabling the Double Encryption state. + * + * @param infrastructureEncryption the infrastructureEncryption value to set. + * @return the VaultPropertiesEncryption object itself. + */ + public VaultPropertiesEncryption withInfrastructureEncryption( + InfrastructureEncryptionState infrastructureEncryption) { + this.infrastructureEncryption = infrastructureEncryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVaultProperties() != null) { + keyVaultProperties().validate(); + } + if (kekIdentity() != null) { + kekIdentity().validate(); + } + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesMoveDetails.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesMoveDetails.java new file mode 100644 index 0000000000000..2df3d2d22a4b9 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesMoveDetails.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.recoveryservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The details of the latest move operation performed on the Azure Resource. */ +@Immutable +public final class VaultPropertiesMoveDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultPropertiesMoveDetails.class); + + /* + * OperationId of the Resource Move Operation + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /* + * Start Time of the Resource Move Operation + */ + @JsonProperty(value = "startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTimeUtc; + + /* + * End Time of the Resource Move Operation + */ + @JsonProperty(value = "completionTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime completionTimeUtc; + + /* + * Source Resource of the Resource Move Operation + */ + @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceId; + + /* + * Target Resource of the Resource Move Operation + */ + @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceId; + + /** + * Get the operationId property: OperationId of the Resource Move Operation. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the startTimeUtc property: Start Time of the Resource Move Operation. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Get the completionTimeUtc property: End Time of the Resource Move Operation. + * + * @return the completionTimeUtc value. + */ + public OffsetDateTime completionTimeUtc() { + return this.completionTimeUtc; + } + + /** + * Get the sourceResourceId property: Source Resource of the Resource Move Operation. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the targetResourceId property: Target Resource of the Resource Move Operation. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/OperationsListSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..b697900c1a7b9 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListOperations.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listOperations(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/PrivateLinkResourcesOperationGetSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/PrivateLinkResourcesOperationGetSamples.java new file mode 100644 index 0000000000000..cdd9f3971c4f6 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/PrivateLinkResourcesOperationGetSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResourcesOperation Get. */ +public final class PrivateLinkResourcesOperationGetSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GetPrivateLinkResources.json + */ + /** + * Sample code: Get PrivateLinkResource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getPrivateLinkResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .privateLinkResourcesOperations() + .getWithResponse("petesting", "pemsi-ecy-rsv2", "backupResource", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/PrivateLinkResourcesOperationListSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/PrivateLinkResourcesOperationListSamples.java new file mode 100644 index 0000000000000..ce7edab0ca1a6 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/PrivateLinkResourcesOperationListSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResourcesOperation List. */ +public final class PrivateLinkResourcesOperationListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListPrivateLinkResources.json + */ + /** + * Sample code: List PrivateLinkResources. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listPrivateLinkResources( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.privateLinkResourcesOperations().list("petesting", "pemsi-ecy-rsv2", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/RecoveryServicesCheckNameAvailabilitySamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/RecoveryServicesCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..22591ac613ded --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/RecoveryServicesCheckNameAvailabilitySamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.recoveryservices.models.CheckNameAvailabilityParameters; + +/** Samples for RecoveryServices CheckNameAvailability. */ +public final class RecoveryServicesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/CheckNameAvailability_Available.json + */ + /** + * Sample code: Availability status of Resource Name when no resource with same name, type and subscription exists, + * nor has been deleted within last 24 hours. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void + availabilityStatusOfResourceNameWhenNoResourceWithSameNameTypeAndSubscriptionExistsNorHasBeenDeletedWithinLast24Hours( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .recoveryServices() + .checkNameAvailabilityWithResponse( + "resGroupFoo", + "westus", + new CheckNameAvailabilityParameters() + .withType("Microsoft.RecoveryServices/Vaults") + .withName("swaggerExample"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/CheckNameAvailability_NotAvailable.json + */ + /** + * Sample code: Availability status of Resource Name when resource with same name, type and subscription exists. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void availabilityStatusOfResourceNameWhenResourceWithSameNameTypeAndSubscriptionExists( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .recoveryServices() + .checkNameAvailabilityWithResponse( + "resGroupBar", + "westus", + new CheckNameAvailabilityParameters() + .withType("Microsoft.RecoveryServices/Vaults") + .withName("swaggerExample2"), + Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/RegisteredIdentitiesDeleteSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/RegisteredIdentitiesDeleteSamples.java new file mode 100644 index 0000000000000..11d2994919467 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/RegisteredIdentitiesDeleteSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for RegisteredIdentities Delete. */ +public final class RegisteredIdentitiesDeleteSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/DeleteRegisteredIdentities.json + */ + /** + * Sample code: Delete registered Identity. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void deleteRegisteredIdentity( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.registeredIdentities().deleteWithResponse("BCDRIbzRG", "BCDRIbzVault", "dpmcontainer01", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ReplicationUsagesListSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ReplicationUsagesListSamples.java new file mode 100644 index 0000000000000..bade6108aa71e --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ReplicationUsagesListSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationUsages List. */ +public final class ReplicationUsagesListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListReplicationUsages.json + */ + /** + * Sample code: Gets Replication usages of vault. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getsReplicationUsagesOfVault( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.replicationUsages().list("avrai7517RG1", "avrai7517Vault1", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ResourceProviderGetOperationResultSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ResourceProviderGetOperationResultSamples.java new file mode 100644 index 0000000000000..a2396a7b4f2f3 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ResourceProviderGetOperationResultSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetOperationResult. */ +public final class ResourceProviderGetOperationResultSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GetOperationResult.json + */ + /** + * Sample code: Get Operation Result. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getOperationResult(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .resourceProviders() + .getOperationResultWithResponse( + "HelloWorld", + "swaggerExample", + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", + Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ResourceProviderGetOperationStatusSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ResourceProviderGetOperationStatusSamples.java new file mode 100644 index 0000000000000..6bbaba9b9cb64 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/ResourceProviderGetOperationStatusSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetOperationStatus. */ +public final class ResourceProviderGetOperationStatusSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GetOperationStatus.json + */ + /** + * Sample code: Get Operation Status. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .resourceProviders() + .getOperationStatusWithResponse( + "HelloWorld", + "swaggerExample", + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", + Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/UsagesListByVaultsSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/UsagesListByVaultsSamples.java new file mode 100644 index 0000000000000..5c97ddc20546f --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/UsagesListByVaultsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for Usages ListByVaults. */ +public final class UsagesListByVaultsSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListUsages.json + */ + /** + * Sample code: Gets vault usages. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getsVaultUsages(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.usages().listByVaults("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultCertificatesCreateSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultCertificatesCreateSamples.java new file mode 100644 index 0000000000000..24d1cf93a51b7 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultCertificatesCreateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.generated; + +import com.azure.resourcemanager.recoveryservices.models.AuthType; +import com.azure.resourcemanager.recoveryservices.models.RawCertificateData; + +/** Samples for VaultCertificates Create. */ +public final class VaultCertificatesCreateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVaultCred.json + */ + /** + * Sample code: Download vault credential file. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void downloadVaultCredentialFile( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultCertificates() + .define("BCDRIbzVault77777777-d41f-4550-9f70-7708a3a2283b-12-18-2017-vaultcredentials") + .withExistingVault("BCDRIbzRG", "BCDRIbzVault") + .withProperties( + new RawCertificateData() + .withAuthType(AuthType.AAD) + .withCertificate( + "MTTC3TCCAcWgAwIBAgIQEj9h+ZLlXK9KrqZX9UkAnzANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE3MTIxODA5MTc1M1oXDTE3MTIyMzA5Mjc1M1owHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK773/eZZ69RbZZAT05r9MjUxu9y1L1Pn1EgPk62IPJyHlO3OZA922eSBahhP4bgmFljN4LVReqQ5eT/wqO0Zhc+yFkUy4U4RdbQLeUZt2W7yy9XLXgVvqeYDgsjg/QhHetgHArQBW+tlQq5+zPdU7zchI4rbShSJrWhLrZFWiOyFPsuAE4joUQHNlRifdCTsBGKk8HRCY3j1S3c4bfEn3zxlrvrXXssRuW5mJM95rMk0tskoRxXSCi6i9bnlki2Cs9mpVMmBFeofs41KwzlWU0TgpdD8s1QEdvfGB5NbByfetPX7MfJaTBeHZEGbv/Iq8l72u8sPBoOhcaH7qDE/mECAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAILfgHluye1Q+WelhgWhpBBdIq2C0btfV8eFsZaTlBUrM0fwpxQSlAWc2oYHVMQI4A5iUjbDOY35O4yc+TnWKDBKf+laqDP+yos4aiUPuadGUZfvDk7kuw7xeECs64JpHAIEKdRHFW9rD3gwG+nIWaDnEL/7rTyhL3kXrRW2MSUAL8g3GX8Z45c+MQY0jmASIqWdhGn1vpAGyA9mKkzsqg7FXjg8GZb24tGl5Ky85+ip4dkBfXinDD8WwaGyjhGGK97ErvNmN36qly/H0H1Qngiovg1FbHDmkcFO5QclnEJsFFmcO2CcHp5Fqh2wXn5O1cQaxCIRTpQ/uXRpDjl2wKs=" + .getBytes())) + .create(); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoCreateOrUpdateSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..febfc222a50c1 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoCreateOrUpdateSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for VaultExtendedInfo CreateOrUpdate. */ +public final class VaultExtendedInfoCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/UpdateVaultExtendedInfo.json + */ + /** + * Sample code: Put ExtendedInfo of Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void putExtendedInfoOfResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultExtendedInfoes() + .createOrUpdateWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", null, Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoGetSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoGetSamples.java new file mode 100644 index 0000000000000..37d37c5b3f7d0 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoGetSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for VaultExtendedInfo Get. */ +public final class VaultExtendedInfoGetSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GETVaultExtendedInfo.json + */ + /** + * Sample code: Get ExtendedInfo of Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getExtendedInfoOfResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultExtendedInfoes() + .getWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoUpdateSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoUpdateSamples.java new file mode 100644 index 0000000000000..c924c7753711e --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultExtendedInfoUpdateSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for VaultExtendedInfo Update. */ +public final class VaultExtendedInfoUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/UpdateVaultExtendedInfo.json + */ + /** + * Sample code: PATCH ExtendedInfo of Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void pATCHExtendedInfoOfResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaultExtendedInfoes() + .updateWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", null, Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsCreateOrUpdateSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..047dd3504ce8e --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsCreateOrUpdateSamples.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.recoveryservices.generated; + +import com.azure.resourcemanager.recoveryservices.models.CmkKekIdentity; +import com.azure.resourcemanager.recoveryservices.models.CmkKeyVaultProperties; +import com.azure.resourcemanager.recoveryservices.models.IdentityData; +import com.azure.resourcemanager.recoveryservices.models.InfrastructureEncryptionState; +import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType; +import com.azure.resourcemanager.recoveryservices.models.Sku; +import com.azure.resourcemanager.recoveryservices.models.SkuName; +import com.azure.resourcemanager.recoveryservices.models.UserIdentity; +import com.azure.resourcemanager.recoveryservices.models.VaultProperties; +import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesEncryption; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Vaults CreateOrUpdate. */ +public final class VaultsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVault_WithCMK.json + */ + /** + * Sample code: Create or Update Vault with CustomerManagedKeys. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void createOrUpdateVaultWithCustomerManagedKeys( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .define("swaggerExample") + .withRegion("West US") + .withExistingResourceGroup("Default-RecoveryServices-ResourceGroup") + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKeyVaultProperties( + new CmkKeyVaultProperties() + .withKeyUri( + "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3")) + .withKekIdentity( + new CmkKekIdentity() + .withUserAssignedIdentity( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi")) + .withInfrastructureEncryption(InfrastructureEncryptionState.ENABLED))) + .withSku(new Sku().withName(SkuName.STANDARD)) + .create(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVault.json + */ + /** + * Sample code: Create or Update Recovery Services vault. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void createOrUpdateRecoveryServicesVault( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .define("swaggerExample") + .withRegion("West US") + .withExistingResourceGroup("Default-RecoveryServices-ResourceGroup") + .withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .withProperties(new VaultProperties()) + .withSku(new Sku().withName(SkuName.STANDARD)) + .create(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PUTVault_WithUserAssignedIdentity.json + */ + /** + * Sample code: Create or Update Vault with User Assigned Identity. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void createOrUpdateVaultWithUserAssignedIdentity( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .define("swaggerExample") + .withRegion("West US") + .withExistingResourceGroup("Default-RecoveryServices-ResourceGroup") + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .withProperties(new VaultProperties()) + .withSku(new Sku().withName(SkuName.STANDARD)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsDeleteSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsDeleteSamples.java new file mode 100644 index 0000000000000..6ee26a47a2484 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsDeleteSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for Vaults Delete. */ +public final class VaultsDeleteSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/DeleteVault.json + */ + /** + * Sample code: Delete Recovery Services Vault. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void deleteRecoveryServicesVault( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.vaults().deleteWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsGetByResourceGroupSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..258c856dc399b --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsGetByResourceGroupSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for Vaults GetByResourceGroup. */ +public final class VaultsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/GETVault.json + */ + /** + * Sample code: Get Recovery Services Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void getRecoveryServicesResource( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager + .vaults() + .getByResourceGroupWithResponse("Default-RecoveryServices-ResourceGroup", "swaggerExample", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsListByResourceGroupSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..07046e88365ed --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsListByResourceGroupSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for Vaults ListByResourceGroup. */ +public final class VaultsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListResources.json + */ + /** + * Sample code: List of Recovery Services Resources in ResourceGroup. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listOfRecoveryServicesResourcesInResourceGroup( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.vaults().listByResourceGroup("Default-RecoveryServices-ResourceGroup", Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsListSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsListSamples.java new file mode 100644 index 0000000000000..7518b5c9f9a6f --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsListSamples.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.recoveryservices.generated; + +import com.azure.core.util.Context; + +/** Samples for Vaults List. */ +public final class VaultsListSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/ListBySubscriptionIds.json + */ + /** + * Sample code: List of Recovery Services Resources in SubscriptionId. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void listOfRecoveryServicesResourcesInSubscriptionId( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + manager.vaults().list(Context.NONE); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsUpdateSamples.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsUpdateSamples.java new file mode 100644 index 0000000000000..6dfcb1fd171ba --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/samples/java/com/azure/resourcemanager/recoveryservices/generated/VaultsUpdateSamples.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.recoveryservices.models.CmkKekIdentity; +import com.azure.resourcemanager.recoveryservices.models.CmkKeyVaultProperties; +import com.azure.resourcemanager.recoveryservices.models.IdentityData; +import com.azure.resourcemanager.recoveryservices.models.InfrastructureEncryptionState; +import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType; +import com.azure.resourcemanager.recoveryservices.models.UserIdentity; +import com.azure.resourcemanager.recoveryservices.models.Vault; +import com.azure.resourcemanager.recoveryservices.models.VaultProperties; +import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesEncryption; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Vaults Update. */ +public final class VaultsUpdateSamples { + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault_WithCMK.json + */ + /** + * Sample code: Update Resource With CustomerManagedKeys. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithCustomerManagedKeys( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKeyVaultProperties( + new CmkKeyVaultProperties() + .withKeyUri( + "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3")) + .withKekIdentity( + new CmkKekIdentity() + .withUserAssignedIdentity( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi")) + .withInfrastructureEncryption(InfrastructureEncryptionState.ENABLED))) + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PatchVault_WithCMK2.json + */ + /** + * Sample code: Update Resource With CustomerManagedKeys2. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithCustomerManagedKeys2( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKekIdentity(new CmkKekIdentity().withUseSystemAssignedIdentity(true)))) + .withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault_WithCMK3.json + */ + /** + * Sample code: Update Resource With CustomerManagedKeys3. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithCustomerManagedKeys3( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withProperties( + new VaultProperties() + .withEncryption( + new VaultPropertiesEncryption() + .withKeyVaultProperties( + new CmkKeyVaultProperties() + .withKeyUri( + "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3")))) + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault.json + */ + /** + * Sample code: Update Resource. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResource(com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource.update().withTags(mapOf("PatchKey", "PatchKeyUpdated")).apply(); + } + + /* + * x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2021-08-01/examples/PATCHVault_WithUserAssignedIdentity.json + */ + /** + * Sample code: Update Resource With User Assigned Identity. + * + * @param manager Entry point to RecoveryServicesManager. + */ + public static void updateResourceWithUserAssignedIdentity( + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) { + Vault resource = + manager.vaults().getByResourceGroupWithResponse("HelloWorld", "swaggerExample", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("PatchKey", "PatchKeyUpdated")) + .withIdentity( + new IdentityData() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi", + new UserIdentity()))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +}