diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/CHANGELOG.md index f6230465e962..791cc86954f1 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-07-14) +- Azure Resource Manager RecoveryServices client library for Java. This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2021-06. 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 1520bad97953..198b6733dd31 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/README.md +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/README.md @@ -2,7 +2,21 @@ Azure Resource Manager RecoveryServices client library for Java. -This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2016-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2021-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] ## Getting started @@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for RecoveryServices Management SDK. R com.azure.resourcemanager azure-resourcemanager-recoveryservices - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -60,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on ## Examples + + ## Troubleshooting ## Next steps @@ -75,6 +91,8 @@ For details on contributing to this repository, see the [contributing guide](htt 1. Create new Pull Request +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ [jdk]: https://docs.microsoft.com/java/azure/jdk/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml index cc3f54470b50..ea7c0ce58db5 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml @@ -1,62 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-recoveryservices - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-recoveryservices + 1.0.0-beta.2 + jar - Microsoft Azure SDK for RecoveryServices Management - This package contains Microsoft Azure SDK for RecoveryServices Management SDK. Recovery Services Client. Package tag package-2016-06. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for RecoveryServices Management + This package contains Microsoft Azure SDK for RecoveryServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Recovery Services Client. Package tag package-2021-06. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + - - https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - microsoft - Microsoft - - - - UTF-8 - - - - - com.azure - azure-core-management - 1.3.1 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.5 - - true - - - - + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManager.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManager.java index 80e1cac92863..7ab7cc01676e 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 @@ -9,7 +9,6 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +16,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -27,6 +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; @@ -109,6 +113,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -148,6 +153,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -184,25 +200,40 @@ public RecoveryServicesManager authenticate(TokenCredential credential, AzurePro Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.recoveryservices") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } List policies = new ArrayList<>(); - policies - .add( - new UserAgentPolicy( - null, - "com.azure.resourcemanager.recoveryservices", - "1.0.0-beta.1", - Configuration.getGlobalConfiguration())); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); policies.add(new RequestIdPolicy()); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = @@ -279,6 +310,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..3da7f26a4a41 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/ResourceProvidersClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationResourceInner getOperationStatus(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VaultInner getOperationResult(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/VaultsClient.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/VaultsClient.java index 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..99b2b7e63c39 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/fluent/models/VaultInner.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.recoveryservices.models.IdentityData; import com.azure.resourcemanager.recoveryservices.models.Sku; @@ -37,6 +38,12 @@ public final class VaultInner extends Resource { @JsonProperty(value = "sku") private Sku sku; + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + /** * Get the identity property: Identity for the resource. * @@ -97,6 +104,15 @@ public VaultInner withSku(Sku sku) { return this; } + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** {@inheritDoc} */ @Override public VaultInner withLocation(String location) { diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java index aa46670c680f..1e7944217356 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/CheckNameAvailabilityResultImpl.java @@ -4,17 +4,17 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.CheckNameAvailabilityResultInner; import com.azure.resourcemanager.recoveryservices.models.CheckNameAvailabilityResult; public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { private CheckNameAvailabilityResultInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; CheckNameAvailabilityResultImpl( - CheckNameAvailabilityResultInner innerObject, RecoveryServicesManager serviceManager) { + CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -35,7 +35,7 @@ public CheckNameAvailabilityResultInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java index a0981d42816e..e63a23e609d4 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ClientDiscoveryValueForSingleApiImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.ClientDiscoveryValueForSingleApiInner; import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryDisplay; import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryForProperties; @@ -13,10 +12,11 @@ public final class ClientDiscoveryValueForSingleApiImpl implements ClientDiscoveryValueForSingleApi { private ClientDiscoveryValueForSingleApiInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; ClientDiscoveryValueForSingleApiImpl( - ClientDiscoveryValueForSingleApiInner innerObject, RecoveryServicesManager serviceManager) { + ClientDiscoveryValueForSingleApiInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -41,7 +41,7 @@ public ClientDiscoveryValueForSingleApiInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.java new file mode 100644 index 000000000000..5a069ebf8e35 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationResourceImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.models.OperationResource; +import java.time.OffsetDateTime; + +public final class OperationResourceImpl implements OperationResource { + private OperationResourceInner innerObject; + + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; + + OperationResourceImpl( + OperationResourceInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OperationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java index ed1d7cdb0ce6..cc7d2129c690 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsClientImpl.java @@ -108,7 +108,7 @@ private Mono> listSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -228,7 +228,7 @@ private Mono> listNextSingl res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java index 4ebae3e740cb..befb26b49b70 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/OperationsImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.OperationsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.ClientDiscoveryValueForSingleApiInner; import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryValueForSingleApi; @@ -19,28 +18,30 @@ public final class OperationsImpl implements Operations { private final OperationsClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public OperationsImpl(OperationsClient innerClient, RecoveryServicesManager serviceManager) { + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); } private OperationsClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java index 61b0f0a3718b..ab67030f7269 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourceImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.recoveryservices.models.PrivateLinkResource; import java.util.Collections; @@ -13,9 +12,11 @@ public final class PrivateLinkResourceImpl implements PrivateLinkResource { private PrivateLinkResourceInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, RecoveryServicesManager serviceManager) { + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -58,7 +59,7 @@ public PrivateLinkResourceInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java index 49fde72c0b02..5bc79ec844f8 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsClientImpl.java @@ -159,7 +159,7 @@ private Mono> listSinglePageAsync( res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -334,7 +334,7 @@ private Mono> getWithResponseAsync( privateLinkResourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -481,7 +481,7 @@ private Mono> listNextSinglePageAsync(St res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java index 4e31a2abc9b6..240475b4d3b7 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/PrivateLinkResourcesOperationsImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.PrivateLinkResourcesOperationsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.recoveryservices.models.PrivateLinkResource; @@ -21,23 +20,24 @@ public final class PrivateLinkResourcesOperationsImpl implements PrivateLinkReso private final PrivateLinkResourcesOperationsClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; public PrivateLinkResourcesOperationsImpl( - PrivateLinkResourcesOperationsClient innerClient, RecoveryServicesManager serviceManager) { + PrivateLinkResourcesOperationsClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String resourceGroupName, String vaultName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName); - return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String vaultName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName, context); - return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); } public PrivateLinkResource get(String resourceGroupName, String vaultName, String privateLinkResourceName) { @@ -69,7 +69,7 @@ private PrivateLinkResourcesOperationsClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java index 0a81507c431e..add3842dd58f 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesClientImpl.java @@ -127,7 +127,7 @@ private Mono> checkNameAvailabilityWi input, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java index 2f4c179924ca..134615bc9751 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.RecoveryServicesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.CheckNameAvailabilityResultInner; import com.azure.resourcemanager.recoveryservices.models.CheckNameAvailabilityParameters; @@ -21,9 +20,11 @@ public final class RecoveryServicesImpl implements RecoveryServices { private final RecoveryServicesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public RecoveryServicesImpl(RecoveryServicesClient innerClient, RecoveryServicesManager serviceManager) { + public RecoveryServicesImpl( + RecoveryServicesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -58,7 +59,7 @@ private RecoveryServicesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java index 73ec143fc2ce..4e8b10e76120 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RecoveryServicesManagementClientImpl.java @@ -27,6 +27,7 @@ import com.azure.resourcemanager.recoveryservices.fluent.RecoveryServicesManagementClient; import com.azure.resourcemanager.recoveryservices.fluent.RegisteredIdentitiesClient; import com.azure.resourcemanager.recoveryservices.fluent.ReplicationUsagesClient; +import com.azure.resourcemanager.recoveryservices.fluent.ResourceProvidersClient; import com.azure.resourcemanager.recoveryservices.fluent.UsagesClient; import com.azure.resourcemanager.recoveryservices.fluent.VaultCertificatesClient; import com.azure.resourcemanager.recoveryservices.fluent.VaultExtendedInfoesClient; @@ -214,6 +215,18 @@ public VaultExtendedInfoesClient getVaultExtendedInfoes() { return this.vaultExtendedInfoes; } + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + /** The UsagesClient object to access its operations. */ private final UsagesClient usages; @@ -248,7 +261,7 @@ public UsagesClient getUsages() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2016-06-01"; + this.apiVersion = "2021-06-01"; this.vaultCertificates = new VaultCertificatesClientImpl(this); this.registeredIdentities = new RegisteredIdentitiesClientImpl(this); this.replicationUsages = new ReplicationUsagesClientImpl(this); @@ -257,6 +270,7 @@ public UsagesClient getUsages() { this.vaults = new VaultsClientImpl(this); this.operations = new OperationsClientImpl(this); this.vaultExtendedInfoes = new VaultExtendedInfoesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); this.usages = new UsagesClientImpl(this); } @@ -342,7 +356,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, if (managementError.getCode() == null || managementError.getMessage() == null) { managementError = null; } - } catch (IOException ioe) { + } catch (IOException | RuntimeException ioe) { logger.logThrowableAsWarning(ioe); } } @@ -371,7 +385,7 @@ private static final class HttpResponseImpl extends HttpResponse { super(null); this.statusCode = statusCode; this.httpHeaders = httpHeaders; - this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); } public int getStatusCode() { diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java index 205ec3f49aee..85e8a70cfc45 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesClientImpl.java @@ -117,7 +117,7 @@ private Mono> deleteWithResponseAsync( vaultName, identityName, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java index b7936e9800eb..0a2da7bece01 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/RegisteredIdentitiesImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.RegisteredIdentitiesClient; import com.azure.resourcemanager.recoveryservices.models.RegisteredIdentities; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -17,9 +16,11 @@ public final class RegisteredIdentitiesImpl implements RegisteredIdentities { private final RegisteredIdentitiesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public RegisteredIdentitiesImpl(RegisteredIdentitiesClient innerClient, RecoveryServicesManager serviceManager) { + public RegisteredIdentitiesImpl( + RegisteredIdentitiesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -37,7 +38,7 @@ private RegisteredIdentitiesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java index 897377356682..f2c067f0ca92 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsageImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.ReplicationUsageInner; import com.azure.resourcemanager.recoveryservices.models.JobsSummary; import com.azure.resourcemanager.recoveryservices.models.MonitoringSummary; @@ -13,9 +12,11 @@ public final class ReplicationUsageImpl implements ReplicationUsage { private ReplicationUsageInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - ReplicationUsageImpl(ReplicationUsageInner innerObject, RecoveryServicesManager serviceManager) { + ReplicationUsageImpl( + ReplicationUsageInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -48,7 +49,7 @@ public ReplicationUsageInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java index 8df6493090ac..a18df0947038 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesClientImpl.java @@ -123,7 +123,7 @@ private Mono> listSinglePageAsync(String re res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java index ef0eec19a1cf..10281740305c 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ReplicationUsagesImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.ReplicationUsagesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.ReplicationUsageInner; import com.azure.resourcemanager.recoveryservices.models.ReplicationUsage; @@ -19,28 +18,30 @@ public final class ReplicationUsagesImpl implements ReplicationUsages { private final ReplicationUsagesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public ReplicationUsagesImpl(ReplicationUsagesClient innerClient, RecoveryServicesManager serviceManager) { + public ReplicationUsagesImpl( + ReplicationUsagesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String resourceGroupName, String vaultName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName); - return inner.mapPage(inner1 -> new ReplicationUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ReplicationUsageImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String vaultName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName, context); - return inner.mapPage(inner1 -> new ReplicationUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new ReplicationUsageImpl(inner1, this.manager())); } private ReplicationUsagesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..0152fa7b8a76 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.recoveryservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final RecoveryServicesManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(RecoveryServicesManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RecoveryServicesManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RecoveryServicesMana") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + + "/vaults/{vaultName}/operationStatus/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOperationStatus( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + + "/vaults/{vaultName}/operationResults/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOperationResult( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationStatusWithResponseAsync( + String resourceGroupName, String vaultName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOperationStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationStatusWithResponseAsync( + String resourceGroupName, String vaultName, String operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOperationStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationStatusAsync( + String resourceGroupName, String vaultName, String operationId) { + return getOperationStatusWithResponseAsync(resourceGroupName, vaultName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationResourceInner getOperationStatus(String resourceGroupName, String vaultName, String operationId) { + return getOperationStatusAsync(resourceGroupName, vaultName, operationId).block(); + } + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + return getOperationStatusWithResponseAsync(resourceGroupName, vaultName, operationId, context).block(); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String resourceGroupName, String vaultName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOperationResult( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String resourceGroupName, String vaultName, String operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOperationResult( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationResultAsync(String resourceGroupName, String vaultName, String operationId) { + return getOperationResultWithResponseAsync(resourceGroupName, vaultName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VaultInner getOperationResult(String resourceGroupName, String vaultName, String operationId) { + return getOperationResultAsync(resourceGroupName, vaultName, operationId).block(); + } + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + return getOperationResultWithResponseAsync(resourceGroupName, vaultName, operationId, context).block(); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..677324986442 --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/ResourceProvidersImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.recoveryservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.recoveryservices.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; +import com.azure.resourcemanager.recoveryservices.models.OperationResource; +import com.azure.resourcemanager.recoveryservices.models.ResourceProviders; +import com.azure.resourcemanager.recoveryservices.models.Vault; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResource getOperationStatus(String resourceGroupName, String vaultName, String operationId) { + OperationResourceInner inner = + this.serviceClient().getOperationStatus(resourceGroupName, vaultName, operationId); + if (inner != null) { + return new OperationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + Response inner = + this.serviceClient().getOperationStatusWithResponse(resourceGroupName, vaultName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Vault getOperationResult(String resourceGroupName, String vaultName, String operationId) { + VaultInner inner = this.serviceClient().getOperationResult(resourceGroupName, vaultName, operationId); + if (inner != null) { + return new VaultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + Response inner = + this.serviceClient().getOperationResultWithResponse(resourceGroupName, vaultName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VaultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java index 2a580ba90e53..9e7c12be0929 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesClientImpl.java @@ -123,7 +123,7 @@ private Mono> listByVaultsSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java index ab8988c3b995..bb6ab82a3c53 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/UsagesImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.UsagesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultUsageInner; import com.azure.resourcemanager.recoveryservices.models.Usages; @@ -19,28 +18,29 @@ public final class UsagesImpl implements Usages { private final UsagesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public UsagesImpl(UsagesClient innerClient, RecoveryServicesManager serviceManager) { + public UsagesImpl( + UsagesClient innerClient, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable listByVaults(String resourceGroupName, String vaultName) { PagedIterable inner = this.serviceClient().listByVaults(resourceGroupName, vaultName); - return inner.mapPage(inner1 -> new VaultUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultUsageImpl(inner1, this.manager())); } public PagedIterable listByVaults(String resourceGroupName, String vaultName, Context context) { PagedIterable inner = this.serviceClient().listByVaults(resourceGroupName, vaultName, context); - return inner.mapPage(inner1 -> new VaultUsageImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultUsageImpl(inner1, this.manager())); } private UsagesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java index 59bc1e9d88f0..177f5ec5a638 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/Utils.java @@ -4,12 +4,20 @@ package com.azure.resourcemanager.recoveryservices.implementation; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.CoreUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; final class Utils { static String getValueFromIdByName(String id, String name) { @@ -64,4 +72,133 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } return null; } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java index 80f2bbe1518d..c25a10862eb0 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificateResponseImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultCertificateResponseInner; import com.azure.resourcemanager.recoveryservices.models.CertificateRequest; import com.azure.resourcemanager.recoveryservices.models.RawCertificateData; @@ -16,9 +15,11 @@ public final class VaultCertificateResponseImpl implements VaultCertificateResponse, VaultCertificateResponse.Definition { private VaultCertificateResponseInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - VaultCertificateResponseImpl(VaultCertificateResponseInner innerObject, RecoveryServicesManager serviceManager) { + VaultCertificateResponseImpl( + VaultCertificateResponseInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -43,7 +44,7 @@ public VaultCertificateResponseInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } @@ -82,7 +83,8 @@ public VaultCertificateResponse create(Context context) { return this; } - VaultCertificateResponseImpl(String name, RecoveryServicesManager serviceManager) { + VaultCertificateResponseImpl( + String name, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = new VaultCertificateResponseInner(); this.serviceManager = serviceManager; this.certificateName = name; diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java index a846367624e9..a407f951a561 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesClientImpl.java @@ -133,7 +133,7 @@ private Mono> createWithResponseAsync( certificateRequest, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java index 9d19a96a85ca..89ceeafdfb91 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultCertificatesImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.VaultCertificatesClient; import com.azure.resourcemanager.recoveryservices.models.VaultCertificates; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -15,9 +14,11 @@ public final class VaultCertificatesImpl implements VaultCertificates { private final VaultCertificatesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public VaultCertificatesImpl(VaultCertificatesClient innerClient, RecoveryServicesManager serviceManager) { + public VaultCertificatesImpl( + VaultCertificatesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -26,7 +27,7 @@ private VaultCertificatesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java index 39f747ebc18d..d6b9713bdb8a 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoResourceImpl.java @@ -4,16 +4,17 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultExtendedInfoResourceInner; import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoResource; public final class VaultExtendedInfoResourceImpl implements VaultExtendedInfoResource { private VaultExtendedInfoResourceInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - VaultExtendedInfoResourceImpl(VaultExtendedInfoResourceInner innerObject, RecoveryServicesManager serviceManager) { + VaultExtendedInfoResourceImpl( + VaultExtendedInfoResourceInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -54,7 +55,7 @@ public VaultExtendedInfoResourceInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java index d25a7f7225a9..a2ab3d985a05 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesClientImpl.java @@ -150,7 +150,7 @@ private Mono> getWithResponseAsync( vaultName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -309,7 +309,7 @@ private Mono> createOrUpdateWithRespons resourceExtendedInfoDetails, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -490,7 +490,7 @@ private Mono> updateWithResponseAsync( resourceExtendedInfoDetails, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java index 98e535d471b3..fbc45c38861c 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultExtendedInfoesImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.VaultExtendedInfoesClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultExtendedInfoResourceInner; import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoResource; @@ -20,9 +19,11 @@ public final class VaultExtendedInfoesImpl implements VaultExtendedInfoes { private final VaultExtendedInfoesClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public VaultExtendedInfoesImpl(VaultExtendedInfoesClient innerClient, RecoveryServicesManager serviceManager) { + public VaultExtendedInfoesImpl( + VaultExtendedInfoesClient innerClient, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -115,7 +116,7 @@ private VaultExtendedInfoesClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java index d14a068b84ca..e006e29f2de4 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultImpl.java @@ -5,8 +5,8 @@ package com.azure.resourcemanager.recoveryservices.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.IdentityData; import com.azure.resourcemanager.recoveryservices.models.PatchVault; @@ -19,7 +19,7 @@ public final class VaultImpl implements Vault, Vault.Definition, Vault.Update { private VaultInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; public String id() { return this.innerModel().id(); @@ -58,6 +58,10 @@ public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -70,7 +74,7 @@ public VaultInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } @@ -90,8 +94,7 @@ public Vault create() { serviceManager .serviceClient() .getVaults() - .createOrUpdateWithResponse(resourceGroupName, vaultName, this.innerModel(), Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), Context.NONE); return this; } @@ -100,12 +103,11 @@ public Vault create(Context context) { serviceManager .serviceClient() .getVaults() - .createOrUpdateWithResponse(resourceGroupName, vaultName, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), context); return this; } - VaultImpl(String name, RecoveryServicesManager serviceManager) { + VaultImpl(String name, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = new VaultInner(); this.serviceManager = serviceManager; this.vaultName = name; @@ -118,25 +120,18 @@ public VaultImpl update() { public Vault apply() { this.innerObject = - serviceManager - .serviceClient() - .getVaults() - .updateWithResponse(resourceGroupName, vaultName, updateVault, Context.NONE) - .getValue(); + serviceManager.serviceClient().getVaults().update(resourceGroupName, vaultName, updateVault, Context.NONE); return this; } public Vault apply(Context context) { this.innerObject = - serviceManager - .serviceClient() - .getVaults() - .updateWithResponse(resourceGroupName, vaultName, updateVault, context) - .getValue(); + serviceManager.serviceClient().getVaults().update(resourceGroupName, vaultName, updateVault, context); return this; } - VaultImpl(VaultInner innerObject, RecoveryServicesManager serviceManager) { + VaultImpl( + VaultInner innerObject, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java index 1076156b80f4..b5d94308cc8b 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultUsageImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.recoveryservices.implementation; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultUsageInner; import com.azure.resourcemanager.recoveryservices.models.NameInfo; import com.azure.resourcemanager.recoveryservices.models.UsagesUnit; @@ -14,9 +13,11 @@ public final class VaultUsageImpl implements VaultUsage { private VaultUsageInner innerObject; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - VaultUsageImpl(VaultUsageInner innerObject, RecoveryServicesManager serviceManager) { + VaultUsageImpl( + VaultUsageInner innerObject, + com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -49,7 +50,7 @@ public VaultUsageInner innerModel() { return this.innerObject; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java index 3b15c7a58b6c..9a6c9e232f4a 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsClientImpl.java @@ -27,13 +27,18 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.recoveryservices.fluent.VaultsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.PatchVault; import com.azure.resourcemanager.recoveryservices.models.VaultList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in VaultsClient. */ @@ -109,7 +114,7 @@ Mono> getByResourceGroup( + "/vaults/{vaultName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @@ -119,7 +124,7 @@ Mono> createOrUpdate( @HeaderParam("Accept") String accept, Context context); - @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + "/vaults/{vaultName}") @@ -131,15 +136,16 @@ Mono> delete( @QueryParam("api-version") String apiVersion, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" + "/vaults/{vaultName}") - @ExpectedResponses({200, 201}) + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @@ -211,7 +217,7 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -359,7 +365,7 @@ private Mono> listByResourceGroupSinglePageAsync(Strin res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -518,7 +524,7 @@ private Mono> getByResourceGroupWithResponseAsync(String re vaultName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -634,7 +640,7 @@ public Response getByResourceGroupWithResponse( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String vaultName, VaultInner vault) { if (this.client.getEndpoint() == null) { return Mono @@ -674,7 +680,7 @@ private Mono> createOrUpdateWithResponseAsync( vault, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -690,7 +696,7 @@ private Mono> createOrUpdateWithResponseAsync( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String vaultName, VaultInner vault, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -730,6 +736,86 @@ private Mono> createOrUpdateWithResponseAsync( context); } + /** + * Creates or updates a Recovery Services vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.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,8 +929,9 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S this.client.getApiVersion(), resourceGroupName, vaultName, + accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -865,6 +966,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S if (vaultName == null) { return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); } + final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( @@ -873,6 +975,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S this.client.getApiVersion(), resourceGroupName, vaultName, + accept, context); } @@ -933,7 +1036,7 @@ public Response deleteWithResponse(String resourceGroupName, String vaultN * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String vaultName, PatchVault vault) { if (this.client.getEndpoint() == null) { return Mono @@ -973,7 +1076,7 @@ private Mono> updateWithResponseAsync( vault, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -989,7 +1092,7 @@ private Mono> updateWithResponseAsync( * @return resource information, as returned by the resource provider. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String vaultName, PatchVault vault, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1029,6 +1132,85 @@ private Mono> updateWithResponseAsync( context); } + /** + * Updates the vault. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param vault Recovery Services Vault to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information, as returned by the resource provider. + */ + @ServiceMethod(returns = ReturnType.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(); } /** @@ -1120,7 +1315,7 @@ private Mono> listBySubscriptionIdNextSinglePageAsync( res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1192,7 +1387,7 @@ private Mono> listByResourceGroupNextSinglePageAsync(S res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java index ddd785de7ea0..1c4f7f4ed9c9 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/implementation/VaultsImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.recoveryservices.RecoveryServicesManager; import com.azure.resourcemanager.recoveryservices.fluent.VaultsClient; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import com.azure.resourcemanager.recoveryservices.models.Vault; @@ -21,31 +20,32 @@ public final class VaultsImpl implements Vaults { private final VaultsClient innerClient; - private final RecoveryServicesManager serviceManager; + private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager; - public VaultsImpl(VaultsClient innerClient, RecoveryServicesManager serviceManager) { + public VaultsImpl( + VaultsClient innerClient, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return inner.mapPage(inner1 -> new VaultImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); } public Vault getByResourceGroup(String resourceGroupName, String vaultName) { @@ -159,7 +159,7 @@ private VaultsClient serviceClient() { return this.innerClient; } - private RecoveryServicesManager manager() { + private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() { return this.serviceManager; } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKekIdentity.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/CmkKekIdentity.java new file mode 100644 index 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/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/PrivateEndpointConnectionVaultProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java index c2b291935687..369946c21d37 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/PrivateEndpointConnectionVaultProperties.java @@ -27,6 +27,25 @@ public final class PrivateEndpointConnectionVaultProperties { @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private PrivateEndpointConnection properties; + /* + * The name of the private Endpoint Connection + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type, which will be of the format, + * Microsoft.RecoveryServices/vaults/privateEndpointConnections + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The location of the private Endpoint connection + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + /** * Get the id property: Format of id * subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}. @@ -46,6 +65,34 @@ public PrivateEndpointConnection properties() { return this.properties; } + /** + * Get the name property: The name of the private Endpoint Connection. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type, which will be of the format, + * Microsoft.RecoveryServices/vaults/privateEndpointConnections. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the location property: The location of the private Endpoint connection. + * + * @return the location value. + */ + public String location() { + return this.location; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceCertificateAndAadDetails.java index 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 { + /** Static value Unknown for ResourceMoveState. */ + public static final ResourceMoveState UNKNOWN = fromString("Unknown"); + + /** Static value InProgress for ResourceMoveState. */ + public static final ResourceMoveState IN_PROGRESS = fromString("InProgress"); + + /** Static value PrepareFailed for ResourceMoveState. */ + public static final ResourceMoveState PREPARE_FAILED = fromString("PrepareFailed"); + + /** Static value CommitFailed for ResourceMoveState. */ + public static final ResourceMoveState COMMIT_FAILED = fromString("CommitFailed"); + + /** Static value PrepareTimedout for ResourceMoveState. */ + public static final ResourceMoveState PREPARE_TIMEDOUT = fromString("PrepareTimedout"); + + /** Static value CommitTimedout for ResourceMoveState. */ + public static final ResourceMoveState COMMIT_TIMEDOUT = fromString("CommitTimedout"); + + /** Static value MoveSucceeded for ResourceMoveState. */ + public static final ResourceMoveState MOVE_SUCCEEDED = fromString("MoveSucceeded"); + + /** Static value Failure for ResourceMoveState. */ + public static final ResourceMoveState FAILURE = fromString("Failure"); + + /** Static value CriticalFailure for ResourceMoveState. */ + public static final ResourceMoveState CRITICAL_FAILURE = fromString("CriticalFailure"); + + /** Static value PartialSuccess for ResourceMoveState. */ + public static final ResourceMoveState PARTIAL_SUCCESS = fromString("PartialSuccess"); + + /** + * Creates or finds a ResourceMoveState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceMoveState. + */ + @JsonCreator + public static ResourceMoveState fromString(String name) { + return fromString(name, ResourceMoveState.class); + } + + /** @return known ResourceMoveState values. */ + public static Collection values() { + return values(ResourceMoveState.class); + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceProviders.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceProviders.java new file mode 100644 index 000000000000..f3f6a38d456a --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/ResourceProviders.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + OperationResource getOperationStatus(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation status for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation status for a resource. + */ + Response getOperationStatusWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + Vault getOperationResult(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation result for a resource. + * + * @param resourceGroupName The name of the resource group where the recovery services vault is present. + * @param vaultName The name of the recovery services vault. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation result for a resource. + */ + Response getOperationResultWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java index 0f1005b290fb..b0d557458bcc 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Sku.java @@ -20,6 +20,30 @@ public final class Sku { @JsonProperty(value = "name", required = true) private SkuName name; + /* + * The Sku tier. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * The sku family + */ + @JsonProperty(value = "family") + private String family; + + /* + * The sku size + */ + @JsonProperty(value = "size") + private String size; + + /* + * The sku capacity + */ + @JsonProperty(value = "capacity") + private String capacity; + /** * Get the name property: The Sku name. * @@ -40,6 +64,86 @@ public Sku withName(SkuName name) { return this; } + /** + * Get the tier property: The Sku tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The Sku tier. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the family property: The sku family. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The sku family. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the size property: The sku size. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The sku size. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the capacity property: The sku capacity. + * + * @return the capacity value. + */ + public String capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The sku capacity. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(String capacity) { + this.capacity = capacity; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/UserIdentity.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/UserIdentity.java new file mode 100644 index 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..4aa9fe1a9608 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Vault.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/Vault.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.recoveryservices.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.recoveryservices.fluent.models.VaultInner; import java.util.Map; @@ -67,6 +68,13 @@ public interface Vault { */ Sku sku(); + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the region of the resource. * diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java index a094519381c2..57a65488f3b3 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultProperties.java @@ -45,6 +45,24 @@ public final class VaultProperties { @JsonProperty(value = "privateEndpointStateForSiteRecovery", access = JsonProperty.Access.WRITE_ONLY) private VaultPrivateEndpointState privateEndpointStateForSiteRecovery; + /* + * Customer Managed Key details of the resource. + */ + @JsonProperty(value = "encryption") + private VaultPropertiesEncryption encryption; + + /* + * The details of the latest move operation performed on the Azure Resource + */ + @JsonProperty(value = "moveDetails") + private VaultPropertiesMoveDetails moveDetails; + + /* + * The State of the Resource after the move operation + */ + @JsonProperty(value = "moveState", access = JsonProperty.Access.WRITE_ONLY) + private ResourceMoveState moveState; + /** * Get the provisioningState property: Provisioning State. * @@ -101,6 +119,55 @@ public VaultPrivateEndpointState privateEndpointStateForSiteRecovery() { return this.privateEndpointStateForSiteRecovery; } + /** + * Get the encryption property: Customer Managed Key details of the resource. + * + * @return the encryption value. + */ + public VaultPropertiesEncryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Customer Managed Key details of the resource. + * + * @param encryption the encryption value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEncryption(VaultPropertiesEncryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the moveDetails property: The details of the latest move operation performed on the Azure Resource. + * + * @return the moveDetails value. + */ + public VaultPropertiesMoveDetails moveDetails() { + return this.moveDetails; + } + + /** + * Set the moveDetails property: The details of the latest move operation performed on the Azure Resource. + * + * @param moveDetails the moveDetails value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withMoveDetails(VaultPropertiesMoveDetails moveDetails) { + this.moveDetails = moveDetails; + return this; + } + + /** + * Get the moveState property: The State of the Resource after the move operation. + * + * @return the moveState value. + */ + public ResourceMoveState moveState() { + return this.moveState; + } + /** * Validates the instance. * @@ -113,5 +180,11 @@ public void validate() { if (privateEndpointConnections() != null) { privateEndpointConnections().forEach(e -> e.validate()); } + if (encryption() != null) { + encryption().validate(); + } + if (moveDetails() != null) { + moveDetails().validate(); + } } } diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesEncryption.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesEncryption.java new file mode 100644 index 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(); + } + } +} diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesMoveDetails.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesMoveDetails.java new file mode 100644 index 000000000000..2df3d2d22a4b --- /dev/null +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/main/java/com/azure/resourcemanager/recoveryservices/models/VaultPropertiesMoveDetails.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The details of the latest move operation performed on the Azure Resource. */ +@Immutable +public final class VaultPropertiesMoveDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultPropertiesMoveDetails.class); + + /* + * OperationId of the Resource Move Operation + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /* + * Start Time of the Resource Move Operation + */ + @JsonProperty(value = "startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTimeUtc; + + /* + * End Time of the Resource Move Operation + */ + @JsonProperty(value = "completionTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime completionTimeUtc; + + /* + * Source Resource of the Resource Move Operation + */ + @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceId; + + /* + * Target Resource of the Resource Move Operation + */ + @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceId; + + /** + * Get the operationId property: OperationId of the Resource Move Operation. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the startTimeUtc property: Start Time of the Resource Move Operation. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Get the completionTimeUtc property: End Time of the Resource Move Operation. + * + * @return the completionTimeUtc value. + */ + public OffsetDateTime completionTimeUtc() { + return this.completionTimeUtc; + } + + /** + * Get the sourceResourceId property: Source Resource of the Resource Move Operation. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the targetResourceId property: Target Resource of the Resource Move Operation. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +}