diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md index f6230465e962..975c8280fa12 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 (2021-03-01) +- Azure Resource Manager RecoveryServices client library for Java. This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2020-10. 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 f1c0cb15328d..cfebce183893 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-2020-10. 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}) @@ -75,6 +89,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/master/sdk/identity/azure-identity diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml index afec5b1d4b79..b1d26e713619 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml @@ -13,7 +13,7 @@ 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 + This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2020-10. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt https://github.com/Azure/azure-sdk-for-java @@ -41,6 +41,11 @@ + + com.azure + azure-core + 1.13.0 + com.azure azure-core-management 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 80e1cac92863..864e027d10fc 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 @@ -27,6 +27,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 +37,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; @@ -64,6 +66,8 @@ public final class RecoveryServicesManager { private VaultExtendedInfoes vaultExtendedInfoes; + private ResourceProviders resourceProviders; + private Usages usages; private final RecoveryServicesManagementClient clientObject; @@ -184,17 +188,31 @@ 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 (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()); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); @@ -279,6 +297,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 e3e15634178d..40080bea285f 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 000000000000..708e14f3b2a9 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/ResourceProvidersClient.java @@ -0,0 +1,107 @@ +// 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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +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) + SyncPoller, VaultInner> beginGetOperationResult( + 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) + SyncPoller, VaultInner> beginGetOperationResult( + 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) + VaultInner getOperationResult(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 23dda15b6a60..bc5b456dd5c5 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; @@ -100,7 +102,8 @@ public interface VaultsClient { * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner vault); + SyncPoller, VaultInner> beginCreateOrUpdate( + String resourceGroupName, String vaultName, VaultInner vault); /** * Creates or updates a Recovery Services vault. @@ -115,9 +118,38 @@ public interface VaultsClient { * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse( + SyncPoller, VaultInner> beginCreateOrUpdate( String resourceGroupName, String vaultName, VaultInner vault, 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.SINGLE) + VaultInner createOrUpdate(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.SINGLE) + VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner vault, Context context); + /** * Deletes a vault. * @@ -156,7 +188,8 @@ Response createOrUpdateWithResponse( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - VaultInner update(String resourceGroupName, String vaultName, PatchVault vault); + SyncPoller, VaultInner> beginUpdate( + String resourceGroupName, String vaultName, PatchVault vault); /** * Updates the vault. @@ -171,6 +204,35 @@ Response createOrUpdateWithResponse( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( + SyncPoller, VaultInner> beginUpdate( String resourceGroupName, String vaultName, PatchVault vault, 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.SINGLE) + VaultInner update(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.SINGLE) + 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 000000000000..57018b2a1fa3 --- /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/VaultExtendedInfoResourceInner.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultExtendedInfoResourceInner.java index 2a6489d1bec2..a7f7e60227bf 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 @@ -44,7 +44,7 @@ public class VaultExtendedInfoResourceInner extends ProxyResource { /* * 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/fluent/models/VaultInner.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java index 7c26f78d82a6..4d31ad85af7b 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 @@ -9,6 +9,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.recoveryservices.models.IdentityData; import com.azure.resourcemanager.recoveryservices.models.Sku; +import com.azure.resourcemanager.recoveryservices.models.SystemData; import com.azure.resourcemanager.recoveryservices.models.VaultProperties; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -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) { @@ -126,5 +142,8 @@ public void validate() { if (sku() != null) { sku().validate(); } + if (systemData() != null) { + systemData().validate(); + } } } 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 000000000000..212b7792a2ef --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.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.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; +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 RecoveryServicesManager serviceManager; + + OperationResourceImpl(OperationResourceInner innerObject, 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 RecoveryServicesManager manager() { + return this.serviceManager; + } +} 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 4ebae3e740cb..336d85144b2d 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 @@ -28,12 +28,12 @@ public OperationsImpl(OperationsClient innerClient, RecoveryServicesManager serv 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() { 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 4e31a2abc9b6..27722f92b330 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 @@ -31,13 +31,13 @@ public PrivateLinkResourcesOperationsImpl( 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) { 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 73ec143fc2ce..32f19ff4a4e6 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 = "2020-10-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/ReplicationUsagesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java index ef0eec19a1cf..fb1292f21411 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 @@ -28,12 +28,12 @@ public ReplicationUsagesImpl(ReplicationUsagesClient innerClient, RecoveryServic 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() { 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 000000000000..37ba78c95e58 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,515 @@ +// 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.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.ResourceProvidersClient; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; +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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 PollerFlux, VaultInner> beginGetOperationResultAsync( + String resourceGroupName, String vaultName, String operationId) { + Mono>> mono = + getOperationResultWithResponseAsync(resourceGroupName, vaultName, operationId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VaultInner.class, VaultInner.class, Context.NONE); + } + + /** + * 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 PollerFlux, VaultInner> beginGetOperationResultAsync( + String resourceGroupName, String vaultName, String operationId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + getOperationResultWithResponseAsync(resourceGroupName, vaultName, operationId, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VaultInner.class, VaultInner.class, 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) + public SyncPoller, VaultInner> beginGetOperationResult( + String resourceGroupName, String vaultName, String operationId) { + return beginGetOperationResultAsync(resourceGroupName, vaultName, operationId).getSyncPoller(); + } + + /** + * 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 SyncPoller, VaultInner> beginGetOperationResult( + String resourceGroupName, String vaultName, String operationId, Context context) { + return beginGetOperationResultAsync(resourceGroupName, vaultName, operationId, context).getSyncPoller(); + } + + /** + * 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 beginGetOperationResultAsync(resourceGroupName, vaultName, operationId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 getOperationResultAsync( + String resourceGroupName, String vaultName, String operationId, Context context) { + return beginGetOperationResultAsync(resourceGroupName, vaultName, operationId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 VaultInner getOperationResult( + String resourceGroupName, String vaultName, String operationId, Context context) { + return getOperationResultAsync(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 000000000000..ca49b15a9bf0 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.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.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.RecoveryServicesManager; +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 RecoveryServicesManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, 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 Vault getOperationResult(String resourceGroupName, String vaultName, String operationId, Context context) { + VaultInner inner = this.serviceClient().getOperationResult(resourceGroupName, vaultName, operationId, context); + if (inner != null) { + return new VaultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private RecoveryServicesManager manager() { + return this.serviceManager; + } +} 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 ab8988c3b995..1c3c1f2fc2c7 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 @@ -28,12 +28,12 @@ public UsagesImpl(UsagesClient innerClient, RecoveryServicesManager serviceManag 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() { 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 59bc1e9d88f0..f7cd81c534d8 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.Mono; final class Utils { static String getValueFromIdByName(String id, String name) { @@ -64,4 +72,125 @@ 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 pageIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { + super(new PagedFlux(Mono::empty)); + this.pageIterable = pageIterable; + this.mapper = mapper; + this.pageMapper = + 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 pageIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pageIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pageIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pageIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.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/VaultImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java index d14a068b84ca..7dc66ede4217 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 @@ -11,6 +11,7 @@ import com.azure.resourcemanager.recoveryservices.models.IdentityData; import com.azure.resourcemanager.recoveryservices.models.PatchVault; import com.azure.resourcemanager.recoveryservices.models.Sku; +import com.azure.resourcemanager.recoveryservices.models.SystemData; import com.azure.resourcemanager.recoveryservices.models.Vault; import com.azure.resourcemanager.recoveryservices.models.VaultProperties; import java.util.Collections; @@ -58,6 +59,10 @@ public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -90,8 +95,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,8 +104,7 @@ public Vault create(Context context) { serviceManager .serviceClient() .getVaults() - .createOrUpdateWithResponse(resourceGroupName, vaultName, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), context); return this; } @@ -118,21 +121,13 @@ 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; } 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 3b15c7a58b6c..c64b6f20d823 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, @@ -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 @@ -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.SINGLE) + 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, Context.NONE); + } + + /** + * 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 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.SINGLE) + 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.SINGLE) + 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,6 +929,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S this.client.getApiVersion(), resourceGroupName, vaultName, + accept, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); } @@ -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 @@ -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.SINGLE) + 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, Context.NONE); + } + + /** + * 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 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.SINGLE) + 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.SINGLE) + 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(); } /** 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 ddd785de7ea0..eed986432cf4 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 @@ -30,22 +30,22 @@ public VaultsImpl(VaultsClient innerClient, RecoveryServicesManager serviceManag 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) { 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 000000000000..c44a5c7ebb94 --- /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 000000000000..301258c1d233 --- /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/CreatedByType.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CreatedByType.java new file mode 100644 index 000000000000..f83f1758b8da --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CreatedByType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreatedByType. */ +public final class CreatedByType extends ExpandableStringEnum { + /** Static value User for CreatedByType. */ + public static final CreatedByType USER = fromString("User"); + + /** Static value Application for CreatedByType. */ + public static final CreatedByType APPLICATION = fromString("Application"); + + /** Static value ManagedIdentity for CreatedByType. */ + public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value Key for CreatedByType. */ + public static final CreatedByType KEY = fromString("Key"); + + /** + * Creates or finds a CreatedByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreatedByType. + */ + @JsonCreator + public static CreatedByType fromString(String name) { + return fromString(name, CreatedByType.class); + } + + /** @return known CreatedByType values. */ + public static Collection values() { + return values(CreatedByType.class); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ErrorAdditionalInfo.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..943daaea0cbe --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ErrorAdditionalInfo.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; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} 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 e1c30df92c49..2721d9ac563e 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 @@ -8,6 +8,7 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; /** Identity for the resource. */ @Fluent @@ -27,11 +28,22 @@ 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") + private Map userAssignedIdentities; + /** * Get the principalId property: The principal ID of resource identity. * @@ -51,7 +63,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 +73,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 +84,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 +119,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 000000000000..0e07676195c5 --- /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 000000000000..a62bda1dc364 --- /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 7375d3bcd66d..b9bb0adb9b29 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 @@ -31,7 +31,7 @@ public class PatchTrackedResource extends ProxyResource { /* * 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/ResourceCertificateAndAadDetails.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java index d86dc76d5bd8..bbf81187a892 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 4b920cd436f8..afa21bba313e 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 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. + */ + Vault getOperationResult(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 0f1005b290fb..93037a79e588 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,12 @@ public final class Sku { @JsonProperty(value = "name", required = true) private SkuName name; + /* + * The Sku tier. + */ + @JsonProperty(value = "tier") + private String tier; + /** * Get the name property: The Sku name. * @@ -40,6 +46,26 @@ 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; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/SystemData.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/SystemData.java new file mode 100644 index 000000000000..8789bf54ac43 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/SystemData.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; +import java.time.OffsetDateTime; + +/** Metadata pertaining to creation and last modification of the resource. */ +@Fluent +public final class SystemData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); + + /* + * The identity that created the resource. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /* + * The type of identity that created the resource. + */ + @JsonProperty(value = "createdByType") + private CreatedByType createdByType; + + /* + * The timestamp of resource creation (UTC). + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedBy") + private String lastModifiedBy; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedByType") + private CreatedByType lastModifiedByType; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedAt") + private OffsetDateTime lastModifiedAt; + + /** + * Get the createdBy property: The identity that created the resource. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The identity that created the resource. + * + * @param createdBy the createdBy value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the createdByType property: The type of identity that created the resource. + * + * @return the createdByType value. + */ + public CreatedByType createdByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: The type of identity that created the resource. + * + * @param createdByType the createdByType value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedByType(CreatedByType createdByType) { + this.createdByType = createdByType; + return this; + } + + /** + * Get the createdAt property: The timestamp of resource creation (UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The timestamp of resource creation (UTC). + * + * @param createdAt the createdAt value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the lastModifiedBy property: The identity that last modified the resource. + * + * @return the lastModifiedBy value. + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: The identity that last modified the resource. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Get the lastModifiedByType property: The type of identity that last modified the resource. + * + * @return the lastModifiedByType value. + */ + public CreatedByType lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the lastModifiedByType property: The type of identity that last modified the resource. + * + * @param lastModifiedByType the lastModifiedByType value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + return this; + } + + /** + * Get the lastModifiedAt property: The type of identity that last modified the resource. + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The type of identity that last modified the resource. + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + 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/UserIdentity.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/UserIdentity.java new file mode 100644 index 000000000000..3adeefb60778 --- /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 2f0622fb3095..c9ab61d1db37 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 @@ -67,6 +67,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/VaultProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java index a094519381c2..5402072d0ba5 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,12 @@ 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; + /** * Get the provisioningState property: Provisioning State. * @@ -101,6 +107,26 @@ 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; + } + /** * Validates the instance. * @@ -113,5 +139,8 @@ public void validate() { if (privateEndpointConnections() != null) { privateEndpointConnections().forEach(e -> e.validate()); } + if (encryption() != null) { + encryption().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 000000000000..9daafacf9f84 --- /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(); + } + } +}