diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2846b8822f624..df47a7c974822 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -317,6 +317,7 @@ com.azure.resourcemanager:azure-resourcemanager-purview;1.0.0-beta.1;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-mysqlflexibleserver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-baremetalinfrastructure;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-quota;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 48a8c8e0b771d..63baeec3c6427 100644 --- a/pom.xml +++ b/pom.xml @@ -751,6 +751,7 @@ sdk/datalakeanalytics sdk/datalakestore sdk/datamigration + sdk/dataprotection sdk/delegatednetwork sdk/deploymentmanager sdk/deviceprovisioningservices diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md b/sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md new file mode 100644 index 0000000000000..93289193cd6c1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-09-16) + +- Azure Resource Manager DataProtection client library for Java. This package contains Microsoft Azure SDK for DataProtection Management SDK. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2021-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/README.md b/sdk/dataprotection/azure-resourcemanager-dataprotection/README.md new file mode 100644 index 0000000000000..825d2a898f4f1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager DataProtection client library for Java + +Azure Resource Manager DataProtection client library for Java. + +This package contains Microsoft Azure SDK for DataProtection Management SDK. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2021-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-dataprotection;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-dataprotection + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DataProtectionManager manager = DataProtectionManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +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 +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml b/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml new file mode 100644 index 0000000000000..8a14091ba3fa7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-dataprotection + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DataProtection Management + This package contains Microsoft Azure SDK for DataProtection Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2021-07. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.20.0 + + + com.azure + azure-core-management + 1.4.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/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/DataProtectionManager.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/DataProtectionManager.java new file mode 100644 index 0000000000000..b787d4bcdbfa6 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/DataProtectionManager.java @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.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; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionClient; +import com.azure.resourcemanager.dataprotection.implementation.BackupInstancesImpl; +import com.azure.resourcemanager.dataprotection.implementation.BackupPoliciesImpl; +import com.azure.resourcemanager.dataprotection.implementation.BackupVaultOperationResultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.BackupVaultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.DataProtectionClientBuilder; +import com.azure.resourcemanager.dataprotection.implementation.DataProtectionOperationsImpl; +import com.azure.resourcemanager.dataprotection.implementation.DataProtectionsImpl; +import com.azure.resourcemanager.dataprotection.implementation.ExportJobsImpl; +import com.azure.resourcemanager.dataprotection.implementation.ExportJobsOperationResultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.JobsImpl; +import com.azure.resourcemanager.dataprotection.implementation.OperationResultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.OperationStatusImpl; +import com.azure.resourcemanager.dataprotection.implementation.RecoveryPointsImpl; +import com.azure.resourcemanager.dataprotection.implementation.ResourceGuardsImpl; +import com.azure.resourcemanager.dataprotection.implementation.RestorableTimeRangesImpl; +import com.azure.resourcemanager.dataprotection.models.BackupInstances; +import com.azure.resourcemanager.dataprotection.models.BackupPolicies; +import com.azure.resourcemanager.dataprotection.models.BackupVaultOperationResults; +import com.azure.resourcemanager.dataprotection.models.BackupVaults; +import com.azure.resourcemanager.dataprotection.models.DataProtectionOperations; +import com.azure.resourcemanager.dataprotection.models.DataProtections; +import com.azure.resourcemanager.dataprotection.models.ExportJobs; +import com.azure.resourcemanager.dataprotection.models.ExportJobsOperationResults; +import com.azure.resourcemanager.dataprotection.models.Jobs; +import com.azure.resourcemanager.dataprotection.models.OperationResults; +import com.azure.resourcemanager.dataprotection.models.OperationStatus; +import com.azure.resourcemanager.dataprotection.models.RecoveryPoints; +import com.azure.resourcemanager.dataprotection.models.ResourceGuards; +import com.azure.resourcemanager.dataprotection.models.RestorableTimeRanges; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to DataProtectionManager. Open API 2.0 Specs for Azure Data Protection service. */ +public final class DataProtectionManager { + private BackupVaults backupVaults; + + private OperationResults operationResults; + + private OperationStatus operationStatus; + + private BackupVaultOperationResults backupVaultOperationResults; + + private DataProtections dataProtections; + + private DataProtectionOperations dataProtectionOperations; + + private BackupPolicies backupPolicies; + + private BackupInstances backupInstances; + + private RecoveryPoints recoveryPoints; + + private Jobs jobs; + + private RestorableTimeRanges restorableTimeRanges; + + private ExportJobs exportJobs; + + private ExportJobsOperationResults exportJobsOperationResults; + + private ResourceGuards resourceGuards; + + private final DataProtectionClient clientObject; + + private DataProtectionManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new DataProtectionClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of DataProtection service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DataProtection service API instance. + */ + public static DataProtectionManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create DataProtectionManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DataProtectionManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of DataProtection service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DataProtection service API instance. + */ + public DataProtectionManager authenticate(TokenCredential credential, AzureProfile profile) { + 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.dataprotection") + .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(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DataProtectionManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of BackupVaults. */ + public BackupVaults backupVaults() { + if (this.backupVaults == null) { + this.backupVaults = new BackupVaultsImpl(clientObject.getBackupVaults(), this); + } + return backupVaults; + } + + /** @return Resource collection API of OperationResults. */ + public OperationResults operationResults() { + if (this.operationResults == null) { + this.operationResults = new OperationResultsImpl(clientObject.getOperationResults(), this); + } + return operationResults; + } + + /** @return Resource collection API of OperationStatus. */ + public OperationStatus operationStatus() { + if (this.operationStatus == null) { + this.operationStatus = new OperationStatusImpl(clientObject.getOperationStatus(), this); + } + return operationStatus; + } + + /** @return Resource collection API of BackupVaultOperationResults. */ + public BackupVaultOperationResults backupVaultOperationResults() { + if (this.backupVaultOperationResults == null) { + this.backupVaultOperationResults = + new BackupVaultOperationResultsImpl(clientObject.getBackupVaultOperationResults(), this); + } + return backupVaultOperationResults; + } + + /** @return Resource collection API of DataProtections. */ + public DataProtections dataProtections() { + if (this.dataProtections == null) { + this.dataProtections = new DataProtectionsImpl(clientObject.getDataProtections(), this); + } + return dataProtections; + } + + /** @return Resource collection API of DataProtectionOperations. */ + public DataProtectionOperations dataProtectionOperations() { + if (this.dataProtectionOperations == null) { + this.dataProtectionOperations = + new DataProtectionOperationsImpl(clientObject.getDataProtectionOperations(), this); + } + return dataProtectionOperations; + } + + /** @return Resource collection API of BackupPolicies. */ + public BackupPolicies backupPolicies() { + if (this.backupPolicies == null) { + this.backupPolicies = new BackupPoliciesImpl(clientObject.getBackupPolicies(), this); + } + return backupPolicies; + } + + /** @return Resource collection API of BackupInstances. */ + public BackupInstances backupInstances() { + if (this.backupInstances == null) { + this.backupInstances = new BackupInstancesImpl(clientObject.getBackupInstances(), this); + } + return backupInstances; + } + + /** @return Resource collection API of RecoveryPoints. */ + public RecoveryPoints recoveryPoints() { + if (this.recoveryPoints == null) { + this.recoveryPoints = new RecoveryPointsImpl(clientObject.getRecoveryPoints(), this); + } + return recoveryPoints; + } + + /** @return Resource collection API of Jobs. */ + public Jobs jobs() { + if (this.jobs == null) { + this.jobs = new JobsImpl(clientObject.getJobs(), this); + } + return jobs; + } + + /** @return Resource collection API of RestorableTimeRanges. */ + public RestorableTimeRanges restorableTimeRanges() { + if (this.restorableTimeRanges == null) { + this.restorableTimeRanges = new RestorableTimeRangesImpl(clientObject.getRestorableTimeRanges(), this); + } + return restorableTimeRanges; + } + + /** @return Resource collection API of ExportJobs. */ + public ExportJobs exportJobs() { + if (this.exportJobs == null) { + this.exportJobs = new ExportJobsImpl(clientObject.getExportJobs(), this); + } + return exportJobs; + } + + /** @return Resource collection API of ExportJobsOperationResults. */ + public ExportJobsOperationResults exportJobsOperationResults() { + if (this.exportJobsOperationResults == null) { + this.exportJobsOperationResults = + new ExportJobsOperationResultsImpl(clientObject.getExportJobsOperationResults(), this); + } + return exportJobsOperationResults; + } + + /** @return Resource collection API of ResourceGuards. */ + public ResourceGuards resourceGuards() { + if (this.resourceGuards == null) { + this.resourceGuards = new ResourceGuardsImpl(clientObject.getResourceGuards(), this); + } + return resourceGuards; + } + + /** + * @return Wrapped service client DataProtectionClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public DataProtectionClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupInstancesClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupInstancesClient.java new file mode 100644 index 0000000000000..5790506aecd8b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupInstancesClient.java @@ -0,0 +1,574 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRehydrationRequest; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRestoreRequest; +import com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateForBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateRestoreRequestObject; + +/** An instance of this class provides access to all the operations defined in BackupInstancesClient. */ +public interface BackupInstancesClient { + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String vaultName, String resourceGroupName); + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String vaultName, String resourceGroupName, Context context); + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInstanceResourceInner get(String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String vaultName, String resourceGroupName, String backupInstanceName, Context context); + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupInstanceResourceInner> beginCreateOrUpdate( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters); + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupInstanceResourceInner> beginCreateOrUpdate( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context); + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInstanceResourceInner createOrUpdate( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters); + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInstanceResourceInner createOrUpdate( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context); + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String vaultName, String resourceGroupName, String backupInstanceName, Context context); + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String vaultName, String resourceGroupName, String backupInstanceName, Context context); + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginAdhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters); + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginAdhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context); + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner adhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters); + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner adhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context); + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginValidateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters); + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginValidateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context); + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters); + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTriggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTriggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context); + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginTriggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters); + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginTriggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context); + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner triggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters); + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner triggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginValidateForRestore( + String vaultName, String resourceGroupName, String backupInstanceName, ValidateRestoreRequestObject parameters); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, OperationJobExtendedInfoInner> beginValidateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner validateForRestore( + String vaultName, String resourceGroupName, String backupInstanceName, ValidateRestoreRequestObject parameters); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationJobExtendedInfoInner validateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupPoliciesClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupPoliciesClient.java new file mode 100644 index 0000000000000..7fa97536f7483 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupPoliciesClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; + +/** An instance of this class provides access to all the operations defined in BackupPoliciesClient. */ +public interface BackupPoliciesClient { + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String vaultName, String resourceGroupName); + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String vaultName, String resourceGroupName, Context context); + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BaseBackupPolicyResourceInner get(String vaultName, String resourceGroupName, String backupPolicyName); + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context); + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for 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 baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BaseBackupPolicyResourceInner createOrUpdate( + String vaultName, String resourceGroupName, String backupPolicyName, BaseBackupPolicyResourceInner parameters); + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String vaultName, + String resourceGroupName, + String backupPolicyName, + BaseBackupPolicyResourceInner parameters, + Context context); + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String vaultName, String resourceGroupName, String backupPolicyName); + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultOperationResultsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultOperationResultsClient.java new file mode 100644 index 0000000000000..91336b28091d7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultOperationResultsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultOperationResultsGetResponse; + +/** An instance of this class provides access to all the operations defined in BackupVaultOperationResultsClient. */ +public interface BackupVaultOperationResultsClient { + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner get(String vaultName, String resourceGroupName, String operationId); + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultOperationResultsGetResponse getWithResponse( + String vaultName, String resourceGroupName, String operationId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultsClient.java new file mode 100644 index 0000000000000..05d8d6d706a09 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultsClient.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.dataprotection.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; + +/** An instance of this class provides access to all the operations defined in BackupVaultsClient. */ +public interface BackupVaultsClient { + /** + * Returns resource collection belonging to a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns resource collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner getByResourceGroup(String resourceGroupName, String vaultName); + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String vaultName, Context context); + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginCreateOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters); + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginCreateOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context); + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner createOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters); + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner createOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context); + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String vaultName); + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginUpdate( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters); + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginUpdate( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context); + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner update(String vaultName, String resourceGroupName, PatchResourceRequestInput parameters); + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner update( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context); + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters); + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionClient.java new file mode 100644 index 0000000000000..c6d7d43aad929 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for DataProtectionClient class. */ +public interface DataProtectionClient { + /** + * Gets The subscription Id. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the BackupVaultsClient object to access its operations. + * + * @return the BackupVaultsClient object. + */ + BackupVaultsClient getBackupVaults(); + + /** + * Gets the OperationResultsClient object to access its operations. + * + * @return the OperationResultsClient object. + */ + OperationResultsClient getOperationResults(); + + /** + * Gets the OperationStatusClient object to access its operations. + * + * @return the OperationStatusClient object. + */ + OperationStatusClient getOperationStatus(); + + /** + * Gets the BackupVaultOperationResultsClient object to access its operations. + * + * @return the BackupVaultOperationResultsClient object. + */ + BackupVaultOperationResultsClient getBackupVaultOperationResults(); + + /** + * Gets the DataProtectionsClient object to access its operations. + * + * @return the DataProtectionsClient object. + */ + DataProtectionsClient getDataProtections(); + + /** + * Gets the DataProtectionOperationsClient object to access its operations. + * + * @return the DataProtectionOperationsClient object. + */ + DataProtectionOperationsClient getDataProtectionOperations(); + + /** + * Gets the BackupPoliciesClient object to access its operations. + * + * @return the BackupPoliciesClient object. + */ + BackupPoliciesClient getBackupPolicies(); + + /** + * Gets the BackupInstancesClient object to access its operations. + * + * @return the BackupInstancesClient object. + */ + BackupInstancesClient getBackupInstances(); + + /** + * Gets the RecoveryPointsClient object to access its operations. + * + * @return the RecoveryPointsClient object. + */ + RecoveryPointsClient getRecoveryPoints(); + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + JobsClient getJobs(); + + /** + * Gets the RestorableTimeRangesClient object to access its operations. + * + * @return the RestorableTimeRangesClient object. + */ + RestorableTimeRangesClient getRestorableTimeRanges(); + + /** + * Gets the ExportJobsClient object to access its operations. + * + * @return the ExportJobsClient object. + */ + ExportJobsClient getExportJobs(); + + /** + * Gets the ExportJobsOperationResultsClient object to access its operations. + * + * @return the ExportJobsOperationResultsClient object. + */ + ExportJobsOperationResultsClient getExportJobsOperationResults(); + + /** + * Gets the ResourceGuardsClient object to access its operations. + * + * @return the ResourceGuardsClient object. + */ + ResourceGuardsClient getResourceGuards(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionOperationsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionOperationsClient.java new file mode 100644 index 0000000000000..63f06497a8bd9 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionOperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; + +/** An instance of this class provides access to all the operations defined in DataProtectionOperationsClient. */ +public interface DataProtectionOperationsClient { + /** + * Returns the list of available operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns the list of available operations. + * + * @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 clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionsClient.java new file mode 100644 index 0000000000000..e9c2cca27835e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationRequestBase; + +/** An instance of this class provides access to all the operations defined in DataProtectionsClient. */ +public interface DataProtectionsClient { + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FeatureValidationResponseBaseInner checkFeatureSupport(String location, FeatureValidationRequestBase parameters); + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @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 base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkFeatureSupportWithResponse( + String location, FeatureValidationRequestBase parameters, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ExportJobsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ExportJobsClient.java new file mode 100644 index 0000000000000..d807fc789928c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ExportJobsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** An instance of this class provides access to all the operations defined in ExportJobsClient. */ +public interface ExportJobsClient { + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTrigger(String resourceGroupName, String vaultName); + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTrigger(String resourceGroupName, String vaultName, Context context); + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void trigger(String resourceGroupName, String vaultName); + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void trigger(String resourceGroupName, String vaultName, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ExportJobsOperationResultsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ExportJobsOperationResultsClient.java new file mode 100644 index 0000000000000..71636c714b0ee --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ExportJobsOperationResultsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.models.ExportJobsResultInner; + +/** An instance of this class provides access to all the operations defined in ExportJobsOperationResultsClient. */ +public interface ExportJobsOperationResultsClient { + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExportJobsResultInner get(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobsClient.java new file mode 100644 index 0000000000000..d417b058c2220 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobsClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public interface JobsClient { + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String vaultName); + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String vaultName, Context context); + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureBackupJobResourceInner get(String resourceGroupName, String vaultName, String jobId); + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String vaultName, String jobId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationResultsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationResultsClient.java new file mode 100644 index 0000000000000..2660819b302d0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationResultsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.OperationResultsGetResponse; + +/** An instance of this class provides access to all the operations defined in OperationResultsClient. */ +public interface OperationResultsClient { + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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) + OperationJobExtendedInfoInner get(String operationId, String location); + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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) + OperationResultsGetResponse getWithResponse(String operationId, String location, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationStatusClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationStatusClient.java new file mode 100644 index 0000000000000..d5259472bc836 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationStatusClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.models.OperationResourceInner; + +/** An instance of this class provides access to all the operations defined in OperationStatusClient. */ +public interface OperationStatusClient { + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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 get(String location, String operationId); + + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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 getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointsClient.java new file mode 100644 index 0000000000000..f710f45135a65 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointsClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; + +/** An instance of this class provides access to all the operations defined in RecoveryPointsClient. */ +public interface RecoveryPointsClient { + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @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 azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String filter, + String skipToken, + Context context); + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureBackupRecoveryPointResourceInner get( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId); + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ResourceGuardsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ResourceGuardsClient.java new file mode 100644 index 0000000000000..cdb7b453d286b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ResourceGuardsClient.java @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; + +/** An instance of this class provides access to all the operations defined in ResourceGuardsClient. */ +public interface ResourceGuardsClient { + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGuardResourceInner put( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters); + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters, Context context); + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGuardResourceInner getByResourceGroup(String resourceGroupName, String resourceGuardsName); + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceGuardsName); + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGuardResourceInner patch( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters); + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response patchWithResponse( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DppBaseResourceInner getDefaultDisableSoftDeleteRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultDisableSoftDeleteRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DppBaseResourceInner getDefaultDeleteResourceGuardProxyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultDeleteResourceGuardProxyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DppBaseResourceInner getDefaultBackupSecurityPinRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultBackupSecurityPinRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DppBaseResourceInner getDefaultDeleteProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultDeleteProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DppBaseResourceInner getDefaultUpdateProtectionPolicyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultUpdateProtectionPolicyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DppBaseResourceInner getDefaultUpdateProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultUpdateProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RestorableTimeRangesClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RestorableTimeRangesClient.java new file mode 100644 index 0000000000000..740f4e4798608 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RestorableTimeRangesClient.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.models.AzureBackupFindRestorableTimeRangesResponseResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest; + +/** An instance of this class provides access to all the operations defined in RestorableTimeRangesClient. */ +public interface RestorableTimeRangesClient { + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureBackupFindRestorableTimeRangesResponseResourceInner find( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters); + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response findWithResponse( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters, + Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupFindRestorableTimeRangesResponseResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupFindRestorableTimeRangesResponseResourceInner.java new file mode 100644 index 0000000000000..4b674770ec448 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupFindRestorableTimeRangesResponseResourceInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List Restore Ranges Response. */ +@Fluent +public final class AzureBackupFindRestorableTimeRangesResponseResourceInner extends DppResource { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(AzureBackupFindRestorableTimeRangesResponseResourceInner.class); + + /* + * AzureBackupFindRestorableTimeRangesResponseResource properties + */ + @JsonProperty(value = "properties") + private AzureBackupFindRestorableTimeRangesResponse properties; + + /** + * Get the properties property: AzureBackupFindRestorableTimeRangesResponseResource properties. + * + * @return the properties value. + */ + public AzureBackupFindRestorableTimeRangesResponse properties() { + return this.properties; + } + + /** + * Set the properties property: AzureBackupFindRestorableTimeRangesResponseResource properties. + * + * @param properties the properties value to set. + * @return the AzureBackupFindRestorableTimeRangesResponseResourceInner object itself. + */ + public AzureBackupFindRestorableTimeRangesResponseResourceInner withProperties( + AzureBackupFindRestorableTimeRangesResponse properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupJobResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupJobResourceInner.java new file mode 100644 index 0000000000000..f3fc551c95117 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupJobResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJob; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** AzureBackup Job Resource Class. */ +@Fluent +public final class AzureBackupJobResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupJobResourceInner.class); + + /* + * AzureBackupJobResource properties + */ + @JsonProperty(value = "properties") + private AzureBackupJob properties; + + /** + * Get the properties property: AzureBackupJobResource properties. + * + * @return the properties value. + */ + public AzureBackupJob properties() { + return this.properties; + } + + /** + * Set the properties property: AzureBackupJobResource properties. + * + * @param properties the properties value to set. + * @return the AzureBackupJobResourceInner object itself. + */ + public AzureBackupJobResourceInner withProperties(AzureBackupJob properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupRecoveryPointResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupRecoveryPointResourceInner.java new file mode 100644 index 0000000000000..199b96c518489 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupRecoveryPointResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPoint; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** AzureBackupRecoveryPointResource Azure backup recoveryPoint resource. */ +@Fluent +public final class AzureBackupRecoveryPointResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRecoveryPointResourceInner.class); + + /* + * AzureBackupRecoveryPoint AzureBackupRecoveryPointResource properties + */ + @JsonProperty(value = "properties") + private AzureBackupRecoveryPoint properties; + + /** + * Get the properties property: AzureBackupRecoveryPoint AzureBackupRecoveryPointResource properties. + * + * @return the properties value. + */ + public AzureBackupRecoveryPoint properties() { + return this.properties; + } + + /** + * Set the properties property: AzureBackupRecoveryPoint AzureBackupRecoveryPointResource properties. + * + * @param properties the properties value to set. + * @return the AzureBackupRecoveryPointResourceInner object itself. + */ + public AzureBackupRecoveryPointResourceInner withProperties(AzureBackupRecoveryPoint properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupInstanceResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupInstanceResourceInner.java new file mode 100644 index 0000000000000..7e01834d05bee --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupInstanceResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.BackupInstance; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** BackupInstanceResource BackupInstance Resource. */ +@Fluent +public final class BackupInstanceResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstanceResourceInner.class); + + /* + * BackupInstanceResource properties + */ + @JsonProperty(value = "properties") + private BackupInstance properties; + + /** + * Get the properties property: BackupInstanceResource properties. + * + * @return the properties value. + */ + public BackupInstance properties() { + return this.properties; + } + + /** + * Set the properties property: BackupInstanceResource properties. + * + * @param properties the properties value to set. + * @return the BackupInstanceResourceInner object itself. + */ + public BackupInstanceResourceInner withProperties(BackupInstance properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupVaultResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupVaultResourceInner.java new file mode 100644 index 0000000000000..05b9ee22e8575 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupVaultResourceInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.BackupVault; +import com.azure.resourcemanager.dataprotection.models.DppIdentityDetails; +import com.azure.resourcemanager.dataprotection.models.DppTrackedResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** BackupVault Resource Backup Vault Resource. */ +@Fluent +public final class BackupVaultResourceInner extends DppTrackedResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVaultResourceInner.class); + + /* + * BackupVault BackupVaultResource properties + */ + @JsonProperty(value = "properties", required = true) + private BackupVault properties; + + /** + * Get the properties property: BackupVault BackupVaultResource properties. + * + * @return the properties value. + */ + public BackupVault properties() { + return this.properties; + } + + /** + * Set the properties property: BackupVault BackupVaultResource properties. + * + * @param properties the properties value to set. + * @return the BackupVaultResourceInner object itself. + */ + public BackupVaultResourceInner withProperties(BackupVault properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupVaultResourceInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupVaultResourceInner withIdentity(DppIdentityDetails identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupVaultResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupVaultResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model BackupVaultResourceInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BaseBackupPolicyResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BaseBackupPolicyResourceInner.java new file mode 100644 index 0000000000000..f714b63e63632 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BaseBackupPolicyResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.BaseBackupPolicy; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** BaseBackupPolicyResource BaseBackupPolicy resource. */ +@Fluent +public final class BaseBackupPolicyResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BaseBackupPolicyResourceInner.class); + + /* + * BaseBackupPolicy BaseBackupPolicyResource properties + */ + @JsonProperty(value = "properties") + private BaseBackupPolicy properties; + + /** + * Get the properties property: BaseBackupPolicy BaseBackupPolicyResource properties. + * + * @return the properties value. + */ + public BaseBackupPolicy properties() { + return this.properties; + } + + /** + * Set the properties property: BaseBackupPolicy BaseBackupPolicyResource properties. + * + * @param properties the properties value to set. + * @return the BaseBackupPolicyResourceInner object itself. + */ + public BaseBackupPolicyResourceInner withProperties(BaseBackupPolicy properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..4f702656ff023 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** CheckNameAvailabilityResult CheckNameAvailability Result. */ +@Fluent +public final class CheckNameAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class); + + /* + * Gets or sets the message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Gets or sets a value indicating whether [name available]. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Gets or sets the reason. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the message property: Gets or sets the message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Gets or sets the message. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the nameAvailable property: Gets or sets a value indicating whether [name available]. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Gets or sets a value indicating whether [name available]. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Gets or sets the reason. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Gets or sets the reason. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ClientDiscoveryValueForSingleApiInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ClientDiscoveryValueForSingleApiInner.java new file mode 100644 index 0000000000000..4a7f24e3601b0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ClientDiscoveryValueForSingleApiInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryDisplay; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryForProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ClientDiscoveryValueForSingleApi Available operation details. */ +@Fluent +public final class ClientDiscoveryValueForSingleApiInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryValueForSingleApiInner.class); + + /* + * ClientDiscoveryDisplay Contains the localized display information for + * this particular operation + */ + @JsonProperty(value = "display") + private ClientDiscoveryDisplay display; + + /* + * Name of the Operation. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * The intended executor of the operation;governs the display of the + * operation in the RBAC UX and the audit logs UX + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * ClientDiscoveryForProperties Properties for the given operation. + */ + @JsonProperty(value = "properties") + private ClientDiscoveryForProperties properties; + + /** + * Get the display property: ClientDiscoveryDisplay Contains the localized display information for this particular + * operation. + * + * @return the display value. + */ + public ClientDiscoveryDisplay display() { + return this.display; + } + + /** + * Set the display property: ClientDiscoveryDisplay Contains the localized display information for this particular + * operation. + * + * @param display the display value to set. + * @return the ClientDiscoveryValueForSingleApiInner object itself. + */ + public ClientDiscoveryValueForSingleApiInner withDisplay(ClientDiscoveryDisplay display) { + this.display = display; + return this; + } + + /** + * Get the name property: Name of the Operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Operation. + * + * @param name the name value to set. + * @return the ClientDiscoveryValueForSingleApiInner object itself. + */ + public ClientDiscoveryValueForSingleApiInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the ClientDiscoveryValueForSingleApiInner object itself. + */ + public ClientDiscoveryValueForSingleApiInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the origin property: The intended executor of the operation;governs the display of the operation in the RBAC + * UX and the audit logs UX. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The intended executor of the operation;governs the display of the operation in the RBAC + * UX and the audit logs UX. + * + * @param origin the origin value to set. + * @return the ClientDiscoveryValueForSingleApiInner object itself. + */ + public ClientDiscoveryValueForSingleApiInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: ClientDiscoveryForProperties Properties for the given operation. + * + * @return the properties value. + */ + public ClientDiscoveryForProperties properties() { + return this.properties; + } + + /** + * Set the properties property: ClientDiscoveryForProperties Properties for the given operation. + * + * @param properties the properties value to set. + * @return the ClientDiscoveryValueForSingleApiInner object itself. + */ + public ClientDiscoveryValueForSingleApiInner withProperties(ClientDiscoveryForProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/DppBaseResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/DppBaseResourceInner.java new file mode 100644 index 0000000000000..60bfac685e8bc --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/DppBaseResourceInner.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Base resource under Microsoft.DataProtection provider namespace. */ +@Immutable +public final class DppBaseResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppBaseResourceInner.class); + + /* + * Resource Id represents the complete path to the resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name associated with the resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type represents the complete path of the form + * Namespace/ResourceType/ResourceType/... + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the id property: Resource Id represents the complete path to the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Resource name associated with the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Resource type represents the complete path of the form + * Namespace/ResourceType/ResourceType/... + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ExportJobsResultInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ExportJobsResultInner.java new file mode 100644 index 0000000000000..fcd4ef9d68a7d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ExportJobsResultInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ExportJobsResult The result for export jobs containing blob details. */ +@Immutable +public final class ExportJobsResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportJobsResultInner.class); + + /* + * URL of the blob into which the serialized string of list of jobs is + * exported. + */ + @JsonProperty(value = "blobUrl", access = JsonProperty.Access.WRITE_ONLY) + private String blobUrl; + + /* + * SAS key to access the blob. + */ + @JsonProperty(value = "blobSasKey", access = JsonProperty.Access.WRITE_ONLY) + private String blobSasKey; + + /* + * URL of the blob into which the ExcelFile is uploaded. + */ + @JsonProperty(value = "excelFileBlobUrl", access = JsonProperty.Access.WRITE_ONLY) + private String excelFileBlobUrl; + + /* + * SAS key to access the ExcelFile blob. + */ + @JsonProperty(value = "excelFileBlobSasKey", access = JsonProperty.Access.WRITE_ONLY) + private String excelFileBlobSasKey; + + /** + * Get the blobUrl property: URL of the blob into which the serialized string of list of jobs is exported. + * + * @return the blobUrl value. + */ + public String blobUrl() { + return this.blobUrl; + } + + /** + * Get the blobSasKey property: SAS key to access the blob. + * + * @return the blobSasKey value. + */ + public String blobSasKey() { + return this.blobSasKey; + } + + /** + * Get the excelFileBlobUrl property: URL of the blob into which the ExcelFile is uploaded. + * + * @return the excelFileBlobUrl value. + */ + public String excelFileBlobUrl() { + return this.excelFileBlobUrl; + } + + /** + * Get the excelFileBlobSasKey property: SAS key to access the ExcelFile blob. + * + * @return the excelFileBlobSasKey value. + */ + public String excelFileBlobSasKey() { + return this.excelFileBlobSasKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/FeatureValidationResponseBaseInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/FeatureValidationResponseBaseInner.java new file mode 100644 index 0000000000000..0e9a3db10739d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/FeatureValidationResponseBaseInner.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.dataprotection.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Base class for Backup Feature support. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = FeatureValidationResponseBaseInner.class) +@JsonTypeName("FeatureValidationResponseBase") +@JsonSubTypes({@JsonSubTypes.Type(name = "FeatureValidationResponse", value = FeatureValidationResponse.class)}) +@Immutable +public class FeatureValidationResponseBaseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FeatureValidationResponseBaseInner.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationJobExtendedInfoInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationJobExtendedInfoInner.java new file mode 100644 index 0000000000000..df6a5423476cb --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationJobExtendedInfoInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.OperationExtendedInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** OperationJobExtendedInfo Operation Job Extended Info. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("OperationJobExtendedInfo") +@Fluent +public final class OperationJobExtendedInfoInner extends OperationExtendedInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationJobExtendedInfoInner.class); + + /* + * Arm Id of the job created for this operation. + */ + @JsonProperty(value = "jobId") + private String jobId; + + /** + * Get the jobId property: Arm Id of the job created for this operation. + * + * @return the jobId value. + */ + public String jobId() { + return this.jobId; + } + + /** + * Set the jobId property: Arm Id of the job created for this operation. + * + * @param jobId the jobId value to set. + * @return the OperationJobExtendedInfoInner object itself. + */ + public OperationJobExtendedInfoInner withJobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationResourceInner.java new file mode 100644 index 0000000000000..b7b4a59eae795 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationResourceInner.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.OperationExtendedInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** OperationResource 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. + * The full set of optional properties (e.g. inner errors / details) can be + * found in the "Error Response" section. + */ + @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; + + /* + * OperationExtendedInfo End time of the operation + */ + @JsonProperty(value = "properties") + private OperationExtendedInfo properties; + + /* + * Start time of the operation + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The status property. + */ + @JsonProperty(value = "status") + private String status; + + /** + * 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. The full set of optional properties (e.g. + * inner errors / details) can be found in the "Error Response" section. + * + * @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. The full set of optional properties (e.g. + * inner errors / details) can be found in the "Error Response" section. + * + * @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 properties property: OperationExtendedInfo End time of the operation. + * + * @return the properties value. + */ + public OperationExtendedInfo properties() { + return this.properties; + } + + /** + * Set the properties property: OperationExtendedInfo End time of the operation. + * + * @param properties the properties value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withProperties(OperationExtendedInfo properties) { + this.properties = properties; + 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; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status property. + * + * @param status the status value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ResourceGuardResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ResourceGuardResourceInner.java new file mode 100644 index 0000000000000..a5c68fc13b2e4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/ResourceGuardResourceInner.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.DppIdentityDetails; +import com.azure.resourcemanager.dataprotection.models.DppTrackedResource; +import com.azure.resourcemanager.dataprotection.models.ResourceGuard; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The ResourceGuardResource model. */ +@Fluent +public final class ResourceGuardResourceInner extends DppTrackedResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGuardResourceInner.class); + + /* + * ResourceGuardResource properties + */ + @JsonProperty(value = "properties") + private ResourceGuard properties; + + /** + * Get the properties property: ResourceGuardResource properties. + * + * @return the properties value. + */ + public ResourceGuard properties() { + return this.properties; + } + + /** + * Set the properties property: ResourceGuardResource properties. + * + * @param properties the properties value to set. + * @return the ResourceGuardResourceInner object itself. + */ + public ResourceGuardResourceInner withProperties(ResourceGuard properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGuardResourceInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGuardResourceInner withIdentity(DppIdentityDetails identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGuardResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGuardResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/package-info.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/package-info.java new file mode 100644 index 0000000000000..a6a6163c48750 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for DataProtectionClient. Open API 2.0 Specs for Azure Data Protection + * service. + */ +package com.azure.resourcemanager.dataprotection.fluent.models; diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/package-info.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/package-info.java new file mode 100644 index 0000000000000..8494f21366f83 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for DataProtectionClient. Open API 2.0 Specs for Azure Data Protection + * service. + */ +package com.azure.resourcemanager.dataprotection.fluent; diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupFindRestorableTimeRangesResponseResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupFindRestorableTimeRangesResponseResourceImpl.java new file mode 100644 index 0000000000000..81e6a18226676 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupFindRestorableTimeRangesResponseResourceImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupFindRestorableTimeRangesResponseResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource; + +public final class AzureBackupFindRestorableTimeRangesResponseResourceImpl + implements AzureBackupFindRestorableTimeRangesResponseResource { + private AzureBackupFindRestorableTimeRangesResponseResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + AzureBackupFindRestorableTimeRangesResponseResourceImpl( + AzureBackupFindRestorableTimeRangesResponseResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AzureBackupFindRestorableTimeRangesResponse properties() { + return this.innerModel().properties(); + } + + public AzureBackupFindRestorableTimeRangesResponseResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupJobResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupJobResourceImpl.java new file mode 100644 index 0000000000000..6ea2cf32c8c11 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupJobResourceImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJob; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJobResource; + +public final class AzureBackupJobResourceImpl implements AzureBackupJobResource { + private AzureBackupJobResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + AzureBackupJobResourceImpl( + AzureBackupJobResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AzureBackupJob properties() { + return this.innerModel().properties(); + } + + public AzureBackupJobResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupRecoveryPointResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupRecoveryPointResourceImpl.java new file mode 100644 index 0000000000000..c6ec252b37dff --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupRecoveryPointResourceImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPoint; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPointResource; + +public final class AzureBackupRecoveryPointResourceImpl implements AzureBackupRecoveryPointResource { + private AzureBackupRecoveryPointResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + AzureBackupRecoveryPointResourceImpl( + AzureBackupRecoveryPointResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AzureBackupRecoveryPoint properties() { + return this.innerModel().properties(); + } + + public AzureBackupRecoveryPointResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstanceResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstanceResourceImpl.java new file mode 100644 index 0000000000000..949cf0caed1bf --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstanceResourceImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRehydrationRequest; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRestoreRequest; +import com.azure.resourcemanager.dataprotection.models.BackupInstance; +import com.azure.resourcemanager.dataprotection.models.BackupInstanceResource; +import com.azure.resourcemanager.dataprotection.models.OperationJobExtendedInfo; +import com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateRestoreRequestObject; + +public final class BackupInstanceResourceImpl + implements BackupInstanceResource, BackupInstanceResource.Definition, BackupInstanceResource.Update { + private BackupInstanceResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BackupInstance properties() { + return this.innerModel().properties(); + } + + public BackupInstanceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + private String vaultName; + + private String resourceGroupName; + + private String backupInstanceName; + + public BackupInstanceResourceImpl withExistingBackupVault(String vaultName, String resourceGroupName) { + this.vaultName = vaultName; + this.resourceGroupName = resourceGroupName; + return this; + } + + public BackupInstanceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .createOrUpdate(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public BackupInstanceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .createOrUpdate(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), context); + return this; + } + + BackupInstanceResourceImpl( + String name, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = new BackupInstanceResourceInner(); + this.serviceManager = serviceManager; + this.backupInstanceName = name; + } + + public BackupInstanceResourceImpl update() { + return this; + } + + public BackupInstanceResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .createOrUpdate(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public BackupInstanceResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .createOrUpdate(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), context); + return this; + } + + BackupInstanceResourceImpl( + BackupInstanceResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.vaultName = Utils.getValueFromIdByName(innerObject.id(), "backupVaults"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.backupInstanceName = Utils.getValueFromIdByName(innerObject.id(), "backupInstances"); + } + + public BackupInstanceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .getWithResponse(vaultName, resourceGroupName, backupInstanceName, Context.NONE) + .getValue(); + return this; + } + + public BackupInstanceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .getWithResponse(vaultName, resourceGroupName, backupInstanceName, context) + .getValue(); + return this; + } + + public OperationJobExtendedInfo adhocBackup(TriggerBackupRequest parameters) { + return serviceManager + .backupInstances() + .adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public OperationJobExtendedInfo adhocBackup(TriggerBackupRequest parameters, Context context) { + return serviceManager + .backupInstances() + .adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public void triggerRehydrate(AzureBackupRehydrationRequest parameters) { + serviceManager.backupInstances().triggerRehydrate(resourceGroupName, vaultName, backupInstanceName, parameters); + } + + public void triggerRehydrate(AzureBackupRehydrationRequest parameters, Context context) { + serviceManager + .backupInstances() + .triggerRehydrate(resourceGroupName, vaultName, backupInstanceName, parameters, context); + } + + public OperationJobExtendedInfo triggerRestore(AzureBackupRestoreRequest parameters) { + return serviceManager + .backupInstances() + .triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public OperationJobExtendedInfo triggerRestore(AzureBackupRestoreRequest parameters, Context context) { + return serviceManager + .backupInstances() + .triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public OperationJobExtendedInfo validateForRestore(ValidateRestoreRequestObject parameters) { + return serviceManager + .backupInstances() + .validateForRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public OperationJobExtendedInfo validateForRestore(ValidateRestoreRequestObject parameters, Context context) { + return serviceManager + .backupInstances() + .validateForRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public BackupInstanceResourceImpl withProperties(BackupInstance properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesClientImpl.java new file mode 100644 index 0000000000000..cd8b759aba49e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesClientImpl.java @@ -0,0 +1,2762 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dataprotection.fluent.BackupInstancesClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRehydrationRequest; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRestoreRequest; +import com.azure.resourcemanager.dataprotection.models.BackupInstanceResourceList; +import com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateForBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateRestoreRequestObject; +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 BackupInstancesClient. */ +public final class BackupInstancesClientImpl implements BackupInstancesClient { + private final ClientLogger logger = new ClientLogger(BackupInstancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BackupInstancesService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of BackupInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupInstancesClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(BackupInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientBackupInstances to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface BackupInstancesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @BodyParam("application/json") BackupInstanceResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> adhocBackup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @BodyParam("application/json") TriggerBackupRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/validateForBackup") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateForBackup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ValidateForBackupRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> triggerRehydrate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("vaultName") String vaultName, + @PathParam("backupInstanceName") String backupInstanceName, + @BodyParam("application/json") AzureBackupRehydrationRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> triggerRestore( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @BodyParam("application/json") AzureBackupRestoreRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateForRestore( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @BodyParam("application/json") ValidateRestoreRequestObject parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String vaultName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String vaultName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String vaultName, String resourceGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String vaultName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String vaultName, String resourceGroupName) { + return new PagedIterable<>(listAsync(vaultName, resourceGroupName)); + } + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String vaultName, String resourceGroupName, Context context) { + return new PagedIterable<>(listAsync(vaultName, resourceGroupName, context)); + } + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + accept, + context); + } + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String vaultName, String resourceGroupName, String backupInstanceName) { + return getWithResponseAsync(vaultName, resourceGroupName, backupInstanceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInstanceResourceInner get(String vaultName, String resourceGroupName, String backupInstanceName) { + return getAsync(vaultName, resourceGroupName, backupInstanceName).block(); + } + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + return getWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, context).block(); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupInstanceResourceInner> beginCreateOrUpdateAsync( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInstanceResourceInner.class, + BackupInstanceResourceInner.class, + Context.NONE); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupInstanceResourceInner> beginCreateOrUpdateAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInstanceResourceInner.class, + BackupInstanceResourceInner.class, + context); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupInstanceResourceInner> beginCreateOrUpdate( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters).getSyncPoller(); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupInstanceResourceInner> beginCreateOrUpdate( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .getSyncPoller(); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInstanceResourceInner createOrUpdate( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + return createOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block(); + } + + /** + * Create or update a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstanceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInstanceResourceInner createOrUpdate( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + return createOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).block(); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + accept, + context); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String vaultName, String resourceGroupName, String backupInstanceName) { + Mono>> mono = + deleteWithResponseAsync(vaultName, resourceGroupName, backupInstanceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String vaultName, String resourceGroupName, String backupInstanceName) { + return beginDeleteAsync(vaultName, resourceGroupName, backupInstanceName).getSyncPoller(); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + return beginDeleteAsync(vaultName, resourceGroupName, backupInstanceName, context).getSyncPoller(); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String vaultName, String resourceGroupName, String backupInstanceName) { + return beginDeleteAsync(vaultName, resourceGroupName, backupInstanceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + return beginDeleteAsync(vaultName, resourceGroupName, backupInstanceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String vaultName, String resourceGroupName, String backupInstanceName) { + deleteAsync(vaultName, resourceGroupName, backupInstanceName).block(); + } + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + deleteAsync(vaultName, resourceGroupName, backupInstanceName, context).block(); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> adhocBackupWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .adhocBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> adhocBackupWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .adhocBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> beginAdhocBackupAsync( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + Mono>> mono = + adhocBackupWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + Context.NONE); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> beginAdhocBackupAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + adhocBackupWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + context); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginAdhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + return beginAdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters).getSyncPoller(); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginAdhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + return beginAdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .getSyncPoller(); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono adhocBackupAsync( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + return beginAdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono adhocBackupAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + return beginAdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner adhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + return adhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block(); + } + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner adhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + return adhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).block(); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateForBackupWithResponseAsync( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validateForBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateForBackupWithResponseAsync( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validateForBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> + beginValidateForBackupAsync(String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + Mono>> mono = + validateForBackupWithResponseAsync(vaultName, resourceGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + Context.NONE); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> + beginValidateForBackupAsync( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateForBackupWithResponseAsync(vaultName, resourceGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + context); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginValidateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + return beginValidateForBackupAsync(vaultName, resourceGroupName, parameters).getSyncPoller(); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginValidateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + return beginValidateForBackupAsync(vaultName, resourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateForBackupAsync( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + return beginValidateForBackupAsync(vaultName, resourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateForBackupAsync( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + return beginValidateForBackupAsync(vaultName, resourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + return validateForBackupAsync(vaultName, resourceGroupName, parameters).block(); + } + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + return validateForBackupAsync(vaultName, resourceGroupName, parameters, context).block(); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerRehydrateWithResponseAsync( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .triggerRehydrate( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + vaultName, + backupInstanceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerRehydrateWithResponseAsync( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .triggerRehydrate( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + vaultName, + backupInstanceName, + parameters, + accept, + context); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerRehydrateAsync( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters) { + Mono>> mono = + triggerRehydrateWithResponseAsync(resourceGroupName, vaultName, backupInstanceName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerRehydrateAsync( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + triggerRehydrateWithResponseAsync(resourceGroupName, vaultName, backupInstanceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTriggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters) { + return beginTriggerRehydrateAsync(resourceGroupName, vaultName, backupInstanceName, parameters).getSyncPoller(); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTriggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context) { + return beginTriggerRehydrateAsync(resourceGroupName, vaultName, backupInstanceName, parameters, context) + .getSyncPoller(); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerRehydrateAsync( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters) { + return beginTriggerRehydrateAsync(resourceGroupName, vaultName, backupInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerRehydrateAsync( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context) { + return beginTriggerRehydrateAsync(resourceGroupName, vaultName, backupInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters) { + triggerRehydrateAsync(resourceGroupName, vaultName, backupInstanceName, parameters).block(); + } + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context) { + triggerRehydrateAsync(resourceGroupName, vaultName, backupInstanceName, parameters, context).block(); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerRestoreWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .triggerRestore( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerRestoreWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .triggerRestore( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> + beginTriggerRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters) { + Mono>> mono = + triggerRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + Context.NONE); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> + beginTriggerRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + triggerRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + context); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginTriggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + return beginTriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).getSyncPoller(); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginTriggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + return beginTriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .getSyncPoller(); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerRestoreAsync( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + return beginTriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + return beginTriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner triggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + return triggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block(); + } + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner triggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + return triggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).block(); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateForRestoreWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validateForRestore( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateForRestoreWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validateForRestore( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> + beginValidateForRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + Mono>> mono = + validateForRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + Context.NONE); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, OperationJobExtendedInfoInner> + beginValidateForRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateForRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationJobExtendedInfoInner.class, + OperationJobExtendedInfoInner.class, + context); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginValidateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + return beginValidateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .getSyncPoller(); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, OperationJobExtendedInfoInner> beginValidateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + return beginValidateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .getSyncPoller(); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateForRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + return beginValidateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateForRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + return beginValidateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner validateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + return validateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block(); + } + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationJobExtendedInfoInner validateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + return validateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 backupInstanceResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 backupInstanceResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesImpl.java new file mode 100644 index 0000000000000..d4380187ee44f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesImpl.java @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.BackupInstancesClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRehydrationRequest; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRestoreRequest; +import com.azure.resourcemanager.dataprotection.models.BackupInstanceResource; +import com.azure.resourcemanager.dataprotection.models.BackupInstances; +import com.azure.resourcemanager.dataprotection.models.OperationJobExtendedInfo; +import com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateForBackupRequest; +import com.azure.resourcemanager.dataprotection.models.ValidateRestoreRequestObject; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BackupInstancesImpl implements BackupInstances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesImpl.class); + + private final BackupInstancesClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public BackupInstancesImpl( + BackupInstancesClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String vaultName, String resourceGroupName) { + PagedIterable inner = this.serviceClient().list(vaultName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new BackupInstanceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String vaultName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(vaultName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new BackupInstanceResourceImpl(inner1, this.manager())); + } + + public BackupInstanceResource get(String vaultName, String resourceGroupName, String backupInstanceName) { + BackupInstanceResourceInner inner = this.serviceClient().get(vaultName, resourceGroupName, backupInstanceName); + if (inner != null) { + return new BackupInstanceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(vaultName, resourceGroupName, backupInstanceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupInstanceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String vaultName, String resourceGroupName, String backupInstanceName) { + this.serviceClient().delete(vaultName, resourceGroupName, backupInstanceName); + } + + public void delete(String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + this.serviceClient().delete(vaultName, resourceGroupName, backupInstanceName, context); + } + + public OperationJobExtendedInfo adhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + OperationJobExtendedInfoInner inner = + this.serviceClient().adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationJobExtendedInfo adhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + OperationJobExtendedInfoInner inner = + this.serviceClient().adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters, context); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationJobExtendedInfo validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + OperationJobExtendedInfoInner inner = + this.serviceClient().validateForBackup(vaultName, resourceGroupName, parameters); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationJobExtendedInfo validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + OperationJobExtendedInfoInner inner = + this.serviceClient().validateForBackup(vaultName, resourceGroupName, parameters, context); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters) { + this.serviceClient().triggerRehydrate(resourceGroupName, vaultName, backupInstanceName, parameters); + } + + public void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context) { + this.serviceClient().triggerRehydrate(resourceGroupName, vaultName, backupInstanceName, parameters, context); + } + + public OperationJobExtendedInfo triggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + OperationJobExtendedInfoInner inner = + this.serviceClient().triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationJobExtendedInfo triggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + OperationJobExtendedInfoInner inner = + this.serviceClient().triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationJobExtendedInfo validateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + OperationJobExtendedInfoInner inner = + this.serviceClient().validateForRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationJobExtendedInfo validateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + OperationJobExtendedInfoInner inner = + this + .serviceClient() + .validateForRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInstanceResource getById(String id) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupInstanceName = Utils.getValueFromIdByName(id, "backupInstances"); + if (backupInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupInstances'.", id))); + } + return this.getWithResponse(vaultName, resourceGroupName, backupInstanceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupInstanceName = Utils.getValueFromIdByName(id, "backupInstances"); + if (backupInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupInstances'.", id))); + } + return this.getWithResponse(vaultName, resourceGroupName, backupInstanceName, context); + } + + public void deleteById(String id) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupInstanceName = Utils.getValueFromIdByName(id, "backupInstances"); + if (backupInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupInstances'.", id))); + } + this.delete(vaultName, resourceGroupName, backupInstanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupInstanceName = Utils.getValueFromIdByName(id, "backupInstances"); + if (backupInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupInstances'.", id))); + } + this.delete(vaultName, resourceGroupName, backupInstanceName, context); + } + + private BackupInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + public BackupInstanceResourceImpl define(String name) { + return new BackupInstanceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesClientImpl.java new file mode 100644 index 0000000000000..745ec656b5f53 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesClientImpl.java @@ -0,0 +1,903 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.BackupPoliciesClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; +import com.azure.resourcemanager.dataprotection.models.BaseBackupPolicyResourceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BackupPoliciesClient. */ +public final class BackupPoliciesClientImpl implements BackupPoliciesClient { + private final ClientLogger logger = new ClientLogger(BackupPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BackupPoliciesService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of BackupPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupPoliciesClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(BackupPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientBackupPolicies to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface BackupPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupPolicyName") String backupPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupPolicyName") String backupPolicyName, + @BodyParam("application/json") BaseBackupPolicyResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupPolicyName") String backupPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String vaultName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String vaultName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String vaultName, String resourceGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String vaultName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String vaultName, String resourceGroupName) { + return new PagedIterable<>(listAsync(vaultName, resourceGroupName)); + } + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String vaultName, String resourceGroupName, Context context) { + return new PagedIterable<>(listAsync(vaultName, resourceGroupName, context)); + } + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String vaultName, String resourceGroupName, String backupPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String vaultName, String resourceGroupName, String backupPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + accept, + context); + } + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String vaultName, String resourceGroupName, String backupPolicyName) { + return getWithResponseAsync(vaultName, resourceGroupName, backupPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BaseBackupPolicyResourceInner get(String vaultName, String resourceGroupName, String backupPolicyName) { + return getAsync(vaultName, resourceGroupName, backupPolicyName).block(); + } + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context) { + return getWithResponseAsync(vaultName, resourceGroupName, backupPolicyName, context).block(); + } + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for 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 baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String vaultName, String resourceGroupName, String backupPolicyName, BaseBackupPolicyResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupPolicyName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupPolicyName, + BaseBackupPolicyResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupPolicyName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + parameters, + accept, + context); + } + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for 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 baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String vaultName, String resourceGroupName, String backupPolicyName, BaseBackupPolicyResourceInner parameters) { + return createOrUpdateWithResponseAsync(vaultName, resourceGroupName, backupPolicyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for 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 baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BaseBackupPolicyResourceInner createOrUpdate( + String vaultName, String resourceGroupName, String backupPolicyName, BaseBackupPolicyResourceInner parameters) { + return createOrUpdateAsync(vaultName, resourceGroupName, backupPolicyName, parameters).block(); + } + + /** + * Creates or Updates a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName Name of the policy. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String vaultName, + String resourceGroupName, + String backupPolicyName, + BaseBackupPolicyResourceInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(vaultName, resourceGroupName, backupPolicyName, parameters, context) + .block(); + } + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String vaultName, String resourceGroupName, String backupPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String vaultName, String resourceGroupName, String backupPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + accept, + context); + } + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String vaultName, String resourceGroupName, String backupPolicyName) { + return deleteWithResponseAsync(vaultName, resourceGroupName, backupPolicyName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String vaultName, String resourceGroupName, String backupPolicyName) { + deleteAsync(vaultName, resourceGroupName, backupPolicyName).block(); + } + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context) { + return deleteWithResponseAsync(vaultName, resourceGroupName, backupPolicyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 baseBackupPolicyResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesImpl.java new file mode 100644 index 0000000000000..be3061c0f1359 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.BackupPoliciesClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupPolicies; +import com.azure.resourcemanager.dataprotection.models.BaseBackupPolicyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BackupPoliciesImpl implements BackupPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPoliciesImpl.class); + + private final BackupPoliciesClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public BackupPoliciesImpl( + BackupPoliciesClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String vaultName, String resourceGroupName) { + PagedIterable inner = this.serviceClient().list(vaultName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new BaseBackupPolicyResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String vaultName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(vaultName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new BaseBackupPolicyResourceImpl(inner1, this.manager())); + } + + public BaseBackupPolicyResource get(String vaultName, String resourceGroupName, String backupPolicyName) { + BaseBackupPolicyResourceInner inner = this.serviceClient().get(vaultName, resourceGroupName, backupPolicyName); + if (inner != null) { + return new BaseBackupPolicyResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(vaultName, resourceGroupName, backupPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BaseBackupPolicyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String vaultName, String resourceGroupName, String backupPolicyName) { + this.serviceClient().delete(vaultName, resourceGroupName, backupPolicyName); + } + + public Response deleteWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context) { + return this.serviceClient().deleteWithResponse(vaultName, resourceGroupName, backupPolicyName, context); + } + + public BaseBackupPolicyResource getById(String id) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupPolicyName = Utils.getValueFromIdByName(id, "backupPolicies"); + if (backupPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id))); + } + return this.getWithResponse(vaultName, resourceGroupName, backupPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupPolicyName = Utils.getValueFromIdByName(id, "backupPolicies"); + if (backupPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id))); + } + return this.getWithResponse(vaultName, resourceGroupName, backupPolicyName, context); + } + + public void deleteById(String id) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupPolicyName = Utils.getValueFromIdByName(id, "backupPolicies"); + if (backupPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id))); + } + this.deleteWithResponse(vaultName, resourceGroupName, backupPolicyName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String backupPolicyName = Utils.getValueFromIdByName(id, "backupPolicies"); + if (backupPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id))); + } + return this.deleteWithResponse(vaultName, resourceGroupName, backupPolicyName, context); + } + + private BackupPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + public BaseBackupPolicyResourceImpl define(String name) { + return new BaseBackupPolicyResourceImpl(name, this.manager()); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultOperationResultsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultOperationResultsClientImpl.java new file mode 100644 index 0000000000000..9cb08e1eb523e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultOperationResultsClientImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.BackupVaultOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultOperationResultsGetResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BackupVaultOperationResultsClient. */ +public final class BackupVaultOperationResultsClientImpl implements BackupVaultOperationResultsClient { + private final ClientLogger logger = new ClientLogger(BackupVaultOperationResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BackupVaultOperationResultsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of BackupVaultOperationResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupVaultOperationResultsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy + .create( + BackupVaultOperationResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientBackupVaultOperationResults to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface BackupVaultOperationResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/operationResults/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String vaultName, String resourceGroupName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + operationId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String vaultName, String resourceGroupName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + operationId, + accept, + context); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String vaultName, String resourceGroupName, String operationId) { + return getWithResponseAsync(vaultName, resourceGroupName, operationId) + .flatMap( + (BackupVaultOperationResultsGetResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner get(String vaultName, String resourceGroupName, String operationId) { + return getAsync(vaultName, resourceGroupName, operationId).block(); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultOperationResultsGetResponse getWithResponse( + String vaultName, String resourceGroupName, String operationId, Context context) { + return getWithResponseAsync(vaultName, resourceGroupName, operationId, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultOperationResultsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultOperationResultsImpl.java new file mode 100644 index 0000000000000..2046845383f6d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultOperationResultsImpl.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.dataprotection.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.dataprotection.fluent.BackupVaultOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultOperationResults; +import com.azure.resourcemanager.dataprotection.models.BackupVaultOperationResultsGetResponse; +import com.azure.resourcemanager.dataprotection.models.BackupVaultResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BackupVaultOperationResultsImpl implements BackupVaultOperationResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVaultOperationResultsImpl.class); + + private final BackupVaultOperationResultsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public BackupVaultOperationResultsImpl( + BackupVaultOperationResultsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BackupVaultResource get(String vaultName, String resourceGroupName, String operationId) { + BackupVaultResourceInner inner = this.serviceClient().get(vaultName, resourceGroupName, operationId); + if (inner != null) { + return new BackupVaultResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String vaultName, String resourceGroupName, String operationId, Context context) { + BackupVaultOperationResultsGetResponse inner = + this.serviceClient().getWithResponse(vaultName, resourceGroupName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupVaultResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private BackupVaultOperationResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultResourceImpl.java new file mode 100644 index 0000000000000..866824bb7241f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultResourceImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupVault; +import com.azure.resourcemanager.dataprotection.models.BackupVaultResource; +import com.azure.resourcemanager.dataprotection.models.DppIdentityDetails; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; +import java.util.Collections; +import java.util.Map; + +public final class BackupVaultResourceImpl + implements BackupVaultResource, BackupVaultResource.Definition, BackupVaultResource.Update { + private BackupVaultResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public DppIdentityDetails identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BackupVault properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public BackupVaultResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + private String vaultName; + + private String resourceGroupName; + + private PatchResourceRequestInput updateParameters; + + public BackupVaultResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public BackupVaultResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .createOrUpdate(vaultName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public BackupVaultResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .createOrUpdate(vaultName, resourceGroupName, this.innerModel(), context); + return this; + } + + BackupVaultResourceImpl( + String name, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = new BackupVaultResourceInner(); + this.serviceManager = serviceManager; + this.vaultName = name; + } + + public BackupVaultResourceImpl update() { + this.updateParameters = new PatchResourceRequestInput(); + return this; + } + + public BackupVaultResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .update(vaultName, resourceGroupName, updateParameters, Context.NONE); + return this; + } + + public BackupVaultResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .update(vaultName, resourceGroupName, updateParameters, context); + return this; + } + + BackupVaultResourceImpl( + BackupVaultResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.vaultName = Utils.getValueFromIdByName(innerObject.id(), "backupVaults"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + } + + public BackupVaultResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .getByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE) + .getValue(); + return this; + } + + public BackupVaultResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .getByResourceGroupWithResponse(resourceGroupName, vaultName, context) + .getValue(); + return this; + } + + public BackupVaultResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public BackupVaultResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public BackupVaultResourceImpl withProperties(BackupVault properties) { + this.innerModel().withProperties(properties); + return this; + } + + public BackupVaultResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public BackupVaultResourceImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public BackupVaultResourceImpl withIdentity(DppIdentityDetails identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsClientImpl.java new file mode 100644 index 0000000000000..ad1be50ea35cf --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsClientImpl.java @@ -0,0 +1,1641 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dataprotection.fluent.BackupVaultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultResourceList; +import com.azure.resourcemanager.dataprotection.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; +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 BackupVaultsClient. */ +public final class BackupVaultsClientImpl implements BackupVaultsClient { + private final ClientLogger logger = new ClientLogger(BackupVaultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BackupVaultsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of BackupVaultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupVaultsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(BackupVaultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientBackupVaults to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface BackupVaultsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") BackupVaultResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") PatchResourceRequestInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/locations/{location}/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @BodyParam("application/json") CheckNameAvailabilityRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getInSubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getInResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns resource collection belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns resource collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns resource collection belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> getInSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Returns resource collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> getInSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns resource collection belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns resource collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> getInResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> getInResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vaultName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + vaultName, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vaultName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + vaultName, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vaultName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vaultName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner getByResourceGroup(String resourceGroupName, String vaultName) { + return getByResourceGroupAsync(resourceGroupName, vaultName).block(); + } + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vaultName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vaultName, context).block(); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginCreateOrUpdateAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(vaultName, resourceGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupVaultResourceInner.class, + BackupVaultResourceInner.class, + Context.NONE); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginCreateOrUpdateAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(vaultName, resourceGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupVaultResourceInner.class, + BackupVaultResourceInner.class, + context); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginCreateOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginCreateOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + return beginCreateOrUpdateAsync(vaultName, resourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner createOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + return createOrUpdateAsync(vaultName, resourceGroupName, parameters).block(); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner createOrUpdate( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + return createOrUpdateAsync(vaultName, resourceGroupName, parameters, context).block(); + } + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String vaultName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + vaultName, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String vaultName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + vaultName, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String vaultName) { + return deleteWithResponseAsync(resourceGroupName, vaultName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String vaultName) { + deleteAsync(resourceGroupName, vaultName).block(); + } + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String vaultName, Context context) { + return deleteWithResponseAsync(resourceGroupName, vaultName, context).block(); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginUpdateAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + Mono>> mono = updateWithResponseAsync(vaultName, resourceGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupVaultResourceInner.class, + BackupVaultResourceInner.class, + Context.NONE); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginUpdateAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(vaultName, resourceGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupVaultResourceInner.class, + BackupVaultResourceInner.class, + context); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginUpdate( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + return beginUpdateAsync(vaultName, resourceGroupName, parameters).getSyncPoller(); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginUpdate( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + return beginUpdateAsync(vaultName, resourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + return beginUpdateAsync(vaultName, resourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + return beginUpdateAsync(vaultName, resourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner update( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + return updateAsync(vaultName, resourceGroupName, parameters).block(); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner update( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + return updateAsync(vaultName, resourceGroupName, parameters, context).block(); + } + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + location, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + location, + parameters, + accept, + context); + } + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters) { + return checkNameAvailabilityWithResponseAsync(resourceGroupName, location, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters) { + return checkNameAvailabilityAsync(resourceGroupName, location, parameters).block(); + } + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(resourceGroupName, location, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInSubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getInResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 backupVaultResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsImpl.java new file mode 100644 index 0000000000000..e19591dd3a00b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.BackupVaultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultResource; +import com.azure.resourcemanager.dataprotection.models.BackupVaults; +import com.azure.resourcemanager.dataprotection.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.dataprotection.models.CheckNameAvailabilityResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BackupVaultsImpl implements BackupVaults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVaultsImpl.class); + + private final BackupVaultsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public BackupVaultsImpl( + BackupVaultsClient innerClient, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new BackupVaultResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new BackupVaultResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new BackupVaultResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new BackupVaultResourceImpl(inner1, this.manager())); + } + + public BackupVaultResource getByResourceGroup(String resourceGroupName, String vaultName) { + BackupVaultResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vaultName); + if (inner != null) { + return new BackupVaultResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vaultName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vaultName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupVaultResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String vaultName) { + this.serviceClient().delete(resourceGroupName, vaultName); + } + + public Response deleteWithResponse(String resourceGroupName, String vaultName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, vaultName, context); + } + + public CheckNameAvailabilityResult checkNameAvailability( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters) { + CheckNameAvailabilityResultInner inner = + this.serviceClient().checkNameAvailability(resourceGroupName, location, parameters); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(resourceGroupName, location, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BackupVaultResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vaultName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + this.deleteWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String vaultName = Utils.getValueFromIdByName(id, "backupVaults"); + if (vaultName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'backupVaults'.", id))); + } + return this.deleteWithResponse(resourceGroupName, vaultName, context); + } + + private BackupVaultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + public BackupVaultResourceImpl define(String name) { + return new BackupVaultResourceImpl(name, this.manager()); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BaseBackupPolicyResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BaseBackupPolicyResourceImpl.java new file mode 100644 index 0000000000000..1e6f43498a571 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BaseBackupPolicyResourceImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; +import com.azure.resourcemanager.dataprotection.models.BaseBackupPolicy; +import com.azure.resourcemanager.dataprotection.models.BaseBackupPolicyResource; + +public final class BaseBackupPolicyResourceImpl + implements BaseBackupPolicyResource, BaseBackupPolicyResource.Definition, BaseBackupPolicyResource.Update { + private BaseBackupPolicyResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BaseBackupPolicy properties() { + return this.innerModel().properties(); + } + + public BaseBackupPolicyResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + private String vaultName; + + private String resourceGroupName; + + private String backupPolicyName; + + public BaseBackupPolicyResourceImpl withExistingBackupVault(String vaultName, String resourceGroupName) { + this.vaultName = vaultName; + this.resourceGroupName = resourceGroupName; + return this; + } + + public BaseBackupPolicyResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .createOrUpdateWithResponse( + vaultName, resourceGroupName, backupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public BaseBackupPolicyResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .createOrUpdateWithResponse(vaultName, resourceGroupName, backupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + BaseBackupPolicyResourceImpl( + String name, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = new BaseBackupPolicyResourceInner(); + this.serviceManager = serviceManager; + this.backupPolicyName = name; + } + + public BaseBackupPolicyResourceImpl update() { + return this; + } + + public BaseBackupPolicyResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .createOrUpdateWithResponse( + vaultName, resourceGroupName, backupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public BaseBackupPolicyResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .createOrUpdateWithResponse(vaultName, resourceGroupName, backupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + BaseBackupPolicyResourceImpl( + BaseBackupPolicyResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.vaultName = Utils.getValueFromIdByName(innerObject.id(), "backupVaults"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.backupPolicyName = Utils.getValueFromIdByName(innerObject.id(), "backupPolicies"); + } + + public BaseBackupPolicyResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .getWithResponse(vaultName, resourceGroupName, backupPolicyName, Context.NONE) + .getValue(); + return this; + } + + public BaseBackupPolicyResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .getWithResponse(vaultName, resourceGroupName, backupPolicyName, context) + .getValue(); + return this; + } + + public BaseBackupPolicyResourceImpl withProperties(BaseBackupPolicy properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/CheckNameAvailabilityResultImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..3bef22f9ccb1c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.dataprotection.models.CheckNameAvailabilityResult; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + CheckNameAvailabilityResultImpl( + CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ClientDiscoveryValueForSingleApiImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ClientDiscoveryValueForSingleApiImpl.java new file mode 100644 index 0000000000000..81510b874a3d8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ClientDiscoveryValueForSingleApiImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryDisplay; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryForProperties; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryValueForSingleApi; + +public final class ClientDiscoveryValueForSingleApiImpl implements ClientDiscoveryValueForSingleApi { + private ClientDiscoveryValueForSingleApiInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + ClientDiscoveryValueForSingleApiImpl( + ClientDiscoveryValueForSingleApiInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ClientDiscoveryDisplay display() { + return this.innerModel().display(); + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public ClientDiscoveryForProperties properties() { + return this.innerModel().properties(); + } + + public ClientDiscoveryValueForSingleApiInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientBuilder.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientBuilder.java new file mode 100644 index 0000000000000..3b406729a3ef3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the DataProtectionClientImpl type. */ +@ServiceClientBuilder(serviceClients = {DataProtectionClientImpl.class}) +public final class DataProtectionClientBuilder { + /* + * The subscription Id. + */ + private String subscriptionId; + + /** + * Sets The subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the DataProtectionClientBuilder. + */ + public DataProtectionClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the DataProtectionClientBuilder. + */ + public DataProtectionClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the DataProtectionClientBuilder. + */ + public DataProtectionClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the DataProtectionClientBuilder. + */ + public DataProtectionClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the DataProtectionClientBuilder. + */ + public DataProtectionClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the DataProtectionClientBuilder. + */ + public DataProtectionClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DataProtectionClientImpl with the provided parameters. + * + * @return an instance of DataProtectionClientImpl. + */ + public DataProtectionClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + DataProtectionClientImpl client = + new DataProtectionClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientImpl.java new file mode 100644 index 0000000000000..9b21a94c02f46 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientImpl.java @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.dataprotection.fluent.BackupInstancesClient; +import com.azure.resourcemanager.dataprotection.fluent.BackupPoliciesClient; +import com.azure.resourcemanager.dataprotection.fluent.BackupVaultOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.BackupVaultsClient; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionClient; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionsClient; +import com.azure.resourcemanager.dataprotection.fluent.ExportJobsClient; +import com.azure.resourcemanager.dataprotection.fluent.ExportJobsOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.JobsClient; +import com.azure.resourcemanager.dataprotection.fluent.OperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.OperationStatusClient; +import com.azure.resourcemanager.dataprotection.fluent.RecoveryPointsClient; +import com.azure.resourcemanager.dataprotection.fluent.ResourceGuardsClient; +import com.azure.resourcemanager.dataprotection.fluent.RestorableTimeRangesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the DataProtectionClientImpl type. */ +@ServiceClient(builder = DataProtectionClientBuilder.class) +public final class DataProtectionClientImpl implements DataProtectionClient { + private final ClientLogger logger = new ClientLogger(DataProtectionClientImpl.class); + + /** The subscription Id. */ + private final String subscriptionId; + + /** + * Gets The subscription Id. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The BackupVaultsClient object to access its operations. */ + private final BackupVaultsClient backupVaults; + + /** + * Gets the BackupVaultsClient object to access its operations. + * + * @return the BackupVaultsClient object. + */ + public BackupVaultsClient getBackupVaults() { + return this.backupVaults; + } + + /** The OperationResultsClient object to access its operations. */ + private final OperationResultsClient operationResults; + + /** + * Gets the OperationResultsClient object to access its operations. + * + * @return the OperationResultsClient object. + */ + public OperationResultsClient getOperationResults() { + return this.operationResults; + } + + /** The OperationStatusClient object to access its operations. */ + private final OperationStatusClient operationStatus; + + /** + * Gets the OperationStatusClient object to access its operations. + * + * @return the OperationStatusClient object. + */ + public OperationStatusClient getOperationStatus() { + return this.operationStatus; + } + + /** The BackupVaultOperationResultsClient object to access its operations. */ + private final BackupVaultOperationResultsClient backupVaultOperationResults; + + /** + * Gets the BackupVaultOperationResultsClient object to access its operations. + * + * @return the BackupVaultOperationResultsClient object. + */ + public BackupVaultOperationResultsClient getBackupVaultOperationResults() { + return this.backupVaultOperationResults; + } + + /** The DataProtectionsClient object to access its operations. */ + private final DataProtectionsClient dataProtections; + + /** + * Gets the DataProtectionsClient object to access its operations. + * + * @return the DataProtectionsClient object. + */ + public DataProtectionsClient getDataProtections() { + return this.dataProtections; + } + + /** The DataProtectionOperationsClient object to access its operations. */ + private final DataProtectionOperationsClient dataProtectionOperations; + + /** + * Gets the DataProtectionOperationsClient object to access its operations. + * + * @return the DataProtectionOperationsClient object. + */ + public DataProtectionOperationsClient getDataProtectionOperations() { + return this.dataProtectionOperations; + } + + /** The BackupPoliciesClient object to access its operations. */ + private final BackupPoliciesClient backupPolicies; + + /** + * Gets the BackupPoliciesClient object to access its operations. + * + * @return the BackupPoliciesClient object. + */ + public BackupPoliciesClient getBackupPolicies() { + return this.backupPolicies; + } + + /** The BackupInstancesClient object to access its operations. */ + private final BackupInstancesClient backupInstances; + + /** + * Gets the BackupInstancesClient object to access its operations. + * + * @return the BackupInstancesClient object. + */ + public BackupInstancesClient getBackupInstances() { + return this.backupInstances; + } + + /** The RecoveryPointsClient object to access its operations. */ + private final RecoveryPointsClient recoveryPoints; + + /** + * Gets the RecoveryPointsClient object to access its operations. + * + * @return the RecoveryPointsClient object. + */ + public RecoveryPointsClient getRecoveryPoints() { + return this.recoveryPoints; + } + + /** The JobsClient object to access its operations. */ + private final JobsClient jobs; + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + public JobsClient getJobs() { + return this.jobs; + } + + /** The RestorableTimeRangesClient object to access its operations. */ + private final RestorableTimeRangesClient restorableTimeRanges; + + /** + * Gets the RestorableTimeRangesClient object to access its operations. + * + * @return the RestorableTimeRangesClient object. + */ + public RestorableTimeRangesClient getRestorableTimeRanges() { + return this.restorableTimeRanges; + } + + /** The ExportJobsClient object to access its operations. */ + private final ExportJobsClient exportJobs; + + /** + * Gets the ExportJobsClient object to access its operations. + * + * @return the ExportJobsClient object. + */ + public ExportJobsClient getExportJobs() { + return this.exportJobs; + } + + /** The ExportJobsOperationResultsClient object to access its operations. */ + private final ExportJobsOperationResultsClient exportJobsOperationResults; + + /** + * Gets the ExportJobsOperationResultsClient object to access its operations. + * + * @return the ExportJobsOperationResultsClient object. + */ + public ExportJobsOperationResultsClient getExportJobsOperationResults() { + return this.exportJobsOperationResults; + } + + /** The ResourceGuardsClient object to access its operations. */ + private final ResourceGuardsClient resourceGuards; + + /** + * Gets the ResourceGuardsClient object to access its operations. + * + * @return the ResourceGuardsClient object. + */ + public ResourceGuardsClient getResourceGuards() { + return this.resourceGuards; + } + + /** + * Initializes an instance of DataProtectionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The subscription Id. + * @param endpoint server parameter. + */ + DataProtectionClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-07-01"; + this.backupVaults = new BackupVaultsClientImpl(this); + this.operationResults = new OperationResultsClientImpl(this); + this.operationStatus = new OperationStatusClientImpl(this); + this.backupVaultOperationResults = new BackupVaultOperationResultsClientImpl(this); + this.dataProtections = new DataProtectionsClientImpl(this); + this.dataProtectionOperations = new DataProtectionOperationsClientImpl(this); + this.backupPolicies = new BackupPoliciesClientImpl(this); + this.backupInstances = new BackupInstancesClientImpl(this); + this.recoveryPoints = new RecoveryPointsClientImpl(this); + this.jobs = new JobsClientImpl(this); + this.restorableTimeRanges = new RestorableTimeRangesClientImpl(this); + this.exportJobs = new ExportJobsClientImpl(this); + this.exportJobsOperationResults = new ExportJobsOperationResultsClientImpl(this); + this.resourceGuards = new ResourceGuardsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionOperationsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionOperationsClientImpl.java new file mode 100644 index 0000000000000..6055bbc399cfd --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionOperationsClientImpl.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataProtectionOperationsClient. */ +public final class DataProtectionOperationsClientImpl implements DataProtectionOperationsClient { + private final ClientLogger logger = new ClientLogger(DataProtectionOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataProtectionOperationsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of DataProtectionOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataProtectionOperationsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy + .create(DataProtectionOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientDataProtectionOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface DataProtectionOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DataProtection/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns the list of available operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the list of available operations. + * + * @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 clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns the list of available operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of available operations. + * + * @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 clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns the list of available operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns the list of available operations. + * + * @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 clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 clientDiscoveryResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionOperationsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionOperationsImpl.java new file mode 100644 index 0000000000000..114fdd3f24ab6 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionOperationsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryValueForSingleApi; +import com.azure.resourcemanager.dataprotection.models.DataProtectionOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataProtectionOperationsImpl implements DataProtectionOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataProtectionOperationsImpl.class); + + private final DataProtectionOperationsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public DataProtectionOperationsImpl( + DataProtectionOperationsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ClientDiscoveryValueForSingleApiImpl(inner1, this.manager())); + } + + private DataProtectionOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionsClientImpl.java new file mode 100644 index 0000000000000..3f10d955d562c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionsClientImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.dataprotection.fluent.DataProtectionsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationRequestBase; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataProtectionsClient. */ +public final class DataProtectionsClientImpl implements DataProtectionsClient { + private final ClientLogger logger = new ClientLogger(DataProtectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataProtectionsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of DataProtectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataProtectionsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(DataProtectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientDataProtections to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface DataProtectionsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}" + + "/checkFeatureSupport") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkFeatureSupport( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @BodyParam("application/json") FeatureValidationRequestBase parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkFeatureSupportWithResponseAsync( + String location, FeatureValidationRequestBase parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkFeatureSupport( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @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 base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkFeatureSupportWithResponseAsync( + String location, FeatureValidationRequestBase parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkFeatureSupport( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + parameters, + accept, + context); + } + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkFeatureSupportAsync( + String location, FeatureValidationRequestBase parameters) { + return checkFeatureSupportWithResponseAsync(location, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FeatureValidationResponseBaseInner checkFeatureSupport( + String location, FeatureValidationRequestBase parameters) { + return checkFeatureSupportAsync(location, parameters).block(); + } + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @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 base class for Backup Feature support. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkFeatureSupportWithResponse( + String location, FeatureValidationRequestBase parameters, Context context) { + return checkFeatureSupportWithResponseAsync(location, parameters, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionsImpl.java new file mode 100644 index 0000000000000..dd2287e8677b3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionsImpl.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.dataprotection.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.dataprotection.fluent.DataProtectionsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.models.DataProtections; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationRequestBase; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationResponseBase; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataProtectionsImpl implements DataProtections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataProtectionsImpl.class); + + private final DataProtectionsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public DataProtectionsImpl( + DataProtectionsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public FeatureValidationResponseBase checkFeatureSupport(String location, FeatureValidationRequestBase parameters) { + FeatureValidationResponseBaseInner inner = this.serviceClient().checkFeatureSupport(location, parameters); + if (inner != null) { + return new FeatureValidationResponseBaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkFeatureSupportWithResponse( + String location, FeatureValidationRequestBase parameters, Context context) { + Response inner = + this.serviceClient().checkFeatureSupportWithResponse(location, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FeatureValidationResponseBaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DataProtectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DppBaseResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DppBaseResourceImpl.java new file mode 100644 index 0000000000000..e2772ba767a28 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DppBaseResourceImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner; +import com.azure.resourcemanager.dataprotection.models.DppBaseResource; + +public final class DppBaseResourceImpl implements DppBaseResource { + private DppBaseResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + DppBaseResourceImpl( + DppBaseResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DppBaseResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsClientImpl.java new file mode 100644 index 0000000000000..9ba8c0caabfe5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsClientImpl.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dataprotection.fluent.ExportJobsClient; +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 ExportJobsClient. */ +public final class ExportJobsClientImpl implements ExportJobsClient { + private final ClientLogger logger = new ClientLogger(ExportJobsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ExportJobsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of ExportJobsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExportJobsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(ExportJobsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientExportJobs to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface ExportJobsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/exportBackupJobs") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> trigger( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerWithResponseAsync(String resourceGroupName, String vaultName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .trigger( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerWithResponseAsync( + String resourceGroupName, String vaultName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .trigger( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + accept, + context); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerAsync(String resourceGroupName, String vaultName) { + Mono>> mono = triggerWithResponseAsync(resourceGroupName, vaultName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerAsync( + String resourceGroupName, String vaultName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = triggerWithResponseAsync(resourceGroupName, vaultName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTrigger(String resourceGroupName, String vaultName) { + return beginTriggerAsync(resourceGroupName, vaultName).getSyncPoller(); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTrigger( + String resourceGroupName, String vaultName, Context context) { + return beginTriggerAsync(resourceGroupName, vaultName, context).getSyncPoller(); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerAsync(String resourceGroupName, String vaultName) { + return beginTriggerAsync(resourceGroupName, vaultName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerAsync(String resourceGroupName, String vaultName, Context context) { + return beginTriggerAsync(resourceGroupName, vaultName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void trigger(String resourceGroupName, String vaultName) { + triggerAsync(resourceGroupName, vaultName).block(); + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void trigger(String resourceGroupName, String vaultName, Context context) { + triggerAsync(resourceGroupName, vaultName, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsImpl.java new file mode 100644 index 0000000000000..7af592eaa57fc --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.ExportJobsClient; +import com.azure.resourcemanager.dataprotection.models.ExportJobs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ExportJobsImpl implements ExportJobs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportJobsImpl.class); + + private final ExportJobsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public ExportJobsImpl( + ExportJobsClient innerClient, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void trigger(String resourceGroupName, String vaultName) { + this.serviceClient().trigger(resourceGroupName, vaultName); + } + + public void trigger(String resourceGroupName, String vaultName, Context context) { + this.serviceClient().trigger(resourceGroupName, vaultName, context); + } + + private ExportJobsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsClientImpl.java new file mode 100644 index 0000000000000..e9334f24905bb --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsClientImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.ExportJobsOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.ExportJobsResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ExportJobsOperationResultsClient. */ +public final class ExportJobsOperationResultsClientImpl implements ExportJobsOperationResultsClient { + private final ClientLogger logger = new ClientLogger(ExportJobsOperationResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ExportJobsOperationResultsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of ExportJobsOperationResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExportJobsOperationResultsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy + .create( + ExportJobsOperationResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientExportJobsOperationResults to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface ExportJobsOperationResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupJobs/operations/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + accept, + context); + } + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String vaultName, String operationId) { + return getWithResponseAsync(resourceGroupName, vaultName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExportJobsResultInner get(String resourceGroupName, String vaultName, String operationId) { + return getAsync(resourceGroupName, vaultName, operationId).block(); + } + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @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 of operation triggered by Export Jobs API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + return getWithResponseAsync(resourceGroupName, vaultName, operationId, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsImpl.java new file mode 100644 index 0000000000000..582451cf433a7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.ExportJobsOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.ExportJobsResultInner; +import com.azure.resourcemanager.dataprotection.models.ExportJobsOperationResults; +import com.azure.resourcemanager.dataprotection.models.ExportJobsResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ExportJobsOperationResultsImpl implements ExportJobsOperationResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportJobsOperationResultsImpl.class); + + private final ExportJobsOperationResultsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public ExportJobsOperationResultsImpl( + ExportJobsOperationResultsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ExportJobsResult get(String resourceGroupName, String vaultName, String operationId) { + ExportJobsResultInner inner = this.serviceClient().get(resourceGroupName, vaultName, operationId); + if (inner != null) { + return new ExportJobsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vaultName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExportJobsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ExportJobsOperationResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsResultImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsResultImpl.java new file mode 100644 index 0000000000000..42591b48c755c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.fluent.models.ExportJobsResultInner; +import com.azure.resourcemanager.dataprotection.models.ExportJobsResult; + +public final class ExportJobsResultImpl implements ExportJobsResult { + private ExportJobsResultInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + ExportJobsResultImpl( + ExportJobsResultInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String blobUrl() { + return this.innerModel().blobUrl(); + } + + public String blobSasKey() { + return this.innerModel().blobSasKey(); + } + + public String excelFileBlobUrl() { + return this.innerModel().excelFileBlobUrl(); + } + + public String excelFileBlobSasKey() { + return this.innerModel().excelFileBlobSasKey(); + } + + public ExportJobsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/FeatureValidationResponseBaseImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/FeatureValidationResponseBaseImpl.java new file mode 100644 index 0000000000000..8e7c765972ac5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/FeatureValidationResponseBaseImpl.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationResponseBase; + +public final class FeatureValidationResponseBaseImpl implements FeatureValidationResponseBase { + private FeatureValidationResponseBaseInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + FeatureValidationResponseBaseImpl( + FeatureValidationResponseBaseInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public FeatureValidationResponseBaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsClientImpl.java new file mode 100644 index 0000000000000..9b9e7f019fee4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsClientImpl.java @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.JobsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJobResourceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public final class JobsClientImpl implements JobsClient { + private final ClientLogger logger = new ClientLogger(JobsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of JobsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobsClientImpl(DataProtectionClientImpl client) { + this.service = RestProxy.create(JobsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientJobs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface JobsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupJobs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupJobs/{jobId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vaultName") String vaultName, + @PathParam("jobId") String jobId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String vaultName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String vaultName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String vaultName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vaultName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String vaultName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vaultName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String vaultName) { + return new PagedIterable<>(listAsync(resourceGroupName, vaultName)); + } + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String vaultName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, vaultName, context)); + } + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vaultName, String jobId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + jobId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vaultName, String jobId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + vaultName, + jobId, + accept, + context); + } + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String vaultName, String jobId) { + return getWithResponseAsync(resourceGroupName, vaultName, jobId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureBackupJobResourceInner get(String resourceGroupName, String vaultName, String jobId) { + return getAsync(resourceGroupName, vaultName, jobId).block(); + } + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String vaultName, String jobId, Context context) { + return getWithResponseAsync(resourceGroupName, vaultName, jobId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list of AzureBackup Job resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsImpl.java new file mode 100644 index 0000000000000..40eed436900a1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.JobsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJobResource; +import com.azure.resourcemanager.dataprotection.models.Jobs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobsImpl implements Jobs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobsImpl.class); + + private final JobsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public JobsImpl( + JobsClient innerClient, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String vaultName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName); + return Utils.mapPage(inner, inner1 -> new AzureBackupJobResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String vaultName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, vaultName, context); + return Utils.mapPage(inner, inner1 -> new AzureBackupJobResourceImpl(inner1, this.manager())); + } + + public AzureBackupJobResource get(String resourceGroupName, String vaultName, String jobId) { + AzureBackupJobResourceInner inner = this.serviceClient().get(resourceGroupName, vaultName, jobId); + if (inner != null) { + return new AzureBackupJobResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vaultName, String jobId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vaultName, jobId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureBackupJobResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private JobsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationJobExtendedInfoImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationJobExtendedInfoImpl.java new file mode 100644 index 0000000000000..bcbc05fd8d5b0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationJobExtendedInfoImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.OperationJobExtendedInfo; + +public final class OperationJobExtendedInfoImpl implements OperationJobExtendedInfo { + private OperationJobExtendedInfoInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + OperationJobExtendedInfoImpl( + OperationJobExtendedInfoInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String jobId() { + return this.innerModel().jobId(); + } + + public OperationJobExtendedInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResourceImpl.java new file mode 100644 index 0000000000000..08d6a71dc8589 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResourceImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.dataprotection.models.OperationExtendedInfo; +import com.azure.resourcemanager.dataprotection.models.OperationResource; +import java.time.OffsetDateTime; + +public final class OperationResourceImpl implements OperationResource { + private OperationResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + OperationResourceImpl( + OperationResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager 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 OperationExtendedInfo properties() { + return this.innerModel().properties(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public OperationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsClientImpl.java new file mode 100644 index 0000000000000..e1c97bfa3aa12 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsClientImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.OperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.OperationResultsGetResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationResultsClient. */ +public final class OperationResultsClientImpl implements OperationResultsClient { + private final ClientLogger logger = new ClientLogger(OperationResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationResultsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of OperationResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationResultsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(OperationResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientOperationResults to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface OperationResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults" + + "/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("operationId") String operationId, + @PathParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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 getWithResponseAsync(String operationId, String location) { + 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + operationId, + location, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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 getWithResponseAsync( + String operationId, String location, 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + operationId, + location, + accept, + context); + } + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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 getAsync(String operationId, String location) { + return getWithResponseAsync(operationId, location) + .flatMap( + (OperationResultsGetResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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 OperationJobExtendedInfoInner get(String operationId, String location) { + return getAsync(operationId, location).block(); + } + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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 OperationResultsGetResponse getWithResponse(String operationId, String location, Context context) { + return getWithResponseAsync(operationId, location, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsImpl.java new file mode 100644 index 0000000000000..1e0fb849fea67 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.OperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.azure.resourcemanager.dataprotection.models.OperationJobExtendedInfo; +import com.azure.resourcemanager.dataprotection.models.OperationResults; +import com.azure.resourcemanager.dataprotection.models.OperationResultsGetResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationResultsImpl implements OperationResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResultsImpl.class); + + private final OperationResultsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public OperationResultsImpl( + OperationResultsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationJobExtendedInfo get(String operationId, String location) { + OperationJobExtendedInfoInner inner = this.serviceClient().get(operationId, location); + if (inner != null) { + return new OperationJobExtendedInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String operationId, String location, Context context) { + OperationResultsGetResponse inner = this.serviceClient().getWithResponse(operationId, location, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationJobExtendedInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationStatusClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationStatusClientImpl.java new file mode 100644 index 0000000000000..96d2d67a1e226 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationStatusClientImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.OperationStatusClient; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationStatusClient. */ +public final class OperationStatusClientImpl implements OperationStatusClient { + private final ClientLogger logger = new ClientLogger(OperationStatusClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationStatusService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of OperationStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(OperationStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientOperationStatus to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface OperationStatusService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus" + + "/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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> getWithResponseAsync(String location, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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> getWithResponseAsync( + String location, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context); + } + + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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 getAsync(String location, String operationId) { + return getWithResponseAsync(location, 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 location The location parameter. + * @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 get(String location, String operationId) { + return getAsync(location, operationId).block(); + } + + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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 getWithResponse(String location, String operationId, Context context) { + return getWithResponseAsync(location, operationId, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationStatusImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationStatusImpl.java new file mode 100644 index 0000000000000..33b77df3fb688 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationStatusImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.OperationStatusClient; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.dataprotection.models.OperationResource; +import com.azure.resourcemanager.dataprotection.models.OperationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationStatusImpl implements OperationStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusImpl.class); + + private final OperationStatusClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public OperationStatusImpl( + OperationStatusClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResource get(String location, String operationId) { + OperationResourceInner inner = this.serviceClient().get(location, operationId); + if (inner != null) { + return new OperationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String operationId, Context context) { + Response inner = this.serviceClient().getWithResponse(location, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsClientImpl.java new file mode 100644 index 0000000000000..bea162e175a81 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsClientImpl.java @@ -0,0 +1,619 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.RecoveryPointsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPointResourceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoveryPointsClient. */ +public final class RecoveryPointsClientImpl implements RecoveryPointsClient { + private final ClientLogger logger = new ClientLogger(RecoveryPointsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecoveryPointsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of RecoveryPointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoveryPointsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(RecoveryPointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientRecoveryPoints to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface RecoveryPointsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @QueryParam("$filter") String filter, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @PathParam("recoveryPointId") String recoveryPointId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String vaultName, String resourceGroupName, String backupInstanceName, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + filter, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @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 azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String filter, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + filter, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String vaultName, String resourceGroupName, String backupInstanceName, String filter, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName, backupInstanceName, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String vaultName, String resourceGroupName, String backupInstanceName) { + final String filter = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName, backupInstanceName, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @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 azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String filter, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(vaultName, resourceGroupName, backupInstanceName, filter, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String vaultName, String resourceGroupName, String backupInstanceName) { + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(vaultName, resourceGroupName, backupInstanceName, filter, skipToken)); + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @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 azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String filter, + String skipToken, + Context context) { + return new PagedIterable<>( + listAsync(vaultName, resourceGroupName, backupInstanceName, filter, skipToken, context)); + } + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (recoveryPointId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recoveryPointId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + recoveryPointId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String recoveryPointId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (recoveryPointId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recoveryPointId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + recoveryPointId, + accept, + context); + } + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId) { + return getWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureBackupRecoveryPointResourceInner get( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId) { + return getAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId).block(); + } + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String recoveryPointId, + Context context) { + return getWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 azureBackupRecoveryPointResourceList. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsImpl.java new file mode 100644 index 0000000000000..e3e2c0d2ae767 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.RecoveryPointsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPointResource; +import com.azure.resourcemanager.dataprotection.models.RecoveryPoints; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecoveryPointsImpl implements RecoveryPoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoveryPointsImpl.class); + + private final RecoveryPointsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public RecoveryPointsImpl( + RecoveryPointsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String vaultName, String resourceGroupName, String backupInstanceName) { + PagedIterable inner = + this.serviceClient().list(vaultName, resourceGroupName, backupInstanceName); + return Utils.mapPage(inner, inner1 -> new AzureBackupRecoveryPointResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String filter, + String skipToken, + Context context) { + PagedIterable inner = + this.serviceClient().list(vaultName, resourceGroupName, backupInstanceName, filter, skipToken, context); + return Utils.mapPage(inner, inner1 -> new AzureBackupRecoveryPointResourceImpl(inner1, this.manager())); + } + + public AzureBackupRecoveryPointResource get( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId) { + AzureBackupRecoveryPointResourceInner inner = + this.serviceClient().get(vaultName, resourceGroupName, backupInstanceName, recoveryPointId); + if (inner != null) { + return new AzureBackupRecoveryPointResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String recoveryPointId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(vaultName, resourceGroupName, backupInstanceName, recoveryPointId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureBackupRecoveryPointResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RecoveryPointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardResourceImpl.java new file mode 100644 index 0000000000000..62c49469b7820 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardResourceImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner; +import com.azure.resourcemanager.dataprotection.models.DppIdentityDetails; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; +import com.azure.resourcemanager.dataprotection.models.ResourceGuard; +import com.azure.resourcemanager.dataprotection.models.ResourceGuardResource; +import java.util.Collections; +import java.util.Map; + +public final class ResourceGuardResourceImpl + implements ResourceGuardResource, ResourceGuardResource.Definition, ResourceGuardResource.Update { + private ResourceGuardResourceInner innerObject; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public DppIdentityDetails identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ResourceGuard properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ResourceGuardResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceGuardsName; + + private PatchResourceRequestInput updateParameters; + + public ResourceGuardResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ResourceGuardResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGuards() + .putWithResponse(resourceGroupName, resourceGuardsName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ResourceGuardResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGuards() + .putWithResponse(resourceGroupName, resourceGuardsName, this.innerModel(), context) + .getValue(); + return this; + } + + ResourceGuardResourceImpl( + String name, com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = new ResourceGuardResourceInner(); + this.serviceManager = serviceManager; + this.resourceGuardsName = name; + } + + public ResourceGuardResourceImpl update() { + this.updateParameters = new PatchResourceRequestInput(); + return this; + } + + public ResourceGuardResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGuards() + .patchWithResponse(resourceGroupName, resourceGuardsName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public ResourceGuardResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGuards() + .patchWithResponse(resourceGroupName, resourceGuardsName, updateParameters, context) + .getValue(); + return this; + } + + ResourceGuardResourceImpl( + ResourceGuardResourceInner innerObject, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceGuardsName = Utils.getValueFromIdByName(innerObject.id(), "resourceGuards"); + } + + public ResourceGuardResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGuards() + .getByResourceGroupWithResponse(resourceGroupName, resourceGuardsName, Context.NONE) + .getValue(); + return this; + } + + public ResourceGuardResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGuards() + .getByResourceGroupWithResponse(resourceGroupName, resourceGuardsName, context) + .getValue(); + return this; + } + + public ResourceGuardResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ResourceGuardResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ResourceGuardResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ResourceGuardResourceImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public ResourceGuardResourceImpl withIdentity(DppIdentityDetails identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ResourceGuardResourceImpl withProperties(ResourceGuard properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardsClientImpl.java new file mode 100644 index 0000000000000..7a4a0342f8fa9 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardsClientImpl.java @@ -0,0 +1,4171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.ResourceGuardsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner; +import com.azure.resourcemanager.dataprotection.models.DppBaseResourceList; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; +import com.azure.resourcemanager.dataprotection.models.ResourceGuardResourceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceGuardsClient. */ +public final class ResourceGuardsClientImpl implements ResourceGuardsClient { + private final ClientLogger logger = new ClientLogger(ResourceGuardsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceGuardsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of ResourceGuardsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceGuardsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(ResourceGuardsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientResourceGuards to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface ResourceGuardsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @BodyParam("application/json") ResourceGuardResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> patch( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @BodyParam("application/json") PatchResourceRequestInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDisableSoftDeleteRequestsObjects( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDeleteResourceGuardProxyRequestsObjects( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBackupSecurityPinRequestsObjects( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDeleteProtectedItemRequestsObjects( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getUpdateProtectionPolicyRequestsObjects( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getUpdateProtectedItemRequestsObjects( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultDisableSoftDeleteRequestsObject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @PathParam("requestName") String requestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultDeleteResourceGuardProxyRequestsObject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @PathParam("requestName") String requestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultBackupSecurityPinRequestsObject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @PathParam("requestName") String requestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultDeleteProtectedItemRequestsObject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @PathParam("requestName") String requestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultUpdateProtectionPolicyRequestsObject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @PathParam("requestName") String requestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultUpdateProtectedItemRequestsObject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGuardsName") String resourceGuardsName, + @PathParam("requestName") String requestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourcesInSubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourcesInResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDisableSoftDeleteRequestsObjectsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDeleteResourceGuardProxyRequestsObjectsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBackupSecurityPinRequestsObjectsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDeleteProtectedItemRequestsObjectsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getUpdateProtectionPolicyRequestsObjectsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getUpdateProtectedItemRequestsObjectsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> getResourcesInSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), + nextLink -> getResourcesInSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> getResourcesInResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> getResourcesInResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + parameters, + accept, + context); + } + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters) { + return putWithResponseAsync(resourceGroupName, resourceGuardsName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGuardResourceInner put( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters) { + return putAsync(resourceGroupName, resourceGuardsName, parameters).block(); + } + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse( + String resourceGroupName, String resourceGuardsName, ResourceGuardResourceInner parameters, Context context) { + return putWithResponseAsync(resourceGroupName, resourceGuardsName, parameters, context).block(); + } + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context); + } + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String resourceGuardsName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceGuardsName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGuardResourceInner getByResourceGroup(String resourceGroupName, String resourceGuardsName) { + return getByResourceGroupAsync(resourceGroupName, resourceGuardsName).block(); + } + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceGuardsName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceGuardsName, context).block(); + } + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context); + } + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceGuardsName) { + return deleteWithResponseAsync(resourceGroupName, resourceGuardsName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceGuardsName) { + deleteAsync(resourceGroupName, resourceGuardsName).block(); + } + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String resourceGuardsName, Context context) { + return deleteWithResponseAsync(resourceGroupName, resourceGuardsName, context).block(); + } + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .patch( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .patch( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + parameters, + accept, + context); + } + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono patchAsync( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters) { + return patchWithResponseAsync(resourceGroupName, resourceGuardsName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGuardResourceInner patch( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters) { + return patchAsync(resourceGroupName, resourceGuardsName, parameters).block(); + } + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchWithResponse( + String resourceGroupName, String resourceGuardsName, PatchResourceRequestInput parameters, Context context) { + return patchWithResponseAsync(resourceGroupName, resourceGuardsName, parameters, context).block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDisableSoftDeleteRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDisableSoftDeleteRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDisableSoftDeleteRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDisableSoftDeleteRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDisableSoftDeleteRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName) { + return new PagedFlux<>( + () -> getDisableSoftDeleteRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName), + nextLink -> getDisableSoftDeleteRequestsObjectsNextSinglePageAsync(nextLink)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDisableSoftDeleteRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedFlux<>( + () -> getDisableSoftDeleteRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName, context), + nextLink -> getDisableSoftDeleteRequestsObjectsNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + return new PagedIterable<>(getDisableSoftDeleteRequestsObjectsAsync(resourceGroupName, resourceGuardsName)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedIterable<>( + getDisableSoftDeleteRequestsObjectsAsync(resourceGroupName, resourceGuardsName, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteResourceGuardProxyRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDeleteResourceGuardProxyRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteResourceGuardProxyRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDeleteResourceGuardProxyRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDeleteResourceGuardProxyRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName) { + return new PagedFlux<>( + () -> getDeleteResourceGuardProxyRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName), + nextLink -> getDeleteResourceGuardProxyRequestsObjectsNextSinglePageAsync(nextLink)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDeleteResourceGuardProxyRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedFlux<>( + () -> + getDeleteResourceGuardProxyRequestsObjectsSinglePageAsync( + resourceGroupName, resourceGuardsName, context), + nextLink -> getDeleteResourceGuardProxyRequestsObjectsNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + return new PagedIterable<>( + getDeleteResourceGuardProxyRequestsObjectsAsync(resourceGroupName, resourceGuardsName)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedIterable<>( + getDeleteResourceGuardProxyRequestsObjectsAsync(resourceGroupName, resourceGuardsName, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupSecurityPinRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getBackupSecurityPinRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupSecurityPinRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getBackupSecurityPinRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getBackupSecurityPinRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName) { + return new PagedFlux<>( + () -> getBackupSecurityPinRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName), + nextLink -> getBackupSecurityPinRequestsObjectsNextSinglePageAsync(nextLink)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getBackupSecurityPinRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedFlux<>( + () -> getBackupSecurityPinRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName, context), + nextLink -> getBackupSecurityPinRequestsObjectsNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + return new PagedIterable<>(getBackupSecurityPinRequestsObjectsAsync(resourceGroupName, resourceGuardsName)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedIterable<>( + getBackupSecurityPinRequestsObjectsAsync(resourceGroupName, resourceGuardsName, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteProtectedItemRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDeleteProtectedItemRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteProtectedItemRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDeleteProtectedItemRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDeleteProtectedItemRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName) { + return new PagedFlux<>( + () -> getDeleteProtectedItemRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName), + nextLink -> getDeleteProtectedItemRequestsObjectsNextSinglePageAsync(nextLink)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDeleteProtectedItemRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedFlux<>( + () -> getDeleteProtectedItemRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName, context), + nextLink -> getDeleteProtectedItemRequestsObjectsNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + return new PagedIterable<>(getDeleteProtectedItemRequestsObjectsAsync(resourceGroupName, resourceGuardsName)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedIterable<>( + getDeleteProtectedItemRequestsObjectsAsync(resourceGroupName, resourceGuardsName, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectionPolicyRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getUpdateProtectionPolicyRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectionPolicyRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getUpdateProtectionPolicyRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getUpdateProtectionPolicyRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName) { + return new PagedFlux<>( + () -> getUpdateProtectionPolicyRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName), + nextLink -> getUpdateProtectionPolicyRequestsObjectsNextSinglePageAsync(nextLink)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getUpdateProtectionPolicyRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedFlux<>( + () -> + getUpdateProtectionPolicyRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName, context), + nextLink -> getUpdateProtectionPolicyRequestsObjectsNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + return new PagedIterable<>( + getUpdateProtectionPolicyRequestsObjectsAsync(resourceGroupName, resourceGuardsName)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedIterable<>( + getUpdateProtectionPolicyRequestsObjectsAsync(resourceGroupName, resourceGuardsName, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectedItemRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getUpdateProtectedItemRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectedItemRequestsObjectsSinglePageAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getUpdateProtectedItemRequestsObjects( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getUpdateProtectedItemRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName) { + return new PagedFlux<>( + () -> getUpdateProtectedItemRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName), + nextLink -> getUpdateProtectedItemRequestsObjectsNextSinglePageAsync(nextLink)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getUpdateProtectedItemRequestsObjectsAsync( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedFlux<>( + () -> getUpdateProtectedItemRequestsObjectsSinglePageAsync(resourceGroupName, resourceGuardsName, context), + nextLink -> getUpdateProtectedItemRequestsObjectsNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + return new PagedIterable<>(getUpdateProtectedItemRequestsObjectsAsync(resourceGroupName, resourceGuardsName)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + return new PagedIterable<>( + getUpdateProtectedItemRequestsObjectsAsync(resourceGroupName, resourceGuardsName, context)); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultDisableSoftDeleteRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDefaultDisableSoftDeleteRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultDisableSoftDeleteRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDefaultDisableSoftDeleteRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultDisableSoftDeleteRequestsObjectAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultDisableSoftDeleteRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DppBaseResourceInner getDefaultDisableSoftDeleteRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultDisableSoftDeleteRequestsObjectAsync(resourceGroupName, resourceGuardsName, requestName) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultDisableSoftDeleteRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + return getDefaultDisableSoftDeleteRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName, context) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultDeleteResourceGuardProxyRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDefaultDeleteResourceGuardProxyRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultDeleteResourceGuardProxyRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDefaultDeleteResourceGuardProxyRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultDeleteResourceGuardProxyRequestsObjectAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultDeleteResourceGuardProxyRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DppBaseResourceInner getDefaultDeleteResourceGuardProxyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultDeleteResourceGuardProxyRequestsObjectAsync(resourceGroupName, resourceGuardsName, requestName) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultDeleteResourceGuardProxyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + return getDefaultDeleteResourceGuardProxyRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName, context) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultBackupSecurityPinRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDefaultBackupSecurityPinRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultBackupSecurityPinRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDefaultBackupSecurityPinRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultBackupSecurityPinRequestsObjectAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultBackupSecurityPinRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DppBaseResourceInner getDefaultBackupSecurityPinRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultBackupSecurityPinRequestsObjectAsync(resourceGroupName, resourceGuardsName, requestName) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultBackupSecurityPinRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + return getDefaultBackupSecurityPinRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName, context) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultDeleteProtectedItemRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDefaultDeleteProtectedItemRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultDeleteProtectedItemRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDefaultDeleteProtectedItemRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultDeleteProtectedItemRequestsObjectAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultDeleteProtectedItemRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DppBaseResourceInner getDefaultDeleteProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultDeleteProtectedItemRequestsObjectAsync(resourceGroupName, resourceGuardsName, requestName) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultDeleteProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + return getDefaultDeleteProtectedItemRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName, context) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultUpdateProtectionPolicyRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDefaultUpdateProtectionPolicyRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultUpdateProtectionPolicyRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDefaultUpdateProtectionPolicyRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultUpdateProtectionPolicyRequestsObjectAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultUpdateProtectionPolicyRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DppBaseResourceInner getDefaultUpdateProtectionPolicyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultUpdateProtectionPolicyRequestsObjectAsync(resourceGroupName, resourceGuardsName, requestName) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultUpdateProtectionPolicyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + return getDefaultUpdateProtectionPolicyRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName, context) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultUpdateProtectedItemRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDefaultUpdateProtectedItemRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultUpdateProtectedItemRequestsObjectWithResponseAsync( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (resourceGuardsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGuardsName is required and cannot be null.")); + } + if (requestName == null) { + return Mono.error(new IllegalArgumentException("Parameter requestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDefaultUpdateProtectedItemRequestsObject( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceGroupName, + this.client.getSubscriptionId(), + resourceGuardsName, + requestName, + accept, + context); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultUpdateProtectedItemRequestsObjectAsync( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultUpdateProtectedItemRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DppBaseResourceInner getDefaultUpdateProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + return getDefaultUpdateProtectedItemRequestsObjectAsync(resourceGroupName, resourceGuardsName, requestName) + .block(); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultUpdateProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + return getDefaultUpdateProtectedItemRequestsObjectWithResponseAsync( + resourceGroupName, resourceGuardsName, requestName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourcesInSubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getResourcesInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourcesInSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getResourcesInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourcesInResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.getResourcesInResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list of ResourceGuard resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourcesInResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getResourcesInResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDisableSoftDeleteRequestsObjectsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDisableSoftDeleteRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDisableSoftDeleteRequestsObjectsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDisableSoftDeleteRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteResourceGuardProxyRequestsObjectsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDeleteResourceGuardProxyRequestsObjectsNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteResourceGuardProxyRequestsObjectsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDeleteResourceGuardProxyRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupSecurityPinRequestsObjectsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getBackupSecurityPinRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupSecurityPinRequestsObjectsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getBackupSecurityPinRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteProtectedItemRequestsObjectsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDeleteProtectedItemRequestsObjectsNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeleteProtectedItemRequestsObjectsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDeleteProtectedItemRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectionPolicyRequestsObjectsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getUpdateProtectionPolicyRequestsObjectsNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectionPolicyRequestsObjectsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getUpdateProtectionPolicyRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectedItemRequestsObjectsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getUpdateProtectedItemRequestsObjectsNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 base for all lists of V2 resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateProtectedItemRequestsObjectsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getUpdateProtectedItemRequestsObjectsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardsImpl.java new file mode 100644 index 0000000000000..6605f157778e0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceGuardsImpl.java @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.ResourceGuardsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner; +import com.azure.resourcemanager.dataprotection.models.DppBaseResource; +import com.azure.resourcemanager.dataprotection.models.ResourceGuardResource; +import com.azure.resourcemanager.dataprotection.models.ResourceGuards; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceGuardsImpl implements ResourceGuards { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGuardsImpl.class); + + private final ResourceGuardsClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public ResourceGuardsImpl( + ResourceGuardsClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceGuardResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourceGuardResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ResourceGuardResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ResourceGuardResourceImpl(inner1, this.manager())); + } + + public ResourceGuardResource getByResourceGroup(String resourceGroupName, String resourceGuardsName) { + ResourceGuardResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, resourceGuardsName); + if (inner != null) { + return new ResourceGuardResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceGuardsName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceGuardsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResourceGuardResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceGuardsName) { + this.serviceClient().delete(resourceGroupName, resourceGuardsName); + } + + public Response deleteWithResponse(String resourceGroupName, String resourceGuardsName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, resourceGuardsName, context); + } + + public PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + PagedIterable inner = + this.serviceClient().getDisableSoftDeleteRequestsObjects(resourceGroupName, resourceGuardsName); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + PagedIterable inner = + this.serviceClient().getDisableSoftDeleteRequestsObjects(resourceGroupName, resourceGuardsName, context); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + PagedIterable inner = + this.serviceClient().getDeleteResourceGuardProxyRequestsObjects(resourceGroupName, resourceGuardsName); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + PagedIterable inner = + this + .serviceClient() + .getDeleteResourceGuardProxyRequestsObjects(resourceGroupName, resourceGuardsName, context); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + PagedIterable inner = + this.serviceClient().getBackupSecurityPinRequestsObjects(resourceGroupName, resourceGuardsName); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + PagedIterable inner = + this.serviceClient().getBackupSecurityPinRequestsObjects(resourceGroupName, resourceGuardsName, context); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + PagedIterable inner = + this.serviceClient().getDeleteProtectedItemRequestsObjects(resourceGroupName, resourceGuardsName); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + PagedIterable inner = + this.serviceClient().getDeleteProtectedItemRequestsObjects(resourceGroupName, resourceGuardsName, context); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + PagedIterable inner = + this.serviceClient().getUpdateProtectionPolicyRequestsObjects(resourceGroupName, resourceGuardsName); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + PagedIterable inner = + this + .serviceClient() + .getUpdateProtectionPolicyRequestsObjects(resourceGroupName, resourceGuardsName, context); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName) { + PagedIterable inner = + this.serviceClient().getUpdateProtectedItemRequestsObjects(resourceGroupName, resourceGuardsName); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context) { + PagedIterable inner = + this.serviceClient().getUpdateProtectedItemRequestsObjects(resourceGroupName, resourceGuardsName, context); + return Utils.mapPage(inner, inner1 -> new DppBaseResourceImpl(inner1, this.manager())); + } + + public DppBaseResource getDefaultDisableSoftDeleteRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + DppBaseResourceInner inner = + this + .serviceClient() + .getDefaultDisableSoftDeleteRequestsObject(resourceGroupName, resourceGuardsName, requestName); + if (inner != null) { + return new DppBaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultDisableSoftDeleteRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + Response inner = + this + .serviceClient() + .getDefaultDisableSoftDeleteRequestsObjectWithResponse( + resourceGroupName, resourceGuardsName, requestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DppBaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DppBaseResource getDefaultDeleteResourceGuardProxyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + DppBaseResourceInner inner = + this + .serviceClient() + .getDefaultDeleteResourceGuardProxyRequestsObject(resourceGroupName, resourceGuardsName, requestName); + if (inner != null) { + return new DppBaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultDeleteResourceGuardProxyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + Response inner = + this + .serviceClient() + .getDefaultDeleteResourceGuardProxyRequestsObjectWithResponse( + resourceGroupName, resourceGuardsName, requestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DppBaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DppBaseResource getDefaultBackupSecurityPinRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + DppBaseResourceInner inner = + this + .serviceClient() + .getDefaultBackupSecurityPinRequestsObject(resourceGroupName, resourceGuardsName, requestName); + if (inner != null) { + return new DppBaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultBackupSecurityPinRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + Response inner = + this + .serviceClient() + .getDefaultBackupSecurityPinRequestsObjectWithResponse( + resourceGroupName, resourceGuardsName, requestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DppBaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DppBaseResource getDefaultDeleteProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + DppBaseResourceInner inner = + this + .serviceClient() + .getDefaultDeleteProtectedItemRequestsObject(resourceGroupName, resourceGuardsName, requestName); + if (inner != null) { + return new DppBaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultDeleteProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + Response inner = + this + .serviceClient() + .getDefaultDeleteProtectedItemRequestsObjectWithResponse( + resourceGroupName, resourceGuardsName, requestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DppBaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DppBaseResource getDefaultUpdateProtectionPolicyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + DppBaseResourceInner inner = + this + .serviceClient() + .getDefaultUpdateProtectionPolicyRequestsObject(resourceGroupName, resourceGuardsName, requestName); + if (inner != null) { + return new DppBaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultUpdateProtectionPolicyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + Response inner = + this + .serviceClient() + .getDefaultUpdateProtectionPolicyRequestsObjectWithResponse( + resourceGroupName, resourceGuardsName, requestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DppBaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DppBaseResource getDefaultUpdateProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName) { + DppBaseResourceInner inner = + this + .serviceClient() + .getDefaultUpdateProtectedItemRequestsObject(resourceGroupName, resourceGuardsName, requestName); + if (inner != null) { + return new DppBaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultUpdateProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context) { + Response inner = + this + .serviceClient() + .getDefaultUpdateProtectedItemRequestsObjectWithResponse( + resourceGroupName, resourceGuardsName, requestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DppBaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ResourceGuardResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGuardsName = Utils.getValueFromIdByName(id, "resourceGuards"); + if (resourceGuardsName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGuards'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceGuardsName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGuardsName = Utils.getValueFromIdByName(id, "resourceGuards"); + if (resourceGuardsName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGuards'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceGuardsName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGuardsName = Utils.getValueFromIdByName(id, "resourceGuards"); + if (resourceGuardsName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGuards'.", id))); + } + this.deleteWithResponse(resourceGroupName, resourceGuardsName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGuardsName = Utils.getValueFromIdByName(id, "resourceGuards"); + if (resourceGuardsName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGuards'.", id))); + } + return this.deleteWithResponse(resourceGroupName, resourceGuardsName, context); + } + + private ResourceGuardsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } + + public ResourceGuardResourceImpl define(String name) { + return new ResourceGuardResourceImpl(name, this.manager()); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RestorableTimeRangesClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RestorableTimeRangesClientImpl.java new file mode 100644 index 0000000000000..c020605b84404 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RestorableTimeRangesClientImpl.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.dataprotection.fluent.RestorableTimeRangesClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupFindRestorableTimeRangesResponseResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableTimeRangesClient. */ +public final class RestorableTimeRangesClientImpl implements RestorableTimeRangesClient { + private final ClientLogger logger = new ClientLogger(RestorableTimeRangesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableTimeRangesService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of RestorableTimeRangesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableTimeRangesClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy + .create(RestorableTimeRangesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientRestorableTimeRanges to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface RestorableTimeRangesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> find( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("vaultName") String vaultName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("backupInstanceName") String backupInstanceName, + @BodyParam("application/json") AzureBackupFindRestorableTimeRangesRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> findWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .find( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> findWithResponseAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (backupInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter backupInstanceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .find( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono findAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters) { + return findWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureBackupFindRestorableTimeRangesResponseResourceInner find( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters) { + return findAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block(); + } + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response findWithResponse( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters, + Context context) { + return findWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).block(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RestorableTimeRangesImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RestorableTimeRangesImpl.java new file mode 100644 index 0000000000000..9bba70072f7d0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RestorableTimeRangesImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.dataprotection.fluent.RestorableTimeRangesClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupFindRestorableTimeRangesResponseResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest; +import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource; +import com.azure.resourcemanager.dataprotection.models.RestorableTimeRanges; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableTimeRangesImpl implements RestorableTimeRanges { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableTimeRangesImpl.class); + + private final RestorableTimeRangesClient innerClient; + + private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager; + + public RestorableTimeRangesImpl( + RestorableTimeRangesClient innerClient, + com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AzureBackupFindRestorableTimeRangesResponseResource find( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters) { + AzureBackupFindRestorableTimeRangesResponseResourceInner inner = + this.serviceClient().find(vaultName, resourceGroupName, backupInstanceName, parameters); + if (inner != null) { + return new AzureBackupFindRestorableTimeRangesResponseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response findWithResponse( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters, + Context context) { + Response inner = + this + .serviceClient() + .findWithResponse(vaultName, resourceGroupName, backupInstanceName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureBackupFindRestorableTimeRangesResponseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RestorableTimeRangesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/Utils.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/Utils.java new file mode 100644 index 0000000000000..828dd229bf349 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, 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/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/package-info.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/package-info.java new file mode 100644 index 0000000000000..ff44e329d694f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for DataProtectionClient. Open API 2.0 Specs for Azure Data Protection + * service. + */ +package com.azure.resourcemanager.dataprotection.implementation; diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AbsoluteDeleteOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AbsoluteDeleteOption.java new file mode 100644 index 0000000000000..40c06dcc20097 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AbsoluteDeleteOption.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AbsoluteDeleteOption Delete option with duration. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AbsoluteDeleteOption") +@Fluent +public final class AbsoluteDeleteOption extends DeleteOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AbsoluteDeleteOption.class); + + /** {@inheritDoc} */ + @Override + public AbsoluteDeleteOption withDuration(String duration) { + super.withDuration(duration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AbsoluteMarker.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AbsoluteMarker.java new file mode 100644 index 0000000000000..57c1ff536962e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AbsoluteMarker.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AbsoluteMarker. */ +public final class AbsoluteMarker extends ExpandableStringEnum { + /** Static value AllBackup for AbsoluteMarker. */ + public static final AbsoluteMarker ALL_BACKUP = fromString("AllBackup"); + + /** Static value FirstOfDay for AbsoluteMarker. */ + public static final AbsoluteMarker FIRST_OF_DAY = fromString("FirstOfDay"); + + /** Static value FirstOfMonth for AbsoluteMarker. */ + public static final AbsoluteMarker FIRST_OF_MONTH = fromString("FirstOfMonth"); + + /** Static value FirstOfWeek for AbsoluteMarker. */ + public static final AbsoluteMarker FIRST_OF_WEEK = fromString("FirstOfWeek"); + + /** Static value FirstOfYear for AbsoluteMarker. */ + public static final AbsoluteMarker FIRST_OF_YEAR = fromString("FirstOfYear"); + + /** + * Creates or finds a AbsoluteMarker from its string representation. + * + * @param name a name to look for. + * @return the corresponding AbsoluteMarker. + */ + @JsonCreator + public static AbsoluteMarker fromString(String name) { + return fromString(name, AbsoluteMarker.class); + } + + /** @return known AbsoluteMarker values. */ + public static Collection values() { + return values(AbsoluteMarker.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdHocBackupRuleOptions.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdHocBackupRuleOptions.java new file mode 100644 index 0000000000000..7f5b684ce2524 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdHocBackupRuleOptions.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.dataprotection.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; + +/** AdHocBackupRuleOptions Adhoc backup rules. */ +@Fluent +public final class AdHocBackupRuleOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdHocBackupRuleOptions.class); + + /* + * The ruleName property. + */ + @JsonProperty(value = "ruleName", required = true) + private String ruleName; + + /* + * AdhocBackupTriggerOption Adhoc backup trigger option + */ + @JsonProperty(value = "triggerOption", required = true) + private AdhocBackupTriggerOption triggerOption; + + /** + * Get the ruleName property: The ruleName property. + * + * @return the ruleName value. + */ + public String ruleName() { + return this.ruleName; + } + + /** + * Set the ruleName property: The ruleName property. + * + * @param ruleName the ruleName value to set. + * @return the AdHocBackupRuleOptions object itself. + */ + public AdHocBackupRuleOptions withRuleName(String ruleName) { + this.ruleName = ruleName; + return this; + } + + /** + * Get the triggerOption property: AdhocBackupTriggerOption Adhoc backup trigger option. + * + * @return the triggerOption value. + */ + public AdhocBackupTriggerOption triggerOption() { + return this.triggerOption; + } + + /** + * Set the triggerOption property: AdhocBackupTriggerOption Adhoc backup trigger option. + * + * @param triggerOption the triggerOption value to set. + * @return the AdHocBackupRuleOptions object itself. + */ + public AdHocBackupRuleOptions withTriggerOption(AdhocBackupTriggerOption triggerOption) { + this.triggerOption = triggerOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property ruleName in model AdHocBackupRuleOptions")); + } + if (triggerOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property triggerOption in model AdHocBackupRuleOptions")); + } else { + triggerOption().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBackupTriggerOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBackupTriggerOption.java new file mode 100644 index 0000000000000..711b8b4c5b121 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBackupTriggerOption.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.dataprotection.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; + +/** AdhocBackupTriggerOption Adhoc backup trigger option. */ +@Fluent +public final class AdhocBackupTriggerOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdhocBackupTriggerOption.class); + + /* + * The retentionTagOverride property. + */ + @JsonProperty(value = "retentionTagOverride") + private String retentionTagOverride; + + /** + * Get the retentionTagOverride property: The retentionTagOverride property. + * + * @return the retentionTagOverride value. + */ + public String retentionTagOverride() { + return this.retentionTagOverride; + } + + /** + * Set the retentionTagOverride property: The retentionTagOverride property. + * + * @param retentionTagOverride the retentionTagOverride value to set. + * @return the AdhocBackupTriggerOption object itself. + */ + public AdhocBackupTriggerOption withRetentionTagOverride(String retentionTagOverride) { + this.retentionTagOverride = retentionTagOverride; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTaggingCriteria.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTaggingCriteria.java new file mode 100644 index 0000000000000..9b1cb6c1c8eae --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTaggingCriteria.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** AdhocBasedTaggingCriteria Adhoc backup tagging criteria. */ +@Fluent +public final class AdhocBasedTaggingCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdhocBasedTaggingCriteria.class); + + /* + * RetentionTag Retention tag information + */ + @JsonProperty(value = "tagInfo") + private RetentionTag tagInfo; + + /** + * Get the tagInfo property: RetentionTag Retention tag information. + * + * @return the tagInfo value. + */ + public RetentionTag tagInfo() { + return this.tagInfo; + } + + /** + * Set the tagInfo property: RetentionTag Retention tag information. + * + * @param tagInfo the tagInfo value to set. + * @return the AdhocBasedTaggingCriteria object itself. + */ + public AdhocBasedTaggingCriteria withTagInfo(RetentionTag tagInfo) { + this.tagInfo = tagInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tagInfo() != null) { + tagInfo().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTriggerContext.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTriggerContext.java new file mode 100644 index 0000000000000..d070b54c6dfa7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTriggerContext.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AdhocBasedTriggerContext Adhoc trigger context. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AdhocBasedTriggerContext") +@Fluent +public final class AdhocBasedTriggerContext extends TriggerContext { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdhocBasedTriggerContext.class); + + /* + * AdhocBasedTaggingCriteria Tagging Criteria containing retention tag for + * adhoc backup. + */ + @JsonProperty(value = "taggingCriteria", required = true) + private AdhocBasedTaggingCriteria taggingCriteria; + + /** + * Get the taggingCriteria property: AdhocBasedTaggingCriteria Tagging Criteria containing retention tag for adhoc + * backup. + * + * @return the taggingCriteria value. + */ + public AdhocBasedTaggingCriteria taggingCriteria() { + return this.taggingCriteria; + } + + /** + * Set the taggingCriteria property: AdhocBasedTaggingCriteria Tagging Criteria containing retention tag for adhoc + * backup. + * + * @param taggingCriteria the taggingCriteria value to set. + * @return the AdhocBasedTriggerContext object itself. + */ + public AdhocBasedTriggerContext withTaggingCriteria(AdhocBasedTaggingCriteria taggingCriteria) { + this.taggingCriteria = taggingCriteria; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (taggingCriteria() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property taggingCriteria in model AdhocBasedTriggerContext")); + } else { + taggingCriteria().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AuthCredentials.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AuthCredentials.java new file mode 100644 index 0000000000000..a2cd8f6bef480 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AuthCredentials.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Base class for different types of authentication credentials. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = AuthCredentials.class) +@JsonTypeName("AuthCredentials") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SecretStoreBasedAuthCredentials", value = SecretStoreBasedAuthCredentials.class) +}) +@Immutable +public class AuthCredentials { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AuthCredentials.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupDiscreteRecoveryPoint.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupDiscreteRecoveryPoint.java new file mode 100644 index 0000000000000..2565d2a1d2450 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupDiscreteRecoveryPoint.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.List; + +/** AzureBackupDiscreteRecoveryPoint Azure backup discrete RecoveryPoint. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureBackupDiscreteRecoveryPoint") +@Fluent +public final class AzureBackupDiscreteRecoveryPoint extends AzureBackupRecoveryPoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupDiscreteRecoveryPoint.class); + + /* + * The friendlyName property. + */ + @JsonProperty(value = "friendlyName") + private String friendlyName; + + /* + * The recoveryPointDataStoresDetails property. + */ + @JsonProperty(value = "recoveryPointDataStoresDetails") + private List recoveryPointDataStoresDetails; + + /* + * The recoveryPointTime property. + */ + @JsonProperty(value = "recoveryPointTime", required = true) + private OffsetDateTime recoveryPointTime; + + /* + * The policyName property. + */ + @JsonProperty(value = "policyName") + private String policyName; + + /* + * The policyVersion property. + */ + @JsonProperty(value = "policyVersion") + private String policyVersion; + + /* + * The recoveryPointId property. + */ + @JsonProperty(value = "recoveryPointId") + private String recoveryPointId; + + /* + * The recoveryPointType property. + */ + @JsonProperty(value = "recoveryPointType") + private String recoveryPointType; + + /* + * The retentionTagName property. + */ + @JsonProperty(value = "retentionTagName") + private String retentionTagName; + + /* + * The retentionTagVersion property. + */ + @JsonProperty(value = "retentionTagVersion") + private String retentionTagVersion; + + /** + * Get the friendlyName property: The friendlyName property. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: The friendlyName property. + * + * @param friendlyName the friendlyName value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the recoveryPointDataStoresDetails property: The recoveryPointDataStoresDetails property. + * + * @return the recoveryPointDataStoresDetails value. + */ + public List recoveryPointDataStoresDetails() { + return this.recoveryPointDataStoresDetails; + } + + /** + * Set the recoveryPointDataStoresDetails property: The recoveryPointDataStoresDetails property. + * + * @param recoveryPointDataStoresDetails the recoveryPointDataStoresDetails value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withRecoveryPointDataStoresDetails( + List recoveryPointDataStoresDetails) { + this.recoveryPointDataStoresDetails = recoveryPointDataStoresDetails; + return this; + } + + /** + * Get the recoveryPointTime property: The recoveryPointTime property. + * + * @return the recoveryPointTime value. + */ + public OffsetDateTime recoveryPointTime() { + return this.recoveryPointTime; + } + + /** + * Set the recoveryPointTime property: The recoveryPointTime property. + * + * @param recoveryPointTime the recoveryPointTime value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withRecoveryPointTime(OffsetDateTime recoveryPointTime) { + this.recoveryPointTime = recoveryPointTime; + return this; + } + + /** + * Get the policyName property: The policyName property. + * + * @return the policyName value. + */ + public String policyName() { + return this.policyName; + } + + /** + * Set the policyName property: The policyName property. + * + * @param policyName the policyName value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withPolicyName(String policyName) { + this.policyName = policyName; + return this; + } + + /** + * Get the policyVersion property: The policyVersion property. + * + * @return the policyVersion value. + */ + public String policyVersion() { + return this.policyVersion; + } + + /** + * Set the policyVersion property: The policyVersion property. + * + * @param policyVersion the policyVersion value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withPolicyVersion(String policyVersion) { + this.policyVersion = policyVersion; + return this; + } + + /** + * Get the recoveryPointId property: The recoveryPointId property. + * + * @return the recoveryPointId value. + */ + public String recoveryPointId() { + return this.recoveryPointId; + } + + /** + * Set the recoveryPointId property: The recoveryPointId property. + * + * @param recoveryPointId the recoveryPointId value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withRecoveryPointId(String recoveryPointId) { + this.recoveryPointId = recoveryPointId; + return this; + } + + /** + * Get the recoveryPointType property: The recoveryPointType property. + * + * @return the recoveryPointType value. + */ + public String recoveryPointType() { + return this.recoveryPointType; + } + + /** + * Set the recoveryPointType property: The recoveryPointType property. + * + * @param recoveryPointType the recoveryPointType value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withRecoveryPointType(String recoveryPointType) { + this.recoveryPointType = recoveryPointType; + return this; + } + + /** + * Get the retentionTagName property: The retentionTagName property. + * + * @return the retentionTagName value. + */ + public String retentionTagName() { + return this.retentionTagName; + } + + /** + * Set the retentionTagName property: The retentionTagName property. + * + * @param retentionTagName the retentionTagName value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withRetentionTagName(String retentionTagName) { + this.retentionTagName = retentionTagName; + return this; + } + + /** + * Get the retentionTagVersion property: The retentionTagVersion property. + * + * @return the retentionTagVersion value. + */ + public String retentionTagVersion() { + return this.retentionTagVersion; + } + + /** + * Set the retentionTagVersion property: The retentionTagVersion property. + * + * @param retentionTagVersion the retentionTagVersion value to set. + * @return the AzureBackupDiscreteRecoveryPoint object itself. + */ + public AzureBackupDiscreteRecoveryPoint withRetentionTagVersion(String retentionTagVersion) { + this.retentionTagVersion = retentionTagVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (recoveryPointDataStoresDetails() != null) { + recoveryPointDataStoresDetails().forEach(e -> e.validate()); + } + if (recoveryPointTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recoveryPointTime in model AzureBackupDiscreteRecoveryPoint")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesRequest.java new file mode 100644 index 0000000000000..2d2a4f238f079 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesRequest.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** List Restore Ranges Request. */ +@Fluent +public final class AzureBackupFindRestorableTimeRangesRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupFindRestorableTimeRangesRequest.class); + + /* + * Gets or sets the type of the source data store. + */ + @JsonProperty(value = "sourceDataStoreType", required = true) + private RestoreSourceDataStoreType sourceDataStoreType; + + /* + * Start time for the List Restore Ranges request. ISO 8601 format. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * End time for the List Restore Ranges request. ISO 8601 format. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /** + * Get the sourceDataStoreType property: Gets or sets the type of the source data store. + * + * @return the sourceDataStoreType value. + */ + public RestoreSourceDataStoreType sourceDataStoreType() { + return this.sourceDataStoreType; + } + + /** + * Set the sourceDataStoreType property: Gets or sets the type of the source data store. + * + * @param sourceDataStoreType the sourceDataStoreType value to set. + * @return the AzureBackupFindRestorableTimeRangesRequest object itself. + */ + public AzureBackupFindRestorableTimeRangesRequest withSourceDataStoreType( + RestoreSourceDataStoreType sourceDataStoreType) { + this.sourceDataStoreType = sourceDataStoreType; + return this; + } + + /** + * Get the startTime property: Start time for the List Restore Ranges request. ISO 8601 format. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time for the List Restore Ranges request. ISO 8601 format. + * + * @param startTime the startTime value to set. + * @return the AzureBackupFindRestorableTimeRangesRequest object itself. + */ + public AzureBackupFindRestorableTimeRangesRequest withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time for the List Restore Ranges request. ISO 8601 format. + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time for the List Restore Ranges request. ISO 8601 format. + * + * @param endTime the endTime value to set. + * @return the AzureBackupFindRestorableTimeRangesRequest object itself. + */ + public AzureBackupFindRestorableTimeRangesRequest withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceDataStoreType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceDataStoreType in model" + + " AzureBackupFindRestorableTimeRangesRequest")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesRequestResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesRequestResource.java new file mode 100644 index 0000000000000..143f9a904f524 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesRequestResource.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** List Restore Ranges Request. */ +@Fluent +public final class AzureBackupFindRestorableTimeRangesRequestResource extends DppWorkerRequest { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(AzureBackupFindRestorableTimeRangesRequestResource.class); + + /* + * AzureBackupFindRestorableTimeRangesRequestResource content + */ + @JsonProperty(value = "content") + private AzureBackupFindRestorableTimeRangesRequest content; + + /** + * Get the content property: AzureBackupFindRestorableTimeRangesRequestResource content. + * + * @return the content value. + */ + public AzureBackupFindRestorableTimeRangesRequest content() { + return this.content; + } + + /** + * Set the content property: AzureBackupFindRestorableTimeRangesRequestResource content. + * + * @param content the content value to set. + * @return the AzureBackupFindRestorableTimeRangesRequestResource object itself. + */ + public AzureBackupFindRestorableTimeRangesRequestResource withContent( + AzureBackupFindRestorableTimeRangesRequest content) { + this.content = content; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withSubscriptionId(String subscriptionId) { + super.withSubscriptionId(subscriptionId); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withUri(String uri) { + super.withUri(uri); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withHeaders(Map> headers) { + super.withHeaders(headers); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withSupportedGroupVersions( + List supportedGroupVersions) { + super.withSupportedGroupVersions(supportedGroupVersions); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withCultureInfo(String cultureInfo) { + super.withCultureInfo(cultureInfo); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withParameters(Map parameters) { + super.withParameters(parameters); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupFindRestorableTimeRangesRequestResource withHttpMethod(String httpMethod) { + super.withHttpMethod(httpMethod); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (content() != null) { + content().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesResponse.java new file mode 100644 index 0000000000000..44b70e9bb782b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List Restore Ranges Response. */ +@Fluent +public final class AzureBackupFindRestorableTimeRangesResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupFindRestorableTimeRangesResponse.class); + + /* + * Returns the Restore Ranges available on the Backup Instance. + */ + @JsonProperty(value = "restorableTimeRanges") + private List restorableTimeRanges; + + /* + * The objectType property. + */ + @JsonProperty(value = "objectType") + private String objectType; + + /** + * Get the restorableTimeRanges property: Returns the Restore Ranges available on the Backup Instance. + * + * @return the restorableTimeRanges value. + */ + public List restorableTimeRanges() { + return this.restorableTimeRanges; + } + + /** + * Set the restorableTimeRanges property: Returns the Restore Ranges available on the Backup Instance. + * + * @param restorableTimeRanges the restorableTimeRanges value to set. + * @return the AzureBackupFindRestorableTimeRangesResponse object itself. + */ + public AzureBackupFindRestorableTimeRangesResponse withRestorableTimeRanges( + List restorableTimeRanges) { + this.restorableTimeRanges = restorableTimeRanges; + return this; + } + + /** + * Get the objectType property: The objectType property. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: The objectType property. + * + * @param objectType the objectType value to set. + * @return the AzureBackupFindRestorableTimeRangesResponse object itself. + */ + public AzureBackupFindRestorableTimeRangesResponse withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restorableTimeRanges() != null) { + restorableTimeRanges().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesResponseResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesResponseResource.java new file mode 100644 index 0000000000000..6bf12d32f5a02 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupFindRestorableTimeRangesResponseResource.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.dataprotection.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupFindRestorableTimeRangesResponseResourceInner; + +/** An immutable client-side representation of AzureBackupFindRestorableTimeRangesResponseResource. */ +public interface AzureBackupFindRestorableTimeRangesResponseResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: AzureBackupFindRestorableTimeRangesResponseResource properties. + * + * @return the properties value. + */ + AzureBackupFindRestorableTimeRangesResponse properties(); + + /** + * Gets the inner + * com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupFindRestorableTimeRangesResponseResourceInner + * object. + * + * @return the inner object. + */ + AzureBackupFindRestorableTimeRangesResponseResourceInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJob.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJob.java new file mode 100644 index 0000000000000..1851cce68605d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJob.java @@ -0,0 +1,809 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** AzureBackup Job Class. */ +@Fluent +public final class AzureBackupJob { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupJob.class); + + /* + * Job Activity Id + */ + @JsonProperty(value = "activityID", required = true) + private String activityId; + + /* + * Name of the Backup Instance + */ + @JsonProperty(value = "backupInstanceFriendlyName", required = true) + private String backupInstanceFriendlyName; + + /* + * ARM ID of the Backup Instance + */ + @JsonProperty(value = "backupInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String backupInstanceId; + + /* + * ARM ID of the DataSource + */ + @JsonProperty(value = "dataSourceId", required = true) + private String dataSourceId; + + /* + * Location of the DataSource + */ + @JsonProperty(value = "dataSourceLocation", required = true) + private String dataSourceLocation; + + /* + * User Friendly Name of the DataSource + */ + @JsonProperty(value = "dataSourceName", required = true) + private String dataSourceName; + + /* + * Data Source Set Name of the DataSource + */ + @JsonProperty(value = "dataSourceSetName") + private String dataSourceSetName; + + /* + * Type of DataSource + */ + @JsonProperty(value = "dataSourceType", required = true) + private String dataSourceType; + + /* + * Total run time of the job. ISO 8601 format. + */ + @JsonProperty(value = "duration") + private String duration; + + /* + * EndTime of the job(in UTC) + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * A List, detailing the errors related to the job + */ + @JsonProperty(value = "errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private List errorDetails; + + /* + * Extended Information about the job + */ + @JsonProperty(value = "extendedInfo", access = JsonProperty.Access.WRITE_ONLY) + private JobExtendedInfo extendedInfo; + + /* + * Indicated that whether the job is adhoc(true) or scheduled(false) + */ + @JsonProperty(value = "isUserTriggered", required = true) + private boolean isUserTriggered; + + /* + * It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; + * Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /* + * It indicates the type of Job i.e. Backup/Restore/Tiering/Management + */ + @JsonProperty(value = "operationCategory", required = true) + private String operationCategory; + + /* + * ARM ID of the policy + */ + @JsonProperty(value = "policyId", access = JsonProperty.Access.WRITE_ONLY) + private String policyId; + + /* + * Name of the policy + */ + @JsonProperty(value = "policyName", access = JsonProperty.Access.WRITE_ONLY) + private String policyName; + + /* + * Indicated whether progress is enabled for the job + */ + @JsonProperty(value = "progressEnabled", required = true) + private boolean progressEnabled; + + /* + * Url which contains job's progress + */ + @JsonProperty(value = "progressUrl", access = JsonProperty.Access.WRITE_ONLY) + private String progressUrl; + + /* + * It indicates the sub type of operation i.e. in case of Restore it can be + * ALR/OLR + */ + @JsonProperty(value = "restoreType", access = JsonProperty.Access.WRITE_ONLY) + private String restoreType; + + /* + * Resource Group Name of the Datasource + */ + @JsonProperty(value = "sourceResourceGroup", required = true) + private String sourceResourceGroup; + + /* + * SubscriptionId corresponding to the DataSource + */ + @JsonProperty(value = "sourceSubscriptionID", required = true) + private String sourceSubscriptionId; + + /* + * StartTime of the job(in UTC) + */ + @JsonProperty(value = "startTime", required = true) + private OffsetDateTime startTime; + + /* + * Status of the job like + * InProgress/Success/Failed/Cancelled/SuccessWithWarning + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * Subscription Id of the corresponding backup vault + */ + @JsonProperty(value = "subscriptionId", required = true) + private String subscriptionId; + + /* + * List of supported actions + */ + @JsonProperty(value = "supportedActions", required = true) + private List supportedActions; + + /* + * Name of the vault + */ + @JsonProperty(value = "vaultName", required = true) + private String vaultName; + + /* + * The etag property. + */ + @JsonProperty(value = "etag") + private String etag; + + /* + * The sourceDataStoreName property. + */ + @JsonProperty(value = "sourceDataStoreName") + private String sourceDataStoreName; + + /* + * The destinationDataStoreName property. + */ + @JsonProperty(value = "destinationDataStoreName") + private String destinationDataStoreName; + + /** + * Get the activityId property: Job Activity Id. + * + * @return the activityId value. + */ + public String activityId() { + return this.activityId; + } + + /** + * Set the activityId property: Job Activity Id. + * + * @param activityId the activityId value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withActivityId(String activityId) { + this.activityId = activityId; + return this; + } + + /** + * Get the backupInstanceFriendlyName property: Name of the Backup Instance. + * + * @return the backupInstanceFriendlyName value. + */ + public String backupInstanceFriendlyName() { + return this.backupInstanceFriendlyName; + } + + /** + * Set the backupInstanceFriendlyName property: Name of the Backup Instance. + * + * @param backupInstanceFriendlyName the backupInstanceFriendlyName value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withBackupInstanceFriendlyName(String backupInstanceFriendlyName) { + this.backupInstanceFriendlyName = backupInstanceFriendlyName; + return this; + } + + /** + * Get the backupInstanceId property: ARM ID of the Backup Instance. + * + * @return the backupInstanceId value. + */ + public String backupInstanceId() { + return this.backupInstanceId; + } + + /** + * Get the dataSourceId property: ARM ID of the DataSource. + * + * @return the dataSourceId value. + */ + public String dataSourceId() { + return this.dataSourceId; + } + + /** + * Set the dataSourceId property: ARM ID of the DataSource. + * + * @param dataSourceId the dataSourceId value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDataSourceId(String dataSourceId) { + this.dataSourceId = dataSourceId; + return this; + } + + /** + * Get the dataSourceLocation property: Location of the DataSource. + * + * @return the dataSourceLocation value. + */ + public String dataSourceLocation() { + return this.dataSourceLocation; + } + + /** + * Set the dataSourceLocation property: Location of the DataSource. + * + * @param dataSourceLocation the dataSourceLocation value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDataSourceLocation(String dataSourceLocation) { + this.dataSourceLocation = dataSourceLocation; + return this; + } + + /** + * Get the dataSourceName property: User Friendly Name of the DataSource. + * + * @return the dataSourceName value. + */ + public String dataSourceName() { + return this.dataSourceName; + } + + /** + * Set the dataSourceName property: User Friendly Name of the DataSource. + * + * @param dataSourceName the dataSourceName value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDataSourceName(String dataSourceName) { + this.dataSourceName = dataSourceName; + return this; + } + + /** + * Get the dataSourceSetName property: Data Source Set Name of the DataSource. + * + * @return the dataSourceSetName value. + */ + public String dataSourceSetName() { + return this.dataSourceSetName; + } + + /** + * Set the dataSourceSetName property: Data Source Set Name of the DataSource. + * + * @param dataSourceSetName the dataSourceSetName value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDataSourceSetName(String dataSourceSetName) { + this.dataSourceSetName = dataSourceSetName; + return this; + } + + /** + * Get the dataSourceType property: Type of DataSource. + * + * @return the dataSourceType value. + */ + public String dataSourceType() { + return this.dataSourceType; + } + + /** + * Set the dataSourceType property: Type of DataSource. + * + * @param dataSourceType the dataSourceType value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDataSourceType(String dataSourceType) { + this.dataSourceType = dataSourceType; + return this; + } + + /** + * Get the duration property: Total run time of the job. ISO 8601 format. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: Total run time of the job. ISO 8601 format. + * + * @param duration the duration value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDuration(String duration) { + this.duration = duration; + return this; + } + + /** + * Get the endTime property: EndTime of the job(in UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errorDetails property: A List, detailing the errors related to the job. + * + * @return the errorDetails value. + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * Get the extendedInfo property: Extended Information about the job. + * + * @return the extendedInfo value. + */ + public JobExtendedInfo extendedInfo() { + return this.extendedInfo; + } + + /** + * Get the isUserTriggered property: Indicated that whether the job is adhoc(true) or scheduled(false). + * + * @return the isUserTriggered value. + */ + public boolean isUserTriggered() { + return this.isUserTriggered; + } + + /** + * Set the isUserTriggered property: Indicated that whether the job is adhoc(true) or scheduled(false). + * + * @param isUserTriggered the isUserTriggered value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withIsUserTriggered(boolean isUserTriggered) { + this.isUserTriggered = isUserTriggered; + return this; + } + + /** + * Get the operation property: It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; + * Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; + * Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. + * + * @param operation the operation value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the operationCategory property: It indicates the type of Job i.e. Backup/Restore/Tiering/Management. + * + * @return the operationCategory value. + */ + public String operationCategory() { + return this.operationCategory; + } + + /** + * Set the operationCategory property: It indicates the type of Job i.e. Backup/Restore/Tiering/Management. + * + * @param operationCategory the operationCategory value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withOperationCategory(String operationCategory) { + this.operationCategory = operationCategory; + return this; + } + + /** + * Get the policyId property: ARM ID of the policy. + * + * @return the policyId value. + */ + public String policyId() { + return this.policyId; + } + + /** + * Get the policyName property: Name of the policy. + * + * @return the policyName value. + */ + public String policyName() { + return this.policyName; + } + + /** + * Get the progressEnabled property: Indicated whether progress is enabled for the job. + * + * @return the progressEnabled value. + */ + public boolean progressEnabled() { + return this.progressEnabled; + } + + /** + * Set the progressEnabled property: Indicated whether progress is enabled for the job. + * + * @param progressEnabled the progressEnabled value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withProgressEnabled(boolean progressEnabled) { + this.progressEnabled = progressEnabled; + return this; + } + + /** + * Get the progressUrl property: Url which contains job's progress. + * + * @return the progressUrl value. + */ + public String progressUrl() { + return this.progressUrl; + } + + /** + * Get the restoreType property: It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR. + * + * @return the restoreType value. + */ + public String restoreType() { + return this.restoreType; + } + + /** + * Get the sourceResourceGroup property: Resource Group Name of the Datasource. + * + * @return the sourceResourceGroup value. + */ + public String sourceResourceGroup() { + return this.sourceResourceGroup; + } + + /** + * Set the sourceResourceGroup property: Resource Group Name of the Datasource. + * + * @param sourceResourceGroup the sourceResourceGroup value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withSourceResourceGroup(String sourceResourceGroup) { + this.sourceResourceGroup = sourceResourceGroup; + return this; + } + + /** + * Get the sourceSubscriptionId property: SubscriptionId corresponding to the DataSource. + * + * @return the sourceSubscriptionId value. + */ + public String sourceSubscriptionId() { + return this.sourceSubscriptionId; + } + + /** + * Set the sourceSubscriptionId property: SubscriptionId corresponding to the DataSource. + * + * @param sourceSubscriptionId the sourceSubscriptionId value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withSourceSubscriptionId(String sourceSubscriptionId) { + this.sourceSubscriptionId = sourceSubscriptionId; + return this; + } + + /** + * Get the startTime property: StartTime of the job(in UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: StartTime of the job(in UTC). + * + * @param startTime the startTime value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the status property: Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. + * + * @param status the status value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the subscriptionId property: Subscription Id of the corresponding backup vault. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription Id of the corresponding backup vault. + * + * @param subscriptionId the subscriptionId value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the supportedActions property: List of supported actions. + * + * @return the supportedActions value. + */ + public List supportedActions() { + return this.supportedActions; + } + + /** + * Set the supportedActions property: List of supported actions. + * + * @param supportedActions the supportedActions value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withSupportedActions(List supportedActions) { + this.supportedActions = supportedActions; + return this; + } + + /** + * Get the vaultName property: Name of the vault. + * + * @return the vaultName value. + */ + public String vaultName() { + return this.vaultName; + } + + /** + * Set the vaultName property: Name of the vault. + * + * @param vaultName the vaultName value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withVaultName(String vaultName) { + this.vaultName = vaultName; + return this; + } + + /** + * Get the etag property: The etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The etag property. + * + * @param etag the etag value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the sourceDataStoreName property: The sourceDataStoreName property. + * + * @return the sourceDataStoreName value. + */ + public String sourceDataStoreName() { + return this.sourceDataStoreName; + } + + /** + * Set the sourceDataStoreName property: The sourceDataStoreName property. + * + * @param sourceDataStoreName the sourceDataStoreName value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withSourceDataStoreName(String sourceDataStoreName) { + this.sourceDataStoreName = sourceDataStoreName; + return this; + } + + /** + * Get the destinationDataStoreName property: The destinationDataStoreName property. + * + * @return the destinationDataStoreName value. + */ + public String destinationDataStoreName() { + return this.destinationDataStoreName; + } + + /** + * Set the destinationDataStoreName property: The destinationDataStoreName property. + * + * @param destinationDataStoreName the destinationDataStoreName value to set. + * @return the AzureBackupJob object itself. + */ + public AzureBackupJob withDestinationDataStoreName(String destinationDataStoreName) { + this.destinationDataStoreName = destinationDataStoreName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (activityId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property activityId in model AzureBackupJob")); + } + if (backupInstanceFriendlyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property backupInstanceFriendlyName in model AzureBackupJob")); + } + if (dataSourceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataSourceId in model AzureBackupJob")); + } + if (dataSourceLocation() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dataSourceLocation in model AzureBackupJob")); + } + if (dataSourceName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataSourceName in model AzureBackupJob")); + } + if (dataSourceType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataSourceType in model AzureBackupJob")); + } + if (errorDetails() != null) { + errorDetails().forEach(e -> e.validate()); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (operation() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property operation in model AzureBackupJob")); + } + if (operationCategory() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operationCategory in model AzureBackupJob")); + } + if (sourceResourceGroup() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceResourceGroup in model AzureBackupJob")); + } + if (sourceSubscriptionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceSubscriptionId in model AzureBackupJob")); + } + if (startTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property startTime in model AzureBackupJob")); + } + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property status in model AzureBackupJob")); + } + if (subscriptionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property subscriptionId in model AzureBackupJob")); + } + if (supportedActions() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property supportedActions in model AzureBackupJob")); + } + if (vaultName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property vaultName in model AzureBackupJob")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResource.java new file mode 100644 index 0000000000000..3132c1ad86450 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResource.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; + +/** An immutable client-side representation of AzureBackupJobResource. */ +public interface AzureBackupJobResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: AzureBackupJobResource properties. + * + * @return the properties value. + */ + AzureBackupJob properties(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner object. + * + * @return the inner object. + */ + AzureBackupJobResourceInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResourceList.java new file mode 100644 index 0000000000000..5e07952c798fb --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResourceList.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of AzureBackup Job resources. */ +@Fluent +public final class AzureBackupJobResourceList extends DppResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupJobResourceList.class); + + /* + * List of resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources. + * + * @param value the value value to set. + * @return the AzureBackupJobResourceList object itself. + */ + public AzureBackupJobResourceList withValue(List value) { + this.value = value; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupJobResourceList withNextLink(String nextLink) { + super.withNextLink(nextLink); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupParams.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupParams.java new file mode 100644 index 0000000000000..02bfa0b4fd1fb --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupParams.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupParams Azure backup parameters. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureBackupParams") +@Fluent +public final class AzureBackupParams extends BackupParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupParams.class); + + /* + * BackupType ; Full/Incremental etc + */ + @JsonProperty(value = "backupType", required = true) + private String backupType; + + /** + * Get the backupType property: BackupType ; Full/Incremental etc. + * + * @return the backupType value. + */ + public String backupType() { + return this.backupType; + } + + /** + * Set the backupType property: BackupType ; Full/Incremental etc. + * + * @param backupType the backupType value to set. + * @return the AzureBackupParams object itself. + */ + public AzureBackupParams withBackupType(String backupType) { + this.backupType = backupType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (backupType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property backupType in model AzureBackupParams")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPoint.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPoint.java new file mode 100644 index 0000000000000..91d964de7f85c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPoint.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupRecoveryPoint Azure backup recoveryPoint. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = AzureBackupRecoveryPoint.class) +@JsonTypeName("AzureBackupRecoveryPoint") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AzureBackupDiscreteRecoveryPoint", value = AzureBackupDiscreteRecoveryPoint.class) +}) +@Immutable +public class AzureBackupRecoveryPoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRecoveryPoint.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointBasedRestoreRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointBasedRestoreRequest.java new file mode 100644 index 0000000000000..f38bb4427d135 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointBasedRestoreRequest.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupRecoveryPointBasedRestoreRequest Azure backup recoveryPoint based restore request. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = AzureBackupRecoveryPointBasedRestoreRequest.class) +@JsonTypeName("AzureBackupRecoveryPointBasedRestoreRequest") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "AzureBackupRestoreWithRehydrationRequest", + value = AzureBackupRestoreWithRehydrationRequest.class) +}) +@Fluent +public class AzureBackupRecoveryPointBasedRestoreRequest extends AzureBackupRestoreRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRecoveryPointBasedRestoreRequest.class); + + /* + * The recoveryPointId property. + */ + @JsonProperty(value = "recoveryPointId", required = true) + private String recoveryPointId; + + /** + * Get the recoveryPointId property: The recoveryPointId property. + * + * @return the recoveryPointId value. + */ + public String recoveryPointId() { + return this.recoveryPointId; + } + + /** + * Set the recoveryPointId property: The recoveryPointId property. + * + * @param recoveryPointId the recoveryPointId value to set. + * @return the AzureBackupRecoveryPointBasedRestoreRequest object itself. + */ + public AzureBackupRecoveryPointBasedRestoreRequest withRecoveryPointId(String recoveryPointId) { + this.recoveryPointId = recoveryPointId; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRecoveryPointBasedRestoreRequest withRestoreTargetInfo(RestoreTargetInfoBase restoreTargetInfo) { + super.withRestoreTargetInfo(restoreTargetInfo); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRecoveryPointBasedRestoreRequest withSourceDataStoreType( + SourceDataStoreType sourceDataStoreType) { + super.withSourceDataStoreType(sourceDataStoreType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (recoveryPointId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recoveryPointId in model" + + " AzureBackupRecoveryPointBasedRestoreRequest")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResource.java new file mode 100644 index 0000000000000..847adb60b9af1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResource.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.dataprotection.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; + +/** An immutable client-side representation of AzureBackupRecoveryPointResource. */ +public interface AzureBackupRecoveryPointResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: AzureBackupRecoveryPoint AzureBackupRecoveryPointResource properties. + * + * @return the properties value. + */ + AzureBackupRecoveryPoint properties(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner + * object. + * + * @return the inner object. + */ + AzureBackupRecoveryPointResourceInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResourceList.java new file mode 100644 index 0000000000000..7d874a2d78957 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResourceList.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** AzureBackupRecoveryPointResourceList Azure backup recoveryPoint resource list. */ +@Fluent +public final class AzureBackupRecoveryPointResourceList extends DppResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRecoveryPointResourceList.class); + + /* + * List of resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources. + * + * @param value the value value to set. + * @return the AzureBackupRecoveryPointResourceList object itself. + */ + public AzureBackupRecoveryPointResourceList withValue(List value) { + this.value = value; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRecoveryPointResourceList withNextLink(String nextLink) { + super.withNextLink(nextLink); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryTimeBasedRestoreRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryTimeBasedRestoreRequest.java new file mode 100644 index 0000000000000..5915906c00d82 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryTimeBasedRestoreRequest.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupRecoveryTimeBasedRestoreRequest AzureBackup RecoveryPointTime Based Restore Request. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureBackupRecoveryTimeBasedRestoreRequest") +@Fluent +public final class AzureBackupRecoveryTimeBasedRestoreRequest extends AzureBackupRestoreRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRecoveryTimeBasedRestoreRequest.class); + + /* + * The recovery time in ISO 8601 format example - + * 2020-08-14T17:30:00.0000000Z. + */ + @JsonProperty(value = "recoveryPointTime", required = true) + private String recoveryPointTime; + + /** + * Get the recoveryPointTime property: The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. + * + * @return the recoveryPointTime value. + */ + public String recoveryPointTime() { + return this.recoveryPointTime; + } + + /** + * Set the recoveryPointTime property: The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. + * + * @param recoveryPointTime the recoveryPointTime value to set. + * @return the AzureBackupRecoveryTimeBasedRestoreRequest object itself. + */ + public AzureBackupRecoveryTimeBasedRestoreRequest withRecoveryPointTime(String recoveryPointTime) { + this.recoveryPointTime = recoveryPointTime; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRecoveryTimeBasedRestoreRequest withRestoreTargetInfo(RestoreTargetInfoBase restoreTargetInfo) { + super.withRestoreTargetInfo(restoreTargetInfo); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRecoveryTimeBasedRestoreRequest withSourceDataStoreType(SourceDataStoreType sourceDataStoreType) { + super.withSourceDataStoreType(sourceDataStoreType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (recoveryPointTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recoveryPointTime in model" + + " AzureBackupRecoveryTimeBasedRestoreRequest")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRehydrationRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRehydrationRequest.java new file mode 100644 index 0000000000000..e1a00d7d27d07 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRehydrationRequest.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** AzureBackupRehydrationRequest Azure Backup Rehydrate Request. */ +@Fluent +public final class AzureBackupRehydrationRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRehydrationRequest.class); + + /* + * Id of the recovery point to be recovered + */ + @JsonProperty(value = "recoveryPointId", required = true) + private String recoveryPointId; + + /* + * Priority to be used for rehydration. Values High or Standard + */ + @JsonProperty(value = "rehydrationPriority") + private RehydrationPriority rehydrationPriority; + + /* + * Retention duration in ISO 8601 format i.e P10D . + */ + @JsonProperty(value = "rehydrationRetentionDuration", required = true) + private String rehydrationRetentionDuration; + + /** + * Get the recoveryPointId property: Id of the recovery point to be recovered. + * + * @return the recoveryPointId value. + */ + public String recoveryPointId() { + return this.recoveryPointId; + } + + /** + * Set the recoveryPointId property: Id of the recovery point to be recovered. + * + * @param recoveryPointId the recoveryPointId value to set. + * @return the AzureBackupRehydrationRequest object itself. + */ + public AzureBackupRehydrationRequest withRecoveryPointId(String recoveryPointId) { + this.recoveryPointId = recoveryPointId; + return this; + } + + /** + * Get the rehydrationPriority property: Priority to be used for rehydration. Values High or Standard. + * + * @return the rehydrationPriority value. + */ + public RehydrationPriority rehydrationPriority() { + return this.rehydrationPriority; + } + + /** + * Set the rehydrationPriority property: Priority to be used for rehydration. Values High or Standard. + * + * @param rehydrationPriority the rehydrationPriority value to set. + * @return the AzureBackupRehydrationRequest object itself. + */ + public AzureBackupRehydrationRequest withRehydrationPriority(RehydrationPriority rehydrationPriority) { + this.rehydrationPriority = rehydrationPriority; + return this; + } + + /** + * Get the rehydrationRetentionDuration property: Retention duration in ISO 8601 format i.e P10D . + * + * @return the rehydrationRetentionDuration value. + */ + public String rehydrationRetentionDuration() { + return this.rehydrationRetentionDuration; + } + + /** + * Set the rehydrationRetentionDuration property: Retention duration in ISO 8601 format i.e P10D . + * + * @param rehydrationRetentionDuration the rehydrationRetentionDuration value to set. + * @return the AzureBackupRehydrationRequest object itself. + */ + public AzureBackupRehydrationRequest withRehydrationRetentionDuration(String rehydrationRetentionDuration) { + this.rehydrationRetentionDuration = rehydrationRetentionDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recoveryPointId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recoveryPointId in model AzureBackupRehydrationRequest")); + } + if (rehydrationRetentionDuration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rehydrationRetentionDuration in model" + + " AzureBackupRehydrationRequest")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreRequest.java new file mode 100644 index 0000000000000..a12b864492d5a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreRequest.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupRestoreRequest Azure backup restore request. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = AzureBackupRestoreRequest.class) +@JsonTypeName("AzureBackupRestoreRequest") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "AzureBackupRecoveryPointBasedRestoreRequest", + value = AzureBackupRecoveryPointBasedRestoreRequest.class), + @JsonSubTypes.Type( + name = "AzureBackupRecoveryTimeBasedRestoreRequest", + value = AzureBackupRecoveryTimeBasedRestoreRequest.class) +}) +@Fluent +public class AzureBackupRestoreRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRestoreRequest.class); + + /* + * Gets or sets the restore target information. + */ + @JsonProperty(value = "restoreTargetInfo", required = true) + private RestoreTargetInfoBase restoreTargetInfo; + + /* + * Gets or sets the type of the source data store. + */ + @JsonProperty(value = "sourceDataStoreType", required = true) + private SourceDataStoreType sourceDataStoreType; + + /** + * Get the restoreTargetInfo property: Gets or sets the restore target information. + * + * @return the restoreTargetInfo value. + */ + public RestoreTargetInfoBase restoreTargetInfo() { + return this.restoreTargetInfo; + } + + /** + * Set the restoreTargetInfo property: Gets or sets the restore target information. + * + * @param restoreTargetInfo the restoreTargetInfo value to set. + * @return the AzureBackupRestoreRequest object itself. + */ + public AzureBackupRestoreRequest withRestoreTargetInfo(RestoreTargetInfoBase restoreTargetInfo) { + this.restoreTargetInfo = restoreTargetInfo; + return this; + } + + /** + * Get the sourceDataStoreType property: Gets or sets the type of the source data store. + * + * @return the sourceDataStoreType value. + */ + public SourceDataStoreType sourceDataStoreType() { + return this.sourceDataStoreType; + } + + /** + * Set the sourceDataStoreType property: Gets or sets the type of the source data store. + * + * @param sourceDataStoreType the sourceDataStoreType value to set. + * @return the AzureBackupRestoreRequest object itself. + */ + public AzureBackupRestoreRequest withSourceDataStoreType(SourceDataStoreType sourceDataStoreType) { + this.sourceDataStoreType = sourceDataStoreType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restoreTargetInfo() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restoreTargetInfo in model AzureBackupRestoreRequest")); + } else { + restoreTargetInfo().validate(); + } + if (sourceDataStoreType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceDataStoreType in model AzureBackupRestoreRequest")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreWithRehydrationRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreWithRehydrationRequest.java new file mode 100644 index 0000000000000..d38a9d00c4518 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreWithRehydrationRequest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupRestoreWithRehydrationRequest AzureBackup Restore with Rehydration Request. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureBackupRestoreWithRehydrationRequest") +@Fluent +public final class AzureBackupRestoreWithRehydrationRequest extends AzureBackupRecoveryPointBasedRestoreRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRestoreWithRehydrationRequest.class); + + /* + * Priority to be used for rehydration. Values High or Standard + */ + @JsonProperty(value = "rehydrationPriority", required = true) + private RehydrationPriority rehydrationPriority; + + /* + * Retention duration in ISO 8601 format i.e P10D . + */ + @JsonProperty(value = "rehydrationRetentionDuration", required = true) + private String rehydrationRetentionDuration; + + /** + * Get the rehydrationPriority property: Priority to be used for rehydration. Values High or Standard. + * + * @return the rehydrationPriority value. + */ + public RehydrationPriority rehydrationPriority() { + return this.rehydrationPriority; + } + + /** + * Set the rehydrationPriority property: Priority to be used for rehydration. Values High or Standard. + * + * @param rehydrationPriority the rehydrationPriority value to set. + * @return the AzureBackupRestoreWithRehydrationRequest object itself. + */ + public AzureBackupRestoreWithRehydrationRequest withRehydrationPriority(RehydrationPriority rehydrationPriority) { + this.rehydrationPriority = rehydrationPriority; + return this; + } + + /** + * Get the rehydrationRetentionDuration property: Retention duration in ISO 8601 format i.e P10D . + * + * @return the rehydrationRetentionDuration value. + */ + public String rehydrationRetentionDuration() { + return this.rehydrationRetentionDuration; + } + + /** + * Set the rehydrationRetentionDuration property: Retention duration in ISO 8601 format i.e P10D . + * + * @param rehydrationRetentionDuration the rehydrationRetentionDuration value to set. + * @return the AzureBackupRestoreWithRehydrationRequest object itself. + */ + public AzureBackupRestoreWithRehydrationRequest withRehydrationRetentionDuration( + String rehydrationRetentionDuration) { + this.rehydrationRetentionDuration = rehydrationRetentionDuration; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRestoreWithRehydrationRequest withRecoveryPointId(String recoveryPointId) { + super.withRecoveryPointId(recoveryPointId); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRestoreWithRehydrationRequest withRestoreTargetInfo(RestoreTargetInfoBase restoreTargetInfo) { + super.withRestoreTargetInfo(restoreTargetInfo); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRestoreWithRehydrationRequest withSourceDataStoreType(SourceDataStoreType sourceDataStoreType) { + super.withSourceDataStoreType(sourceDataStoreType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (rehydrationPriority() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rehydrationPriority in model" + + " AzureBackupRestoreWithRehydrationRequest")); + } + if (rehydrationRetentionDuration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rehydrationRetentionDuration in model" + + " AzureBackupRestoreWithRehydrationRequest")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRule.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRule.java new file mode 100644 index 0000000000000..0e6d2b189fead --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRule.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** AzureBackupRule Azure backup rule. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureBackupRule") +@Fluent +public final class AzureBackupRule extends BasePolicyRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRule.class); + + /* + * BackupParameters BackupParameters base + */ + @JsonProperty(value = "backupParameters") + private BackupParameters backupParameters; + + /* + * DataStoreInfoBase DataStoreInfo base + */ + @JsonProperty(value = "dataStore", required = true) + private DataStoreInfoBase dataStore; + + /* + * TriggerContext Trigger context + */ + @JsonProperty(value = "trigger", required = true) + private TriggerContext trigger; + + /** + * Get the backupParameters property: BackupParameters BackupParameters base. + * + * @return the backupParameters value. + */ + public BackupParameters backupParameters() { + return this.backupParameters; + } + + /** + * Set the backupParameters property: BackupParameters BackupParameters base. + * + * @param backupParameters the backupParameters value to set. + * @return the AzureBackupRule object itself. + */ + public AzureBackupRule withBackupParameters(BackupParameters backupParameters) { + this.backupParameters = backupParameters; + return this; + } + + /** + * Get the dataStore property: DataStoreInfoBase DataStoreInfo base. + * + * @return the dataStore value. + */ + public DataStoreInfoBase dataStore() { + return this.dataStore; + } + + /** + * Set the dataStore property: DataStoreInfoBase DataStoreInfo base. + * + * @param dataStore the dataStore value to set. + * @return the AzureBackupRule object itself. + */ + public AzureBackupRule withDataStore(DataStoreInfoBase dataStore) { + this.dataStore = dataStore; + return this; + } + + /** + * Get the trigger property: TriggerContext Trigger context. + * + * @return the trigger value. + */ + public TriggerContext trigger() { + return this.trigger; + } + + /** + * Set the trigger property: TriggerContext Trigger context. + * + * @param trigger the trigger value to set. + * @return the AzureBackupRule object itself. + */ + public AzureBackupRule withTrigger(TriggerContext trigger) { + this.trigger = trigger; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBackupRule withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (backupParameters() != null) { + backupParameters().validate(); + } + if (dataStore() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataStore in model AzureBackupRule")); + } else { + dataStore().validate(); + } + if (trigger() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property trigger in model AzureBackupRule")); + } else { + trigger().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureOperationalStoreParameters.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureOperationalStoreParameters.java new file mode 100644 index 0000000000000..1e613e1a8360e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureOperationalStoreParameters.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Parameters for Operational-Tier DataStore. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureOperationalStoreParameters") +@Fluent +public final class AzureOperationalStoreParameters extends DataStoreParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureOperationalStoreParameters.class); + + /* + * Gets or sets the Snapshot Resource Group Uri. + */ + @JsonProperty(value = "resourceGroupId") + private String resourceGroupId; + + /** + * Get the resourceGroupId property: Gets or sets the Snapshot Resource Group Uri. + * + * @return the resourceGroupId value. + */ + public String resourceGroupId() { + return this.resourceGroupId; + } + + /** + * Set the resourceGroupId property: Gets or sets the Snapshot Resource Group Uri. + * + * @param resourceGroupId the resourceGroupId value to set. + * @return the AzureOperationalStoreParameters object itself. + */ + public AzureOperationalStoreParameters withResourceGroupId(String resourceGroupId) { + this.resourceGroupId = resourceGroupId; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureOperationalStoreParameters withDataStoreType(DataStoreTypes dataStoreType) { + super.withDataStoreType(dataStoreType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureRetentionRule.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureRetentionRule.java new file mode 100644 index 0000000000000..46df3e5779be5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureRetentionRule.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** AzureRetentionRule Azure retention rule. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AzureRetentionRule") +@Fluent +public final class AzureRetentionRule extends BasePolicyRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureRetentionRule.class); + + /* + * The isDefault property. + */ + @JsonProperty(value = "isDefault") + private Boolean isDefault; + + /* + * The lifecycles property. + */ + @JsonProperty(value = "lifecycles", required = true) + private List lifecycles; + + /** + * Get the isDefault property: The isDefault property. + * + * @return the isDefault value. + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Set the isDefault property: The isDefault property. + * + * @param isDefault the isDefault value to set. + * @return the AzureRetentionRule object itself. + */ + public AzureRetentionRule withIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Get the lifecycles property: The lifecycles property. + * + * @return the lifecycles value. + */ + public List lifecycles() { + return this.lifecycles; + } + + /** + * Set the lifecycles property: The lifecycles property. + * + * @param lifecycles the lifecycles value to set. + * @return the AzureRetentionRule object itself. + */ + public AzureRetentionRule withLifecycles(List lifecycles) { + this.lifecycles = lifecycles; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureRetentionRule withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (lifecycles() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property lifecycles in model AzureRetentionRule")); + } else { + lifecycles().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupCriteria.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupCriteria.java new file mode 100644 index 0000000000000..c99b3ee5bcde2 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupCriteria.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** BackupCriteria BackupCriteria base class. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = BackupCriteria.class) +@JsonTypeName("BackupCriteria") +@JsonSubTypes({@JsonSubTypes.Type(name = "ScheduleBasedBackupCriteria", value = ScheduleBasedBackupCriteria.class)}) +@Immutable +public class BackupCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupCriteria.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstance.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstance.java new file mode 100644 index 0000000000000..c1a012b9867e2 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstance.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** Backup Instance. */ +@Fluent +public final class BackupInstance { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstance.class); + + /* + * Gets or sets the Backup Instance friendly name. + */ + @JsonProperty(value = "friendlyName") + private String friendlyName; + + /* + * Datasource Gets or sets the data source information. + */ + @JsonProperty(value = "dataSourceInfo", required = true) + private Datasource dataSourceInfo; + + /* + * DatasourceSet Gets or sets the data source set information. + */ + @JsonProperty(value = "dataSourceSetInfo") + private DatasourceSet dataSourceSetInfo; + + /* + * PolicyInfo Gets or sets the policy information. + */ + @JsonProperty(value = "policyInfo", required = true) + private PolicyInfo policyInfo; + + /* + * ProtectionStatusDetails Specifies the protection status of the resource + */ + @JsonProperty(value = "protectionStatus", access = JsonProperty.Access.WRITE_ONLY) + private ProtectionStatusDetails protectionStatus; + + /* + * Specifies the current protection state of the resource + */ + @JsonProperty(value = "currentProtectionState", access = JsonProperty.Access.WRITE_ONLY) + private CurrentProtectionState currentProtectionState; + + /* + * Specifies the protection error of the resource + */ + @JsonProperty(value = "protectionErrorDetails", access = JsonProperty.Access.WRITE_ONLY) + private UserFacingError protectionErrorDetails; + + /* + * Specifies the provisioning state of the resource i.e. + * provisioning/updating/Succeeded/Failed + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Credentials to use to authenticate with data source provider. + */ + @JsonProperty(value = "datasourceAuthCredentials") + private AuthCredentials datasourceAuthCredentials; + + /* + * The objectType property. + */ + @JsonProperty(value = "objectType", required = true) + private String objectType; + + /** + * Get the friendlyName property: Gets or sets the Backup Instance friendly name. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Gets or sets the Backup Instance friendly name. + * + * @param friendlyName the friendlyName value to set. + * @return the BackupInstance object itself. + */ + public BackupInstance withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the dataSourceInfo property: Datasource Gets or sets the data source information. + * + * @return the dataSourceInfo value. + */ + public Datasource dataSourceInfo() { + return this.dataSourceInfo; + } + + /** + * Set the dataSourceInfo property: Datasource Gets or sets the data source information. + * + * @param dataSourceInfo the dataSourceInfo value to set. + * @return the BackupInstance object itself. + */ + public BackupInstance withDataSourceInfo(Datasource dataSourceInfo) { + this.dataSourceInfo = dataSourceInfo; + return this; + } + + /** + * Get the dataSourceSetInfo property: DatasourceSet Gets or sets the data source set information. + * + * @return the dataSourceSetInfo value. + */ + public DatasourceSet dataSourceSetInfo() { + return this.dataSourceSetInfo; + } + + /** + * Set the dataSourceSetInfo property: DatasourceSet Gets or sets the data source set information. + * + * @param dataSourceSetInfo the dataSourceSetInfo value to set. + * @return the BackupInstance object itself. + */ + public BackupInstance withDataSourceSetInfo(DatasourceSet dataSourceSetInfo) { + this.dataSourceSetInfo = dataSourceSetInfo; + return this; + } + + /** + * Get the policyInfo property: PolicyInfo Gets or sets the policy information. + * + * @return the policyInfo value. + */ + public PolicyInfo policyInfo() { + return this.policyInfo; + } + + /** + * Set the policyInfo property: PolicyInfo Gets or sets the policy information. + * + * @param policyInfo the policyInfo value to set. + * @return the BackupInstance object itself. + */ + public BackupInstance withPolicyInfo(PolicyInfo policyInfo) { + this.policyInfo = policyInfo; + return this; + } + + /** + * Get the protectionStatus property: ProtectionStatusDetails Specifies the protection status of the resource. + * + * @return the protectionStatus value. + */ + public ProtectionStatusDetails protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the currentProtectionState property: Specifies the current protection state of the resource. + * + * @return the currentProtectionState value. + */ + public CurrentProtectionState currentProtectionState() { + return this.currentProtectionState; + } + + /** + * Get the protectionErrorDetails property: Specifies the protection error of the resource. + * + * @return the protectionErrorDetails value. + */ + public UserFacingError protectionErrorDetails() { + return this.protectionErrorDetails; + } + + /** + * Get the provisioningState property: Specifies the provisioning state of the resource i.e. + * provisioning/updating/Succeeded/Failed. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the datasourceAuthCredentials property: Credentials to use to authenticate with data source provider. + * + * @return the datasourceAuthCredentials value. + */ + public AuthCredentials datasourceAuthCredentials() { + return this.datasourceAuthCredentials; + } + + /** + * Set the datasourceAuthCredentials property: Credentials to use to authenticate with data source provider. + * + * @param datasourceAuthCredentials the datasourceAuthCredentials value to set. + * @return the BackupInstance object itself. + */ + public BackupInstance withDatasourceAuthCredentials(AuthCredentials datasourceAuthCredentials) { + this.datasourceAuthCredentials = datasourceAuthCredentials; + return this; + } + + /** + * Get the objectType property: The objectType property. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: The objectType property. + * + * @param objectType the objectType value to set. + * @return the BackupInstance object itself. + */ + public BackupInstance withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataSourceInfo() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataSourceInfo in model BackupInstance")); + } else { + dataSourceInfo().validate(); + } + if (dataSourceSetInfo() != null) { + dataSourceSetInfo().validate(); + } + if (policyInfo() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property policyInfo in model BackupInstance")); + } else { + policyInfo().validate(); + } + if (protectionStatus() != null) { + protectionStatus().validate(); + } + if (protectionErrorDetails() != null) { + protectionErrorDetails().validate(); + } + if (datasourceAuthCredentials() != null) { + datasourceAuthCredentials().validate(); + } + if (objectType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property objectType in model BackupInstance")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResource.java new file mode 100644 index 0000000000000..fad249e635e86 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResource.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner; + +/** An immutable client-side representation of BackupInstanceResource. */ +public interface BackupInstanceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: BackupInstanceResource properties. + * + * @return the properties value. + */ + BackupInstance properties(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner object. + * + * @return the inner object. + */ + BackupInstanceResourceInner innerModel(); + + /** The entirety of the BackupInstanceResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The BackupInstanceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the BackupInstanceResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the BackupInstanceResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies vaultName, resourceGroupName. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @return the next definition stage. + */ + WithCreate withExistingBackupVault(String vaultName, String resourceGroupName); + } + /** + * The stage of the BackupInstanceResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + BackupInstanceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BackupInstanceResource create(Context context); + } + /** The stage of the BackupInstanceResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: BackupInstanceResource properties. + * + * @param properties BackupInstanceResource properties. + * @return the next definition stage. + */ + WithCreate withProperties(BackupInstance properties); + } + } + /** + * Begins update for the BackupInstanceResource resource. + * + * @return the stage of resource update. + */ + BackupInstanceResource.Update update(); + + /** The template for BackupInstanceResource update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BackupInstanceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BackupInstanceResource apply(Context context); + } + /** The BackupInstanceResource update stages. */ + interface UpdateStages { + /** The stage of the BackupInstanceResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: BackupInstanceResource properties. + * + * @param properties BackupInstanceResource properties. + * @return the next definition stage. + */ + Update withProperties(BackupInstance properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BackupInstanceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BackupInstanceResource refresh(Context context); + + /** + * Trigger adhoc backup. + * + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo adhocBackup(TriggerBackupRequest parameters); + + /** + * Trigger adhoc backup. + * + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo adhocBackup(TriggerBackupRequest parameters, Context context); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerRehydrate(AzureBackupRehydrationRequest parameters); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerRehydrate(AzureBackupRehydrationRequest parameters, Context context); + + /** + * Triggers restore for a BackupInstance. + * + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo triggerRestore(AzureBackupRestoreRequest parameters); + + /** + * Triggers restore for a BackupInstance. + * + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo triggerRestore(AzureBackupRestoreRequest parameters, Context context); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo validateForRestore(ValidateRestoreRequestObject parameters); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo validateForRestore(ValidateRestoreRequestObject parameters, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResourceList.java new file mode 100644 index 0000000000000..37255c532eb8a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResourceList.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** BackupInstanceResourceList BackupInstance Resource list response. */ +@Fluent +public final class BackupInstanceResourceList extends DppResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstanceResourceList.class); + + /* + * List of resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources. + * + * @param value the value value to set. + * @return the BackupInstanceResourceList object itself. + */ + public BackupInstanceResourceList withValue(List value) { + this.value = value; + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupInstanceResourceList withNextLink(String nextLink) { + super.withNextLink(nextLink); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstances.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstances.java new file mode 100644 index 0000000000000..eafd4ea6ad66f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstances.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BackupInstances. */ +public interface BackupInstances { + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + PagedIterable list(String vaultName, String resourceGroupName); + + /** + * Gets a backup instances belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instances belonging to a backup vault. + */ + PagedIterable list(String vaultName, String resourceGroupName, Context context); + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + BackupInstanceResource get(String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Gets a backup instance with name in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + Response getWithResponse( + String vaultName, String resourceGroupName, String backupInstanceName, Context context); + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Delete a backup instance in a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String vaultName, String resourceGroupName, String backupInstanceName, Context context); + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo adhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters); + + /** + * Trigger adhoc backup. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo adhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context); + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters); + + /** + * Validate whether adhoc backup will be successful or not. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters); + + /** + * rehydrate recovery point for restore for a BackupInstance. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The backupInstanceName parameter. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerRehydrate( + String resourceGroupName, + String vaultName, + String backupInstanceName, + AzureBackupRehydrationRequest parameters, + Context context); + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo triggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters); + + /** + * Triggers restore for a BackupInstance. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo triggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for 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 operationJobExtendedInfo. + */ + OperationJobExtendedInfo validateForRestore( + String vaultName, String resourceGroupName, String backupInstanceName, ValidateRestoreRequestObject parameters); + + /** + * Validates if Restore can be triggered for a DataSource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operationJobExtendedInfo. + */ + OperationJobExtendedInfo validateForRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context); + + /** + * Gets a backup instance with name in a backup vault. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + BackupInstanceResource getById(String id); + + /** + * Gets a backup instance with name in a backup vault. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup instance with name in a backup vault. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a backup instance in a backup vault. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a backup instance in a backup vault. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BackupInstanceResource resource. + * + * @param name resource name. + * @return the first stage of the new BackupInstanceResource definition. + */ + BackupInstanceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupHeaders.java new file mode 100644 index 0000000000000..55959dd528e34 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupInstancesAdhocBackupHeaders model. */ +@Fluent +public final class BackupInstancesAdhocBackupHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesAdhocBackupHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupInstancesAdhocBackupHeaders object itself. + */ + public BackupInstancesAdhocBackupHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupInstancesAdhocBackupHeaders object itself. + */ + public BackupInstancesAdhocBackupHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupInstancesAdhocBackupHeaders object itself. + */ + public BackupInstancesAdhocBackupHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupResponse.java new file mode 100644 index 0000000000000..e00769994a0ba --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; + +/** Contains all response data for the adhocBackup operation. */ +public final class BackupInstancesAdhocBackupResponse + extends ResponseBase { + /** + * Creates an instance of BackupInstancesAdhocBackupResponse. + * + * @param request the request which resulted in this BackupInstancesAdhocBackupResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupInstancesAdhocBackupResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + OperationJobExtendedInfoInner value, + BackupInstancesAdhocBackupHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public OperationJobExtendedInfoInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesDeleteHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesDeleteHeaders.java new file mode 100644 index 0000000000000..79dd0fce3d25c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesDeleteHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupInstancesDeleteHeaders model. */ +@Fluent +public final class BackupInstancesDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesDeleteHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupInstancesDeleteHeaders object itself. + */ + public BackupInstancesDeleteHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupInstancesDeleteHeaders object itself. + */ + public BackupInstancesDeleteHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupInstancesDeleteHeaders object itself. + */ + public BackupInstancesDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesDeleteResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesDeleteResponse.java new file mode 100644 index 0000000000000..6b14721971604 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesDeleteResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class BackupInstancesDeleteResponse extends ResponseBase { + /** + * Creates an instance of BackupInstancesDeleteResponse. + * + * @param request the request which resulted in this BackupInstancesDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupInstancesDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BackupInstancesDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRehydrateHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRehydrateHeaders.java new file mode 100644 index 0000000000000..c77f61d552e52 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRehydrateHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupInstancesTriggerRehydrateHeaders model. */ +@Fluent +public final class BackupInstancesTriggerRehydrateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesTriggerRehydrateHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupInstancesTriggerRehydrateHeaders object itself. + */ + public BackupInstancesTriggerRehydrateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupInstancesTriggerRehydrateHeaders object itself. + */ + public BackupInstancesTriggerRehydrateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupInstancesTriggerRehydrateHeaders object itself. + */ + public BackupInstancesTriggerRehydrateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRehydrateResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRehydrateResponse.java new file mode 100644 index 0000000000000..27be63eea233c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRehydrateResponse.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the triggerRehydrate operation. */ +public final class BackupInstancesTriggerRehydrateResponse + extends ResponseBase { + /** + * Creates an instance of BackupInstancesTriggerRehydrateResponse. + * + * @param request the request which resulted in this BackupInstancesTriggerRehydrateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupInstancesTriggerRehydrateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + BackupInstancesTriggerRehydrateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreHeaders.java new file mode 100644 index 0000000000000..385c730a2b3ee --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupInstancesTriggerRestoreHeaders model. */ +@Fluent +public final class BackupInstancesTriggerRestoreHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesTriggerRestoreHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupInstancesTriggerRestoreHeaders object itself. + */ + public BackupInstancesTriggerRestoreHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupInstancesTriggerRestoreHeaders object itself. + */ + public BackupInstancesTriggerRestoreHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupInstancesTriggerRestoreHeaders object itself. + */ + public BackupInstancesTriggerRestoreHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreResponse.java new file mode 100644 index 0000000000000..8c404a68f12e7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; + +/** Contains all response data for the triggerRestore operation. */ +public final class BackupInstancesTriggerRestoreResponse + extends ResponseBase { + /** + * Creates an instance of BackupInstancesTriggerRestoreResponse. + * + * @param request the request which resulted in this BackupInstancesTriggerRestoreResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupInstancesTriggerRestoreResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + OperationJobExtendedInfoInner value, + BackupInstancesTriggerRestoreHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public OperationJobExtendedInfoInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupHeaders.java new file mode 100644 index 0000000000000..8a1cca7cbba13 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupInstancesValidateForBackupHeaders model. */ +@Fluent +public final class BackupInstancesValidateForBackupHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesValidateForBackupHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupInstancesValidateForBackupHeaders object itself. + */ + public BackupInstancesValidateForBackupHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupInstancesValidateForBackupHeaders object itself. + */ + public BackupInstancesValidateForBackupHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupInstancesValidateForBackupHeaders object itself. + */ + public BackupInstancesValidateForBackupHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupResponse.java new file mode 100644 index 0000000000000..263301e815f22 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; + +/** Contains all response data for the validateForBackup operation. */ +public final class BackupInstancesValidateForBackupResponse + extends ResponseBase { + /** + * Creates an instance of BackupInstancesValidateForBackupResponse. + * + * @param request the request which resulted in this BackupInstancesValidateForBackupResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupInstancesValidateForBackupResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + OperationJobExtendedInfoInner value, + BackupInstancesValidateForBackupHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public OperationJobExtendedInfoInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForRestoreHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForRestoreHeaders.java new file mode 100644 index 0000000000000..9ac72c233aa3a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForRestoreHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupInstancesValidateForRestoreHeaders model. */ +@Fluent +public final class BackupInstancesValidateForRestoreHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesValidateForRestoreHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupInstancesValidateForRestoreHeaders object itself. + */ + public BackupInstancesValidateForRestoreHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupInstancesValidateForRestoreHeaders object itself. + */ + public BackupInstancesValidateForRestoreHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupInstancesValidateForRestoreHeaders object itself. + */ + public BackupInstancesValidateForRestoreHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForRestoreResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForRestoreResponse.java new file mode 100644 index 0000000000000..42ce27c64305f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForRestoreResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; + +/** Contains all response data for the validateForRestore operation. */ +public final class BackupInstancesValidateForRestoreResponse + extends ResponseBase { + /** + * Creates an instance of BackupInstancesValidateForRestoreResponse. + * + * @param request the request which resulted in this BackupInstancesValidateForRestoreResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupInstancesValidateForRestoreResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + OperationJobExtendedInfoInner value, + BackupInstancesValidateForRestoreHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public OperationJobExtendedInfoInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupParameters.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupParameters.java new file mode 100644 index 0000000000000..831221414be2f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupParameters.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** BackupParameters BackupParameters base. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = BackupParameters.class) +@JsonTypeName("BackupParameters") +@JsonSubTypes({@JsonSubTypes.Type(name = "AzureBackupParams", value = AzureBackupParams.class)}) +@Immutable +public class BackupParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupParameters.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupPolicies.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupPolicies.java new file mode 100644 index 0000000000000..49d48e980d448 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupPolicies.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BackupPolicies. */ +public interface BackupPolicies { + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return baseBackupPolicyResourceList. + */ + PagedIterable list(String vaultName, String resourceGroupName); + + /** + * Returns list of backup policies belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 baseBackupPolicyResourceList. + */ + PagedIterable list(String vaultName, String resourceGroupName, Context context); + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + BaseBackupPolicyResource get(String vaultName, String resourceGroupName, String backupPolicyName); + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 a backup policy belonging to a backup vault. + */ + Response getWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context); + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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. + */ + void delete(String vaultName, String resourceGroupName, String backupPolicyName); + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupPolicyName The backupPolicyName 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 response. + */ + Response deleteWithResponse( + String vaultName, String resourceGroupName, String backupPolicyName, Context context); + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup policy belonging to a backup vault. + */ + BaseBackupPolicyResource getById(String id); + + /** + * Gets a backup policy belonging to a backup vault. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a backup policy belonging to a backup vault. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a backup policy belonging to a backup vault. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BaseBackupPolicyResource resource. + * + * @param name resource name. + * @return the first stage of the new BaseBackupPolicyResource definition. + */ + BaseBackupPolicyResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupPolicy.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupPolicy.java new file mode 100644 index 0000000000000..8296c77c33ca8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupPolicy.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** BackupPolicy Rule based backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("BackupPolicy") +@Fluent +public final class BackupPolicy extends BaseBackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPolicy.class); + + /* + * Policy rule dictionary that contains rules for each backuptype i.e + * Full/Incremental/Logs etc + */ + @JsonProperty(value = "policyRules", required = true) + private List policyRules; + + /** + * Get the policyRules property: Policy rule dictionary that contains rules for each backuptype i.e + * Full/Incremental/Logs etc. + * + * @return the policyRules value. + */ + public List policyRules() { + return this.policyRules; + } + + /** + * Set the policyRules property: Policy rule dictionary that contains rules for each backuptype i.e + * Full/Incremental/Logs etc. + * + * @param policyRules the policyRules value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withPolicyRules(List policyRules) { + this.policyRules = policyRules; + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupPolicy withDatasourceTypes(List datasourceTypes) { + super.withDatasourceTypes(datasourceTypes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (policyRules() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property policyRules in model BackupPolicy")); + } else { + policyRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupSchedule.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupSchedule.java new file mode 100644 index 0000000000000..fc33605eb6708 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupSchedule.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** BackupSchedule Schedule for backup. */ +@Fluent +public final class BackupSchedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupSchedule.class); + + /* + * ISO 8601 repeating time interval format + */ + @JsonProperty(value = "repeatingTimeIntervals", required = true) + private List repeatingTimeIntervals; + + /* + * Time zone for a schedule. Example: Pacific Standard Time + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /** + * Get the repeatingTimeIntervals property: ISO 8601 repeating time interval format. + * + * @return the repeatingTimeIntervals value. + */ + public List repeatingTimeIntervals() { + return this.repeatingTimeIntervals; + } + + /** + * Set the repeatingTimeIntervals property: ISO 8601 repeating time interval format. + * + * @param repeatingTimeIntervals the repeatingTimeIntervals value to set. + * @return the BackupSchedule object itself. + */ + public BackupSchedule withRepeatingTimeIntervals(List repeatingTimeIntervals) { + this.repeatingTimeIntervals = repeatingTimeIntervals; + return this; + } + + /** + * Get the timeZone property: Time zone for a schedule. Example: Pacific Standard Time. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Time zone for a schedule. Example: Pacific Standard Time. + * + * @param timeZone the timeZone value to set. + * @return the BackupSchedule object itself. + */ + public BackupSchedule withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (repeatingTimeIntervals() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property repeatingTimeIntervals in model BackupSchedule")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVault.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVault.java new file mode 100644 index 0000000000000..202120ed0d15e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVault.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** BackupVault Backup Vault. */ +@Fluent +public final class BackupVault { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVault.class); + + /* + * Provisioning state of the BackupVault resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Resource move state for backup vault + */ + @JsonProperty(value = "resourceMoveState", access = JsonProperty.Access.WRITE_ONLY) + private ResourceMoveState resourceMoveState; + + /* + * Resource move details for backup vault + */ + @JsonProperty(value = "resourceMoveDetails", access = JsonProperty.Access.WRITE_ONLY) + private ResourceMoveDetails resourceMoveDetails; + + /* + * Storage Settings + */ + @JsonProperty(value = "storageSettings", required = true) + private List storageSettings; + + /** + * Get the provisioningState property: Provisioning state of the BackupVault resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the resourceMoveState property: Resource move state for backup vault. + * + * @return the resourceMoveState value. + */ + public ResourceMoveState resourceMoveState() { + return this.resourceMoveState; + } + + /** + * Get the resourceMoveDetails property: Resource move details for backup vault. + * + * @return the resourceMoveDetails value. + */ + public ResourceMoveDetails resourceMoveDetails() { + return this.resourceMoveDetails; + } + + /** + * Get the storageSettings property: Storage Settings. + * + * @return the storageSettings value. + */ + public List storageSettings() { + return this.storageSettings; + } + + /** + * Set the storageSettings property: Storage Settings. + * + * @param storageSettings the storageSettings value to set. + * @return the BackupVault object itself. + */ + public BackupVault withStorageSettings(List storageSettings) { + this.storageSettings = storageSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceMoveDetails() != null) { + resourceMoveDetails().validate(); + } + if (storageSettings() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property storageSettings in model BackupVault")); + } else { + storageSettings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResults.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResults.java new file mode 100644 index 0000000000000..52e071c866ab3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResults.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BackupVaultOperationResults. */ +public interface BackupVaultOperationResults { + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + BackupVaultResource get(String vaultName, String resourceGroupName, String operationId); + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVault Resource. + */ + Response getWithResponse( + String vaultName, String resourceGroupName, String operationId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResultsGetHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResultsGetHeaders.java new file mode 100644 index 0000000000000..1f333641ba516 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResultsGetHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 BackupVaultOperationResultsGetHeaders model. */ +@Fluent +public final class BackupVaultOperationResultsGetHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVaultOperationResultsGetHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BackupVaultOperationResultsGetHeaders object itself. + */ + public BackupVaultOperationResultsGetHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the BackupVaultOperationResultsGetHeaders object itself. + */ + public BackupVaultOperationResultsGetHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BackupVaultOperationResultsGetHeaders object itself. + */ + public BackupVaultOperationResultsGetHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResultsGetResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResultsGetResponse.java new file mode 100644 index 0000000000000..6224d370f108c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultOperationResultsGetResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; + +/** Contains all response data for the get operation. */ +public final class BackupVaultOperationResultsGetResponse + extends ResponseBase { + /** + * Creates an instance of BackupVaultOperationResultsGetResponse. + * + * @param request the request which resulted in this BackupVaultOperationResultsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BackupVaultOperationResultsGetResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + BackupVaultResourceInner value, + BackupVaultOperationResultsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public BackupVaultResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResource.java new file mode 100644 index 0000000000000..77d6a2001c068 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResource.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import java.util.Map; + +/** An immutable client-side representation of BackupVaultResource. */ +public interface BackupVaultResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: Optional ETag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @return the identity value. + */ + DppIdentityDetails identity(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: BackupVault BackupVaultResource properties. + * + * @return the properties value. + */ + BackupVault properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner object. + * + * @return the inner object. + */ + BackupVaultResourceInner innerModel(); + + /** The entirety of the BackupVaultResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The BackupVaultResource definition stages. */ + interface DefinitionStages { + /** The first stage of the BackupVaultResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the BackupVaultResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the BackupVaultResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the BackupVaultResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: BackupVault BackupVaultResource properties. + * + * @param properties BackupVault BackupVaultResource properties. + * @return the next definition stage. + */ + WithCreate withProperties(BackupVault properties); + } + /** + * The stage of the BackupVaultResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithEtag, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + BackupVaultResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BackupVaultResource create(Context context); + } + /** The stage of the BackupVaultResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the BackupVaultResource definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: Optional ETag.. + * + * @param etag Optional ETag. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + /** The stage of the BackupVaultResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @param identity DppIdentityDetails Input Managed Identity Details. + * @return the next definition stage. + */ + WithCreate withIdentity(DppIdentityDetails identity); + } + } + /** + * Begins update for the BackupVaultResource resource. + * + * @return the stage of resource update. + */ + BackupVaultResource.Update update(); + + /** The template for BackupVaultResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BackupVaultResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BackupVaultResource apply(Context context); + } + /** The BackupVaultResource update stages. */ + interface UpdateStages { + /** The stage of the BackupVaultResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the BackupVaultResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @param identity DppIdentityDetails Input Managed Identity Details. + * @return the next definition stage. + */ + Update withIdentity(DppIdentityDetails identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BackupVaultResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BackupVaultResource refresh(Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResourceList.java new file mode 100644 index 0000000000000..12029c3d07d2e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResourceList.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** BackupVaultResourceList List of BackupVault resources. */ +@Fluent +public final class BackupVaultResourceList extends DppResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVaultResourceList.class); + + /* + * List of resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources. + * + * @param value the value value to set. + * @return the BackupVaultResourceList object itself. + */ + public BackupVaultResourceList withValue(List value) { + this.value = value; + return this; + } + + /** {@inheritDoc} */ + @Override + public BackupVaultResourceList withNextLink(String nextLink) { + super.withNextLink(nextLink); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaults.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaults.java new file mode 100644 index 0000000000000..dbfbf2e9a270c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaults.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BackupVaults. */ +public interface BackupVaults { + /** + * Returns resource collection belonging to a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + PagedIterable list(); + + /** + * Returns resource collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + PagedIterable list(Context context); + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVaultResourceList. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns resource collection belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @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 backupVaultResourceList. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + BackupVaultResource getByResourceGroup(String resourceGroupName, String vaultName); + + /** + * Returns a resource belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String vaultName, Context context); + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String vaultName); + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + CheckNameAvailabilityResult checkNameAvailability( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters); + + /** + * API to check for resource name availability. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return checkNameAvailabilityResult. + */ + Response checkNameAvailabilityWithResponse( + String resourceGroupName, String location, CheckNameAvailabilityRequest parameters, Context context); + + /** + * Returns a resource belonging to a resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + BackupVaultResource getById(String id); + + /** + * Returns a resource belonging to a resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupVault Resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a BackupVault resource from the resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BackupVaultResource resource. + * + * @param name resource name. + * @return the first stage of the new BackupVaultResource definition. + */ + BackupVaultResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicy.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicy.java new file mode 100644 index 0000000000000..347ba3cd5bb76 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicy.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** BaseBackupPolicy BackupPolicy base. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = BaseBackupPolicy.class) +@JsonTypeName("BaseBackupPolicy") +@JsonSubTypes({@JsonSubTypes.Type(name = "BackupPolicy", value = BackupPolicy.class)}) +@Fluent +public class BaseBackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BaseBackupPolicy.class); + + /* + * Type of datasource for the backup management + */ + @JsonProperty(value = "datasourceTypes", required = true) + private List datasourceTypes; + + /** + * Get the datasourceTypes property: Type of datasource for the backup management. + * + * @return the datasourceTypes value. + */ + public List datasourceTypes() { + return this.datasourceTypes; + } + + /** + * Set the datasourceTypes property: Type of datasource for the backup management. + * + * @param datasourceTypes the datasourceTypes value to set. + * @return the BaseBackupPolicy object itself. + */ + public BaseBackupPolicy withDatasourceTypes(List datasourceTypes) { + this.datasourceTypes = datasourceTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (datasourceTypes() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property datasourceTypes in model BaseBackupPolicy")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicyResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicyResource.java new file mode 100644 index 0000000000000..5ed503e146ac5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicyResource.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; + +/** An immutable client-side representation of BaseBackupPolicyResource. */ +public interface BaseBackupPolicyResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: BaseBackupPolicy BaseBackupPolicyResource properties. + * + * @return the properties value. + */ + BaseBackupPolicy properties(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner object. + * + * @return the inner object. + */ + BaseBackupPolicyResourceInner innerModel(); + + /** The entirety of the BaseBackupPolicyResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The BaseBackupPolicyResource definition stages. */ + interface DefinitionStages { + /** The first stage of the BaseBackupPolicyResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the BaseBackupPolicyResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies vaultName, resourceGroupName. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @return the next definition stage. + */ + WithCreate withExistingBackupVault(String vaultName, String resourceGroupName); + } + /** + * The stage of the BaseBackupPolicyResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + BaseBackupPolicyResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BaseBackupPolicyResource create(Context context); + } + /** The stage of the BaseBackupPolicyResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: BaseBackupPolicy BaseBackupPolicyResource properties. + * + * @param properties BaseBackupPolicy BaseBackupPolicyResource properties. + * @return the next definition stage. + */ + WithCreate withProperties(BaseBackupPolicy properties); + } + } + /** + * Begins update for the BaseBackupPolicyResource resource. + * + * @return the stage of resource update. + */ + BaseBackupPolicyResource.Update update(); + + /** The template for BaseBackupPolicyResource update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BaseBackupPolicyResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BaseBackupPolicyResource apply(Context context); + } + /** The BaseBackupPolicyResource update stages. */ + interface UpdateStages { + /** The stage of the BaseBackupPolicyResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: BaseBackupPolicy BaseBackupPolicyResource properties. + * + * @param properties BaseBackupPolicy BaseBackupPolicyResource properties. + * @return the next definition stage. + */ + Update withProperties(BaseBackupPolicy properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BaseBackupPolicyResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BaseBackupPolicyResource refresh(Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicyResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicyResourceList.java new file mode 100644 index 0000000000000..ef7a0adbad91f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BaseBackupPolicyResourceList.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** BaseBackupPolicyResourceList List of BaseBackupPolicy resources. */ +@Fluent +public final class BaseBackupPolicyResourceList extends DppResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BaseBackupPolicyResourceList.class); + + /* + * List of resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources. + * + * @param value the value value to set. + * @return the BaseBackupPolicyResourceList object itself. + */ + public BaseBackupPolicyResourceList withValue(List value) { + this.value = value; + return this; + } + + /** {@inheritDoc} */ + @Override + public BaseBackupPolicyResourceList withNextLink(String nextLink) { + super.withNextLink(nextLink); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BasePolicyRule.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BasePolicyRule.java new file mode 100644 index 0000000000000..0954ec9e7841a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BasePolicyRule.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** BasePolicyRule BasePolicy Rule. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = BasePolicyRule.class) +@JsonTypeName("BasePolicyRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AzureBackupRule", value = AzureBackupRule.class), + @JsonSubTypes.Type(name = "AzureRetentionRule", value = AzureRetentionRule.class) +}) +@Fluent +public class BasePolicyRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BasePolicyRule.class); + + /* + * The name property. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the BasePolicyRule object itself. + */ + public BasePolicyRule withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model BasePolicyRule")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CheckNameAvailabilityRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..5d7e33500eb94 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** CheckNameAvailabilityRequest CheckNameAvailability Request. */ +@Fluent +public final class CheckNameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequest.class); + + /* + * Resource name for which availability needs to be checked + */ + @JsonProperty(value = "name") + private String name; + + /* + * Describes the Resource type: Microsoft.DataProtection/BackupVaults + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: Resource name for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Describes the Resource type: Microsoft.DataProtection/BackupVaults. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Describes the Resource type: Microsoft.DataProtection/BackupVaults. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CheckNameAvailabilityResult.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CheckNameAvailabilityResult.java new file mode 100644 index 0000000000000..d788c17384df7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CheckNameAvailabilityResult.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.resourcemanager.dataprotection.fluent.models.CheckNameAvailabilityResultInner; + +/** An immutable client-side representation of CheckNameAvailabilityResult. */ +public interface CheckNameAvailabilityResult { + /** + * Gets the message property: Gets or sets the message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the nameAvailable property: Gets or sets a value indicating whether [name available]. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Gets or sets the reason. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryDisplay.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryDisplay.java new file mode 100644 index 0000000000000..68e0504bca68e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** ClientDiscoveryDisplay Localized display information of an operation. */ +@Fluent +public final class ClientDiscoveryDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryDisplay.class); + + /* + * Description of the operation having details of what operation is about. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Operations Name itself. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Name of the provider for display purposes + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * ResourceType for which this Operation can be performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get the description property: Description of the operation having details of what operation is about. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation having details of what operation is about. + * + * @param description the description value to set. + * @return the ClientDiscoveryDisplay object itself. + */ + public ClientDiscoveryDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the operation property: Operations Name itself. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operations Name itself. + * + * @param operation the operation value to set. + * @return the ClientDiscoveryDisplay object itself. + */ + public ClientDiscoveryDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the provider property: Name of the provider for display purposes. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Name of the provider for display purposes. + * + * @param provider the provider value to set. + * @return the ClientDiscoveryDisplay object itself. + */ + public ClientDiscoveryDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: ResourceType for which this Operation can be performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: ResourceType for which this Operation can be performed. + * + * @param resource the resource value to set. + * @return the ClientDiscoveryDisplay object itself. + */ + public ClientDiscoveryDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForLogSpecification.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForLogSpecification.java new file mode 100644 index 0000000000000..9f4f0645a9607 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForLogSpecification.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** ClientDiscoveryForLogSpecification Class to represent shoebox log specification in json client discovery. */ +@Fluent +public final class ClientDiscoveryForLogSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryForLogSpecification.class); + + /* + * blob duration of shoebox log specification + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /* + * Localized display name + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Name for shoebox log specification. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the blobDuration property: blob duration of shoebox log specification. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration property: blob duration of shoebox log specification. + * + * @param blobDuration the blobDuration value to set. + * @return the ClientDiscoveryForLogSpecification object itself. + */ + public ClientDiscoveryForLogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + + /** + * Get the displayName property: Localized display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized display name. + * + * @param displayName the displayName value to set. + * @return the ClientDiscoveryForLogSpecification object itself. + */ + public ClientDiscoveryForLogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the name property: Name for shoebox log specification. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name for shoebox log specification. + * + * @param name the name value to set. + * @return the ClientDiscoveryForLogSpecification object itself. + */ + public ClientDiscoveryForLogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForProperties.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForProperties.java new file mode 100644 index 0000000000000..f862ba6d75ed5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForProperties.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.dataprotection.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; + +/** ClientDiscoveryForProperties Class to represent shoebox properties in json client discovery. */ +@Fluent +public final class ClientDiscoveryForProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryForProperties.class); + + /* + * ClientDiscoveryForServiceSpecification Operation properties. + */ + @JsonProperty(value = "serviceSpecification") + private ClientDiscoveryForServiceSpecification serviceSpecification; + + /** + * Get the serviceSpecification property: ClientDiscoveryForServiceSpecification Operation properties. + * + * @return the serviceSpecification value. + */ + public ClientDiscoveryForServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: ClientDiscoveryForServiceSpecification Operation properties. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the ClientDiscoveryForProperties object itself. + */ + public ClientDiscoveryForProperties withServiceSpecification( + ClientDiscoveryForServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForServiceSpecification.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForServiceSpecification.java new file mode 100644 index 0000000000000..4098ea8dd0f8f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForServiceSpecification.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** ClientDiscoveryForServiceSpecification Class to represent shoebox service specification in json client discovery. */ +@Fluent +public final class ClientDiscoveryForServiceSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryForServiceSpecification.class); + + /* + * List of log specifications of this operation. + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /** + * Get the logSpecifications property: List of log specifications of this operation. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set the logSpecifications property: List of log specifications of this operation. + * + * @param logSpecifications the logSpecifications value to set. + * @return the ClientDiscoveryForServiceSpecification object itself. + */ + public ClientDiscoveryForServiceSpecification withLogSpecifications( + List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryResponse.java new file mode 100644 index 0000000000000..e6e95986c7f1f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** ClientDiscoveryResponse Operations List response which contains list of available APIs. */ +@Fluent +public final class ClientDiscoveryResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryResponse.class); + + /* + * Link to the next chunk of Response. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * List of available operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: Link to the next chunk of Response. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to the next chunk of Response. + * + * @param nextLink the nextLink value to set. + * @return the ClientDiscoveryResponse object itself. + */ + public ClientDiscoveryResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: List of available operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of available operations. + * + * @param value the value value to set. + * @return the ClientDiscoveryResponse object itself. + */ + public ClientDiscoveryResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryValueForSingleApi.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryValueForSingleApi.java new file mode 100644 index 0000000000000..655be1f4028dd --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryValueForSingleApi.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.dataprotection.models; + +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; + +/** An immutable client-side representation of ClientDiscoveryValueForSingleApi. */ +public interface ClientDiscoveryValueForSingleApi { + /** + * Gets the display property: ClientDiscoveryDisplay Contains the localized display information for this particular + * operation. + * + * @return the display value. + */ + ClientDiscoveryDisplay display(); + + /** + * Gets the name property: Name of the Operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the origin property: The intended executor of the operation;governs the display of the operation in the RBAC + * UX and the audit logs UX. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: ClientDiscoveryForProperties Properties for the given operation. + * + * @return the properties value. + */ + ClientDiscoveryForProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner + * object. + * + * @return the inner object. + */ + ClientDiscoveryValueForSingleApiInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CopyOnExpiryOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CopyOnExpiryOption.java new file mode 100644 index 0000000000000..317875f741ae8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CopyOnExpiryOption.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** CopyOnExpiryOption Copy on Expiry Option. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("CopyOnExpiryOption") +@Immutable +public final class CopyOnExpiryOption extends CopyOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CopyOnExpiryOption.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CopyOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CopyOption.java new file mode 100644 index 0000000000000..3f7fc22bad7d5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CopyOption.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** CopyOption Options to copy. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = CopyOption.class) +@JsonTypeName("CopyOption") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "CopyOnExpiryOption", value = CopyOnExpiryOption.class), + @JsonSubTypes.Type(name = "CustomCopyOption", value = CustomCopyOption.class), + @JsonSubTypes.Type(name = "ImmediateCopyOption", value = ImmediateCopyOption.class) +}) +@Immutable +public class CopyOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CopyOption.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CurrentProtectionState.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CurrentProtectionState.java new file mode 100644 index 0000000000000..345cea016f48e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CurrentProtectionState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CurrentProtectionState. */ +public final class CurrentProtectionState extends ExpandableStringEnum { + /** Static value Invalid for CurrentProtectionState. */ + public static final CurrentProtectionState INVALID = fromString("Invalid"); + + /** Static value NotProtected for CurrentProtectionState. */ + public static final CurrentProtectionState NOT_PROTECTED = fromString("NotProtected"); + + /** Static value ConfiguringProtection for CurrentProtectionState. */ + public static final CurrentProtectionState CONFIGURING_PROTECTION = fromString("ConfiguringProtection"); + + /** Static value ProtectionConfigured for CurrentProtectionState. */ + public static final CurrentProtectionState PROTECTION_CONFIGURED = fromString("ProtectionConfigured"); + + /** Static value BackupSchedulesSuspended for CurrentProtectionState. */ + public static final CurrentProtectionState BACKUP_SCHEDULES_SUSPENDED = fromString("BackupSchedulesSuspended"); + + /** Static value RetentionSchedulesSuspended for CurrentProtectionState. */ + public static final CurrentProtectionState RETENTION_SCHEDULES_SUSPENDED = + fromString("RetentionSchedulesSuspended"); + + /** Static value ProtectionStopped for CurrentProtectionState. */ + public static final CurrentProtectionState PROTECTION_STOPPED = fromString("ProtectionStopped"); + + /** Static value ProtectionError for CurrentProtectionState. */ + public static final CurrentProtectionState PROTECTION_ERROR = fromString("ProtectionError"); + + /** Static value ConfiguringProtectionFailed for CurrentProtectionState. */ + public static final CurrentProtectionState CONFIGURING_PROTECTION_FAILED = + fromString("ConfiguringProtectionFailed"); + + /** Static value SoftDeleting for CurrentProtectionState. */ + public static final CurrentProtectionState SOFT_DELETING = fromString("SoftDeleting"); + + /** Static value SoftDeleted for CurrentProtectionState. */ + public static final CurrentProtectionState SOFT_DELETED = fromString("SoftDeleted"); + + /** Static value UpdatingProtection for CurrentProtectionState. */ + public static final CurrentProtectionState UPDATING_PROTECTION = fromString("UpdatingProtection"); + + /** + * Creates or finds a CurrentProtectionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding CurrentProtectionState. + */ + @JsonCreator + public static CurrentProtectionState fromString(String name) { + return fromString(name, CurrentProtectionState.class); + } + + /** @return known CurrentProtectionState values. */ + public static Collection values() { + return values(CurrentProtectionState.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CustomCopyOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CustomCopyOption.java new file mode 100644 index 0000000000000..15db2dd13a4d7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CustomCopyOption.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** CustomCopyOption Duration based custom options to copy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("CustomCopyOption") +@Fluent +public final class CustomCopyOption extends CopyOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomCopyOption.class); + + /* + * Data copied after given timespan + */ + @JsonProperty(value = "duration") + private String duration; + + /** + * Get the duration property: Data copied after given timespan. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: Data copied after given timespan. + * + * @param duration the duration value to set. + * @return the CustomCopyOption object itself. + */ + public CustomCopyOption withDuration(String duration) { + this.duration = duration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataProtectionOperations.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataProtectionOperations.java new file mode 100644 index 0000000000000..b0259965b3268 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataProtectionOperations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DataProtectionOperations. */ +public interface DataProtectionOperations { + /** + * Returns the list of available operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return clientDiscoveryResponse. + */ + PagedIterable list(); + + /** + * Returns the list of available operations. + * + * @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 clientDiscoveryResponse. + */ + PagedIterable list(Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataProtections.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataProtections.java new file mode 100644 index 0000000000000..9fd9430121dde --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataProtections.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataProtections. */ +public interface DataProtections { + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for Backup Feature support. + */ + FeatureValidationResponseBase checkFeatureSupport(String location, FeatureValidationRequestBase parameters); + + /** + * Validates if a feature is supported. + * + * @param location The location parameter. + * @param parameters Feature support request object. + * @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 base class for Backup Feature support. + */ + Response checkFeatureSupportWithResponse( + String location, FeatureValidationRequestBase parameters, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreInfoBase.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreInfoBase.java new file mode 100644 index 0000000000000..42e35f9d92e11 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreInfoBase.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** DataStoreInfoBase DataStoreInfo base. */ +@Fluent +public final class DataStoreInfoBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataStoreInfoBase.class); + + /* + * type of datastore; Operational/Vault/Archive + */ + @JsonProperty(value = "dataStoreType", required = true) + private DataStoreTypes dataStoreType; + + /* + * Type of Datasource object, used to initialize the right inherited type + */ + @JsonProperty(value = "objectType", required = true) + private String objectType; + + /** + * Get the dataStoreType property: type of datastore; Operational/Vault/Archive. + * + * @return the dataStoreType value. + */ + public DataStoreTypes dataStoreType() { + return this.dataStoreType; + } + + /** + * Set the dataStoreType property: type of datastore; Operational/Vault/Archive. + * + * @param dataStoreType the dataStoreType value to set. + * @return the DataStoreInfoBase object itself. + */ + public DataStoreInfoBase withDataStoreType(DataStoreTypes dataStoreType) { + this.dataStoreType = dataStoreType; + return this; + } + + /** + * Get the objectType property: Type of Datasource object, used to initialize the right inherited type. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: Type of Datasource object, used to initialize the right inherited type. + * + * @param objectType the objectType value to set. + * @return the DataStoreInfoBase object itself. + */ + public DataStoreInfoBase withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataStoreType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataStoreType in model DataStoreInfoBase")); + } + if (objectType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property objectType in model DataStoreInfoBase")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreParameters.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreParameters.java new file mode 100644 index 0000000000000..84ea553cc511f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreParameters.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Parameters for DataStore. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = DataStoreParameters.class) +@JsonTypeName("DataStoreParameters") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AzureOperationalStoreParameters", value = AzureOperationalStoreParameters.class) +}) +@Fluent +public class DataStoreParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataStoreParameters.class); + + /* + * type of datastore; Operational/Vault/Archive + */ + @JsonProperty(value = "dataStoreType", required = true) + private DataStoreTypes dataStoreType; + + /** + * Get the dataStoreType property: type of datastore; Operational/Vault/Archive. + * + * @return the dataStoreType value. + */ + public DataStoreTypes dataStoreType() { + return this.dataStoreType; + } + + /** + * Set the dataStoreType property: type of datastore; Operational/Vault/Archive. + * + * @param dataStoreType the dataStoreType value to set. + * @return the DataStoreParameters object itself. + */ + public DataStoreParameters withDataStoreType(DataStoreTypes dataStoreType) { + this.dataStoreType = dataStoreType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataStoreType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dataStoreType in model DataStoreParameters")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreTypes.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreTypes.java new file mode 100644 index 0000000000000..6e57b84f201c9 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataStoreTypes. */ +public final class DataStoreTypes extends ExpandableStringEnum { + /** Static value OperationalStore for DataStoreTypes. */ + public static final DataStoreTypes OPERATIONAL_STORE = fromString("OperationalStore"); + + /** Static value VaultStore for DataStoreTypes. */ + public static final DataStoreTypes VAULT_STORE = fromString("VaultStore"); + + /** Static value ArchiveStore for DataStoreTypes. */ + public static final DataStoreTypes ARCHIVE_STORE = fromString("ArchiveStore"); + + /** + * Creates or finds a DataStoreTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataStoreTypes. + */ + @JsonCreator + public static DataStoreTypes fromString(String name) { + return fromString(name, DataStoreTypes.class); + } + + /** @return known DataStoreTypes values. */ + public static Collection values() { + return values(DataStoreTypes.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Datasource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Datasource.java new file mode 100644 index 0000000000000..056cf65e5a346 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Datasource.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** Datasource Datasource to be backed up. */ +@Fluent +public final class Datasource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Datasource.class); + + /* + * DatasourceType of the resource. + */ + @JsonProperty(value = "datasourceType") + private String datasourceType; + + /* + * Type of Datasource object, used to initialize the right inherited type + */ + @JsonProperty(value = "objectType") + private String objectType; + + /* + * Full ARM ID of the resource. For azure resources, this is ARM ID. For + * non azure resources, this will be the ID created by backup service via + * Fabric/Vault. + */ + @JsonProperty(value = "resourceID", required = true) + private String resourceId; + + /* + * Location of datasource. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /* + * Unique identifier of the resource in the context of parent. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * Resource Type of Datasource. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * Uri of the resource. + */ + @JsonProperty(value = "resourceUri") + private String resourceUri; + + /** + * Get the datasourceType property: DatasourceType of the resource. + * + * @return the datasourceType value. + */ + public String datasourceType() { + return this.datasourceType; + } + + /** + * Set the datasourceType property: DatasourceType of the resource. + * + * @param datasourceType the datasourceType value to set. + * @return the Datasource object itself. + */ + public Datasource withDatasourceType(String datasourceType) { + this.datasourceType = datasourceType; + return this; + } + + /** + * Get the objectType property: Type of Datasource object, used to initialize the right inherited type. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: Type of Datasource object, used to initialize the right inherited type. + * + * @param objectType the objectType value to set. + * @return the Datasource object itself. + */ + public Datasource withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Get the resourceId property: Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure + * resources, this will be the ID created by backup service via Fabric/Vault. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure + * resources, this will be the ID created by backup service via Fabric/Vault. + * + * @param resourceId the resourceId value to set. + * @return the Datasource object itself. + */ + public Datasource withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the resourceLocation property: Location of datasource. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set the resourceLocation property: Location of datasource. + * + * @param resourceLocation the resourceLocation value to set. + * @return the Datasource object itself. + */ + public Datasource withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get the resourceName property: Unique identifier of the resource in the context of parent. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: Unique identifier of the resource in the context of parent. + * + * @param resourceName the resourceName value to set. + * @return the Datasource object itself. + */ + public Datasource withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the resourceType property: Resource Type of Datasource. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource Type of Datasource. + * + * @param resourceType the resourceType value to set. + * @return the Datasource object itself. + */ + public Datasource withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceUri property: Uri of the resource. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Set the resourceUri property: Uri of the resource. + * + * @param resourceUri the resourceUri value to set. + * @return the Datasource object itself. + */ + public Datasource withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property resourceId in model Datasource")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DatasourceSet.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DatasourceSet.java new file mode 100644 index 0000000000000..7c641592bee41 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DatasourceSet.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** DatasourceSet DatasourceSet details of datasource to be backed up. */ +@Fluent +public final class DatasourceSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatasourceSet.class); + + /* + * DatasourceType of the resource. + */ + @JsonProperty(value = "datasourceType") + private String datasourceType; + + /* + * Type of Datasource object, used to initialize the right inherited type + */ + @JsonProperty(value = "objectType") + private String objectType; + + /* + * Full ARM ID of the resource. For azure resources, this is ARM ID. For + * non azure resources, this will be the ID created by backup service via + * Fabric/Vault. + */ + @JsonProperty(value = "resourceID", required = true) + private String resourceId; + + /* + * Location of datasource. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /* + * Unique identifier of the resource in the context of parent. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * Resource Type of Datasource. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * Uri of the resource. + */ + @JsonProperty(value = "resourceUri") + private String resourceUri; + + /** + * Get the datasourceType property: DatasourceType of the resource. + * + * @return the datasourceType value. + */ + public String datasourceType() { + return this.datasourceType; + } + + /** + * Set the datasourceType property: DatasourceType of the resource. + * + * @param datasourceType the datasourceType value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withDatasourceType(String datasourceType) { + this.datasourceType = datasourceType; + return this; + } + + /** + * Get the objectType property: Type of Datasource object, used to initialize the right inherited type. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: Type of Datasource object, used to initialize the right inherited type. + * + * @param objectType the objectType value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Get the resourceId property: Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure + * resources, this will be the ID created by backup service via Fabric/Vault. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure + * resources, this will be the ID created by backup service via Fabric/Vault. + * + * @param resourceId the resourceId value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the resourceLocation property: Location of datasource. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set the resourceLocation property: Location of datasource. + * + * @param resourceLocation the resourceLocation value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get the resourceName property: Unique identifier of the resource in the context of parent. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: Unique identifier of the resource in the context of parent. + * + * @param resourceName the resourceName value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the resourceType property: Resource Type of Datasource. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource Type of Datasource. + * + * @param resourceType the resourceType value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceUri property: Uri of the resource. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Set the resourceUri property: Uri of the resource. + * + * @param resourceUri the resourceUri value to set. + * @return the DatasourceSet object itself. + */ + public DatasourceSet withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property resourceId in model DatasourceSet")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Day.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Day.java new file mode 100644 index 0000000000000..66f9b6663ab90 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Day.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** Day Day of the week. */ +@Fluent +public final class Day { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Day.class); + + /* + * Date of the month + */ + @JsonProperty(value = "date") + private Integer date; + + /* + * Whether Date is last date of month + */ + @JsonProperty(value = "isLast") + private Boolean isLast; + + /** + * Get the date property: Date of the month. + * + * @return the date value. + */ + public Integer date() { + return this.date; + } + + /** + * Set the date property: Date of the month. + * + * @param date the date value to set. + * @return the Day object itself. + */ + public Day withDate(Integer date) { + this.date = date; + return this; + } + + /** + * Get the isLast property: Whether Date is last date of month. + * + * @return the isLast value. + */ + public Boolean isLast() { + return this.isLast; + } + + /** + * Set the isLast property: Whether Date is last date of month. + * + * @param isLast the isLast value to set. + * @return the Day object itself. + */ + public Day withIsLast(Boolean isLast) { + this.isLast = isLast; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DayOfWeek.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DayOfWeek.java new file mode 100644 index 0000000000000..0c67c4a596886 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DayOfWeek.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DayOfWeek. */ +public final class DayOfWeek extends ExpandableStringEnum { + /** Static value Friday for DayOfWeek. */ + public static final DayOfWeek FRIDAY = fromString("Friday"); + + /** Static value Monday for DayOfWeek. */ + public static final DayOfWeek MONDAY = fromString("Monday"); + + /** Static value Saturday for DayOfWeek. */ + public static final DayOfWeek SATURDAY = fromString("Saturday"); + + /** Static value Sunday for DayOfWeek. */ + public static final DayOfWeek SUNDAY = fromString("Sunday"); + + /** Static value Thursday for DayOfWeek. */ + public static final DayOfWeek THURSDAY = fromString("Thursday"); + + /** Static value Tuesday for DayOfWeek. */ + public static final DayOfWeek TUESDAY = fromString("Tuesday"); + + /** Static value Wednesday for DayOfWeek. */ + public static final DayOfWeek WEDNESDAY = fromString("Wednesday"); + + /** + * Creates or finds a DayOfWeek from its string representation. + * + * @param name a name to look for. + * @return the corresponding DayOfWeek. + */ + @JsonCreator + public static DayOfWeek fromString(String name) { + return fromString(name, DayOfWeek.class); + } + + /** @return known DayOfWeek values. */ + public static Collection values() { + return values(DayOfWeek.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DeleteOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DeleteOption.java new file mode 100644 index 0000000000000..f3259696a62bf --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DeleteOption.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** DeleteOption Delete Option. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = DeleteOption.class) +@JsonTypeName("DeleteOption") +@JsonSubTypes({@JsonSubTypes.Type(name = "AbsoluteDeleteOption", value = AbsoluteDeleteOption.class)}) +@Fluent +public class DeleteOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeleteOption.class); + + /* + * Duration of deletion after given timespan + */ + @JsonProperty(value = "duration", required = true) + private String duration; + + /** + * Get the duration property: Duration of deletion after given timespan. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: Duration of deletion after given timespan. + * + * @param duration the duration value to set. + * @return the DeleteOption object itself. + */ + public DeleteOption withDuration(String duration) { + this.duration = duration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (duration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property duration in model DeleteOption")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppBaseResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppBaseResource.java new file mode 100644 index 0000000000000..699fcd7053dad --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppBaseResource.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner; + +/** An immutable client-side representation of DppBaseResource. */ +public interface DppBaseResource { + /** + * Gets the id property: Resource Id represents the complete path to the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name associated with the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type represents the complete path of the form + * Namespace/ResourceType/ResourceType/... + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner object. + * + * @return the inner object. + */ + DppBaseResourceInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppBaseResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppBaseResourceList.java new file mode 100644 index 0000000000000..bed05220dca27 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppBaseResourceList.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.DppBaseResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Base for all lists of V2 resources. */ +@Fluent +public final class DppBaseResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppBaseResourceList.class); + + /* + * List of Dpp resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The uri to fetch the next page of resources. Call ListNext() fetches + * next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of Dpp resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Dpp resources. + * + * @param value the value value to set. + * @return the DppBaseResourceList object itself. + */ + public DppBaseResourceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of resources. Call ListNext() fetches next page of + * resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of resources. Call ListNext() fetches next page of + * resources. + * + * @param nextLink the nextLink value to set. + * @return the DppBaseResourceList object itself. + */ + public DppBaseResourceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppIdentityDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppIdentityDetails.java new file mode 100644 index 0000000000000..e585b84f4d179 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppIdentityDetails.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** DppIdentityDetails Identity details. */ +@Fluent +public final class DppIdentityDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppIdentityDetails.class); + + /* + * The object ID of the service principal object for the managed identity + * that is used to grant role-based access to an Azure resource. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * A Globally Unique Identifier (GUID) that represents the Azure AD tenant + * where the resource is now a member. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identityType which can be either SystemAssigned or None + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the principalId property: The object ID of the service principal object for the managed identity that is used + * to grant role-based access to an Azure resource. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the + * resource is now a member. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identityType which can be either SystemAssigned or None. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The identityType which can be either SystemAssigned or None. + * + * @param type the type value to set. + * @return the DppIdentityDetails object itself. + */ + public DppIdentityDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResource.java new file mode 100644 index 0000000000000..c001e9d36f4bf --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** DppResource Resource class. */ +@Immutable +public class DppResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppResource.class); + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResourceList.java new file mode 100644 index 0000000000000..0d1e769b96ca4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResourceList.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** List Resource ListResource. */ +@Fluent +public class DppResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppResourceList.class); + + /* + * The uri to fetch the next page of resources. Call ListNext() fetches + * next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the nextLink property: The uri to fetch the next page of resources. Call ListNext() fetches next page of + * resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of resources. Call ListNext() fetches next page of + * resources. + * + * @param nextLink the nextLink value to set. + * @return the DppResourceList object itself. + */ + public DppResourceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResource.java new file mode 100644 index 0000000000000..6a2f990adca3f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResource.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The DppTrackedResource model. */ +@Fluent +public class DppTrackedResource extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppTrackedResource.class); + + /* + * Optional ETag. + */ + @JsonProperty(value = "eTag") + private String etag; + + /* + * DppIdentityDetails Input Managed Identity Details + */ + @JsonProperty(value = "identity") + private DppIdentityDetails identity; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the etag property: Optional ETag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Optional ETag. + * + * @param etag the etag value to set. + * @return the DppTrackedResource object itself. + */ + public DppTrackedResource withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @return the identity value. + */ + public DppIdentityDetails identity() { + return this.identity; + } + + /** + * Set the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @param identity the identity value to set. + * @return the DppTrackedResource object itself. + */ + public DppTrackedResource withIdentity(DppIdentityDetails identity) { + this.identity = identity; + 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 DppTrackedResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DppTrackedResource withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResourceList.java new file mode 100644 index 0000000000000..0f8e080c0f571 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResourceList.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 DppTrackedResourceList model. */ +@Fluent +public class DppTrackedResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppTrackedResourceList.class); + + /* + * The uri to fetch the next page of resources. Call ListNext() fetches + * next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the nextLink property: The uri to fetch the next page of resources. Call ListNext() fetches next page of + * resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of resources. Call ListNext() fetches next page of + * resources. + * + * @param nextLink the nextLink value to set. + * @return the DppTrackedResourceList object itself. + */ + public DppTrackedResourceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppWorkerRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppWorkerRequest.java new file mode 100644 index 0000000000000..c65813fa3196b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppWorkerRequest.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The DppWorkerRequest model. */ +@Fluent +public class DppWorkerRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DppWorkerRequest.class); + + /* + * The subscriptionId property. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * The uri property. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Dictionary of + * + */ + @JsonProperty(value = "headers") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map> headers; + + /* + * The supportedGroupVersions property. + */ + @JsonProperty(value = "supportedGroupVersions") + private List supportedGroupVersions; + + /* + * The cultureInfo property. + */ + @JsonProperty(value = "cultureInfo") + private String cultureInfo; + + /* + * Dictionary of + */ + @JsonProperty(value = "parameters") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map parameters; + + /* + * The httpMethod property. + */ + @JsonProperty(value = "httpMethod") + private String httpMethod; + + /** + * Get the subscriptionId property: The subscriptionId property. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscriptionId property. + * + * @param subscriptionId the subscriptionId value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the uri property: The uri property. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The uri property. + * + * @param uri the uri value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the headers property: Dictionary of + * <components·ikn5y4·schemas·dppworkerrequest·properties·headers·additionalproperties>. + * + * @return the headers value. + */ + public Map> headers() { + return this.headers; + } + + /** + * Set the headers property: Dictionary of + * <components·ikn5y4·schemas·dppworkerrequest·properties·headers·additionalproperties>. + * + * @param headers the headers value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withHeaders(Map> headers) { + this.headers = headers; + return this; + } + + /** + * Get the supportedGroupVersions property: The supportedGroupVersions property. + * + * @return the supportedGroupVersions value. + */ + public List supportedGroupVersions() { + return this.supportedGroupVersions; + } + + /** + * Set the supportedGroupVersions property: The supportedGroupVersions property. + * + * @param supportedGroupVersions the supportedGroupVersions value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withSupportedGroupVersions(List supportedGroupVersions) { + this.supportedGroupVersions = supportedGroupVersions; + return this; + } + + /** + * Get the cultureInfo property: The cultureInfo property. + * + * @return the cultureInfo value. + */ + public String cultureInfo() { + return this.cultureInfo; + } + + /** + * Set the cultureInfo property: The cultureInfo property. + * + * @param cultureInfo the cultureInfo value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withCultureInfo(String cultureInfo) { + this.cultureInfo = cultureInfo; + return this; + } + + /** + * Get the parameters property: Dictionary of <string>. + * + * @return the parameters value. + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Dictionary of <string>. + * + * @param parameters the parameters value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the httpMethod property: The httpMethod property. + * + * @return the httpMethod value. + */ + public String httpMethod() { + return this.httpMethod; + } + + /** + * Set the httpMethod property: The httpMethod property. + * + * @param httpMethod the httpMethod value to set. + * @return the DppWorkerRequest object itself. + */ + public DppWorkerRequest withHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobs.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobs.java new file mode 100644 index 0000000000000..e57a9732a743f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobs.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.Context; + +/** Resource collection API of ExportJobs. */ +public interface ExportJobs { + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void trigger(String resourceGroupName, String vaultName); + + /** + * Triggers export of jobs and returns an OperationID to track. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void trigger(String resourceGroupName, String vaultName, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsOperationResults.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsOperationResults.java new file mode 100644 index 0000000000000..5c011ef84fefa --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsOperationResults.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ExportJobsOperationResults. */ +public interface ExportJobsOperationResults { + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of operation triggered by Export Jobs API. + */ + ExportJobsResult get(String resourceGroupName, String vaultName, String operationId); + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also + * contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized + * format. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @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 of operation triggered by Export Jobs API. + */ + Response getWithResponse( + String resourceGroupName, String vaultName, String operationId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsResult.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsResult.java new file mode 100644 index 0000000000000..2263f8eb650c7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.resourcemanager.dataprotection.fluent.models.ExportJobsResultInner; + +/** An immutable client-side representation of ExportJobsResult. */ +public interface ExportJobsResult { + /** + * Gets the blobUrl property: URL of the blob into which the serialized string of list of jobs is exported. + * + * @return the blobUrl value. + */ + String blobUrl(); + + /** + * Gets the blobSasKey property: SAS key to access the blob. + * + * @return the blobSasKey value. + */ + String blobSasKey(); + + /** + * Gets the excelFileBlobUrl property: URL of the blob into which the ExcelFile is uploaded. + * + * @return the excelFileBlobUrl value. + */ + String excelFileBlobUrl(); + + /** + * Gets the excelFileBlobSasKey property: SAS key to access the ExcelFile blob. + * + * @return the excelFileBlobSasKey value. + */ + String excelFileBlobSasKey(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.ExportJobsResultInner object. + * + * @return the inner object. + */ + ExportJobsResultInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsTriggerHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsTriggerHeaders.java new file mode 100644 index 0000000000000..0bf1e8e6d19aa --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsTriggerHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 ExportJobsTriggerHeaders model. */ +@Fluent +public final class ExportJobsTriggerHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportJobsTriggerHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the ExportJobsTriggerHeaders object itself. + */ + public ExportJobsTriggerHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the ExportJobsTriggerHeaders object itself. + */ + public ExportJobsTriggerHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsTriggerResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsTriggerResponse.java new file mode 100644 index 0000000000000..01d12acd48fad --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ExportJobsTriggerResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the trigger operation. */ +public final class ExportJobsTriggerResponse extends ResponseBase { + /** + * Creates an instance of ExportJobsTriggerResponse. + * + * @param request the request which resulted in this ExportJobsTriggerResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ExportJobsTriggerResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ExportJobsTriggerHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureSupportStatus.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureSupportStatus.java new file mode 100644 index 0000000000000..78a88f1d7971d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureSupportStatus.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FeatureSupportStatus. */ +public final class FeatureSupportStatus extends ExpandableStringEnum { + /** Static value Invalid for FeatureSupportStatus. */ + public static final FeatureSupportStatus INVALID = fromString("Invalid"); + + /** Static value NotSupported for FeatureSupportStatus. */ + public static final FeatureSupportStatus NOT_SUPPORTED = fromString("NotSupported"); + + /** Static value AlphaPreview for FeatureSupportStatus. */ + public static final FeatureSupportStatus ALPHA_PREVIEW = fromString("AlphaPreview"); + + /** Static value PrivatePreview for FeatureSupportStatus. */ + public static final FeatureSupportStatus PRIVATE_PREVIEW = fromString("PrivatePreview"); + + /** Static value PublicPreview for FeatureSupportStatus. */ + public static final FeatureSupportStatus PUBLIC_PREVIEW = fromString("PublicPreview"); + + /** Static value GenerallyAvailable for FeatureSupportStatus. */ + public static final FeatureSupportStatus GENERALLY_AVAILABLE = fromString("GenerallyAvailable"); + + /** + * Creates or finds a FeatureSupportStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding FeatureSupportStatus. + */ + @JsonCreator + public static FeatureSupportStatus fromString(String name) { + return fromString(name, FeatureSupportStatus.class); + } + + /** @return known FeatureSupportStatus values. */ + public static Collection values() { + return values(FeatureSupportStatus.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureType.java new file mode 100644 index 0000000000000..f79b9b1340789 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureType.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.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FeatureType. */ +public final class FeatureType extends ExpandableStringEnum { + /** Static value Invalid for FeatureType. */ + public static final FeatureType INVALID = fromString("Invalid"); + + /** Static value DataSourceType for FeatureType. */ + public static final FeatureType DATA_SOURCE_TYPE = fromString("DataSourceType"); + + /** + * Creates or finds a FeatureType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FeatureType. + */ + @JsonCreator + public static FeatureType fromString(String name) { + return fromString(name, FeatureType.class); + } + + /** @return known FeatureType values. */ + public static Collection values() { + return values(FeatureType.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationRequest.java new file mode 100644 index 0000000000000..c7a6f237d7705 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationRequest.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Base class for feature object. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("FeatureValidationRequest") +@Fluent +public final class FeatureValidationRequest extends FeatureValidationRequestBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FeatureValidationRequest.class); + + /* + * backup support feature type. + */ + @JsonProperty(value = "featureType") + private FeatureType featureType; + + /* + * backup support feature name. + */ + @JsonProperty(value = "featureName") + private String featureName; + + /** + * Get the featureType property: backup support feature type. + * + * @return the featureType value. + */ + public FeatureType featureType() { + return this.featureType; + } + + /** + * Set the featureType property: backup support feature type. + * + * @param featureType the featureType value to set. + * @return the FeatureValidationRequest object itself. + */ + public FeatureValidationRequest withFeatureType(FeatureType featureType) { + this.featureType = featureType; + return this; + } + + /** + * Get the featureName property: backup support feature name. + * + * @return the featureName value. + */ + public String featureName() { + return this.featureName; + } + + /** + * Set the featureName property: backup support feature name. + * + * @param featureName the featureName value to set. + * @return the FeatureValidationRequest object itself. + */ + public FeatureValidationRequest withFeatureName(String featureName) { + this.featureName = featureName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationRequestBase.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationRequestBase.java new file mode 100644 index 0000000000000..d2512c6234794 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationRequestBase.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Base class for Backup Feature support. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = FeatureValidationRequestBase.class) +@JsonTypeName("FeatureValidationRequestBase") +@JsonSubTypes({@JsonSubTypes.Type(name = "FeatureValidationRequest", value = FeatureValidationRequest.class)}) +@Immutable +public class FeatureValidationRequestBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FeatureValidationRequestBase.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationResponse.java new file mode 100644 index 0000000000000..4c15bdee23151 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationResponse.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Feature Validation Response. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("FeatureValidationResponse") +@Fluent +public final class FeatureValidationResponse extends FeatureValidationResponseBaseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FeatureValidationResponse.class); + + /* + * backup support feature type. + */ + @JsonProperty(value = "featureType") + private FeatureType featureType; + + /* + * Response features + */ + @JsonProperty(value = "features") + private List features; + + /** + * Get the featureType property: backup support feature type. + * + * @return the featureType value. + */ + public FeatureType featureType() { + return this.featureType; + } + + /** + * Set the featureType property: backup support feature type. + * + * @param featureType the featureType value to set. + * @return the FeatureValidationResponse object itself. + */ + public FeatureValidationResponse withFeatureType(FeatureType featureType) { + this.featureType = featureType; + return this; + } + + /** + * Get the features property: Response features. + * + * @return the features value. + */ + public List features() { + return this.features; + } + + /** + * Set the features property: Response features. + * + * @param features the features value to set. + * @return the FeatureValidationResponse object itself. + */ + public FeatureValidationResponse withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (features() != null) { + features().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationResponseBase.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationResponseBase.java new file mode 100644 index 0000000000000..1d462443c14b0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/FeatureValidationResponseBase.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; + +/** An immutable client-side representation of FeatureValidationResponseBase. */ +public interface FeatureValidationResponseBase { + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner object. + * + * @return the inner object. + */ + FeatureValidationResponseBaseInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ImmediateCopyOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ImmediateCopyOption.java new file mode 100644 index 0000000000000..8885417428fee --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ImmediateCopyOption.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** ImmediateCopyOption Immediate copy Option. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("ImmediateCopyOption") +@Immutable +public final class ImmediateCopyOption extends CopyOption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImmediateCopyOption.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/InnerError.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/InnerError.java new file mode 100644 index 0000000000000..1acf073b438ea --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/InnerError.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** InnerError Inner Error. */ +@Fluent +public final class InnerError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InnerError.class); + + /* + * Any Key value pairs that can be provided to the client for additional + * verbose information. + */ + @JsonProperty(value = "additionalInfo") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map additionalInfo; + + /* + * Unique code for this error + */ + @JsonProperty(value = "code") + private String code; + + /* + * InnerError Child Inner Error, to allow Nesting. + */ + @JsonProperty(value = "embeddedInnerError") + private InnerError embeddedInnerError; + + /** + * Get the additionalInfo property: Any Key value pairs that can be provided to the client for additional verbose + * information. + * + * @return the additionalInfo value. + */ + public Map additionalInfo() { + return this.additionalInfo; + } + + /** + * Set the additionalInfo property: Any Key value pairs that can be provided to the client for additional verbose + * information. + * + * @param additionalInfo the additionalInfo value to set. + * @return the InnerError object itself. + */ + public InnerError withAdditionalInfo(Map additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Get the code property: Unique code for this error. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Unique code for this error. + * + * @param code the code value to set. + * @return the InnerError object itself. + */ + public InnerError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the embeddedInnerError property: InnerError Child Inner Error, to allow Nesting. + * + * @return the embeddedInnerError value. + */ + public InnerError embeddedInnerError() { + return this.embeddedInnerError; + } + + /** + * Set the embeddedInnerError property: InnerError Child Inner Error, to allow Nesting. + * + * @param embeddedInnerError the embeddedInnerError value to set. + * @return the InnerError object itself. + */ + public InnerError withEmbeddedInnerError(InnerError embeddedInnerError) { + this.embeddedInnerError = embeddedInnerError; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (embeddedInnerError() != null) { + embeddedInnerError().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ItemLevelRestoreCriteria.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ItemLevelRestoreCriteria.java new file mode 100644 index 0000000000000..909ee0691e830 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ItemLevelRestoreCriteria.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Class to contain criteria for item level restore. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = ItemLevelRestoreCriteria.class) +@JsonTypeName("ItemLevelRestoreCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "RangeBasedItemLevelRestoreCriteria", value = RangeBasedItemLevelRestoreCriteria.class) +}) +@Immutable +public class ItemLevelRestoreCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ItemLevelRestoreCriteria.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ItemLevelRestoreTargetInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ItemLevelRestoreTargetInfo.java new file mode 100644 index 0000000000000..e5fa632e98ece --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ItemLevelRestoreTargetInfo.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Restore target info for Item level restore operation. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("ItemLevelRestoreTargetInfo") +@Fluent +public final class ItemLevelRestoreTargetInfo extends RestoreTargetInfoBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ItemLevelRestoreTargetInfo.class); + + /* + * Restore Criteria + */ + @JsonProperty(value = "restoreCriteria", required = true) + private List restoreCriteria; + + /* + * Datasource Information of target DS + */ + @JsonProperty(value = "datasourceInfo", required = true) + private Datasource datasourceInfo; + + /* + * DatasourceSet Information of target DS Set + */ + @JsonProperty(value = "datasourceSetInfo") + private DatasourceSet datasourceSetInfo; + + /* + * Credentials to use to authenticate with data source provider. + */ + @JsonProperty(value = "datasourceAuthCredentials") + private AuthCredentials datasourceAuthCredentials; + + /** + * Get the restoreCriteria property: Restore Criteria. + * + * @return the restoreCriteria value. + */ + public List restoreCriteria() { + return this.restoreCriteria; + } + + /** + * Set the restoreCriteria property: Restore Criteria. + * + * @param restoreCriteria the restoreCriteria value to set. + * @return the ItemLevelRestoreTargetInfo object itself. + */ + public ItemLevelRestoreTargetInfo withRestoreCriteria(List restoreCriteria) { + this.restoreCriteria = restoreCriteria; + return this; + } + + /** + * Get the datasourceInfo property: Datasource Information of target DS. + * + * @return the datasourceInfo value. + */ + public Datasource datasourceInfo() { + return this.datasourceInfo; + } + + /** + * Set the datasourceInfo property: Datasource Information of target DS. + * + * @param datasourceInfo the datasourceInfo value to set. + * @return the ItemLevelRestoreTargetInfo object itself. + */ + public ItemLevelRestoreTargetInfo withDatasourceInfo(Datasource datasourceInfo) { + this.datasourceInfo = datasourceInfo; + return this; + } + + /** + * Get the datasourceSetInfo property: DatasourceSet Information of target DS Set. + * + * @return the datasourceSetInfo value. + */ + public DatasourceSet datasourceSetInfo() { + return this.datasourceSetInfo; + } + + /** + * Set the datasourceSetInfo property: DatasourceSet Information of target DS Set. + * + * @param datasourceSetInfo the datasourceSetInfo value to set. + * @return the ItemLevelRestoreTargetInfo object itself. + */ + public ItemLevelRestoreTargetInfo withDatasourceSetInfo(DatasourceSet datasourceSetInfo) { + this.datasourceSetInfo = datasourceSetInfo; + return this; + } + + /** + * Get the datasourceAuthCredentials property: Credentials to use to authenticate with data source provider. + * + * @return the datasourceAuthCredentials value. + */ + public AuthCredentials datasourceAuthCredentials() { + return this.datasourceAuthCredentials; + } + + /** + * Set the datasourceAuthCredentials property: Credentials to use to authenticate with data source provider. + * + * @param datasourceAuthCredentials the datasourceAuthCredentials value to set. + * @return the ItemLevelRestoreTargetInfo object itself. + */ + public ItemLevelRestoreTargetInfo withDatasourceAuthCredentials(AuthCredentials datasourceAuthCredentials) { + this.datasourceAuthCredentials = datasourceAuthCredentials; + return this; + } + + /** {@inheritDoc} */ + @Override + public ItemLevelRestoreTargetInfo withRecoveryOption(RecoveryOption recoveryOption) { + super.withRecoveryOption(recoveryOption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ItemLevelRestoreTargetInfo withRestoreLocation(String restoreLocation) { + super.withRestoreLocation(restoreLocation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (restoreCriteria() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restoreCriteria in model ItemLevelRestoreTargetInfo")); + } else { + restoreCriteria().forEach(e -> e.validate()); + } + if (datasourceInfo() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property datasourceInfo in model ItemLevelRestoreTargetInfo")); + } else { + datasourceInfo().validate(); + } + if (datasourceSetInfo() != null) { + datasourceSetInfo().validate(); + } + if (datasourceAuthCredentials() != null) { + datasourceAuthCredentials().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobExtendedInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobExtendedInfo.java new file mode 100644 index 0000000000000..6951c58f4f27c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobExtendedInfo.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Extended Information about the job. */ +@Fluent +public final class JobExtendedInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobExtendedInfo.class); + + /* + * Job's Additional Details + */ + @JsonProperty(value = "additionalDetails") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map additionalDetails; + + /* + * State of the Backup Instance + */ + @JsonProperty(value = "backupInstanceState", access = JsonProperty.Access.WRITE_ONLY) + private String backupInstanceState; + + /* + * Number of bytes transferred + */ + @JsonProperty(value = "dataTransferredInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Double dataTransferredInBytes; + + /* + * Destination where restore is done + */ + @JsonProperty(value = "recoveryDestination", access = JsonProperty.Access.WRITE_ONLY) + private String recoveryDestination; + + /* + * Details of the Source Recovery Point + */ + @JsonProperty(value = "sourceRecoverPoint", access = JsonProperty.Access.WRITE_ONLY) + private RestoreJobRecoveryPointDetails sourceRecoverPoint; + + /* + * List of Sub Tasks of the job + */ + @JsonProperty(value = "subTasks", access = JsonProperty.Access.WRITE_ONLY) + private List subTasks; + + /* + * Details of the Target Recovery Point + */ + @JsonProperty(value = "targetRecoverPoint", access = JsonProperty.Access.WRITE_ONLY) + private RestoreJobRecoveryPointDetails targetRecoverPoint; + + /** + * Get the additionalDetails property: Job's Additional Details. + * + * @return the additionalDetails value. + */ + public Map additionalDetails() { + return this.additionalDetails; + } + + /** + * Set the additionalDetails property: Job's Additional Details. + * + * @param additionalDetails the additionalDetails value to set. + * @return the JobExtendedInfo object itself. + */ + public JobExtendedInfo withAdditionalDetails(Map additionalDetails) { + this.additionalDetails = additionalDetails; + return this; + } + + /** + * Get the backupInstanceState property: State of the Backup Instance. + * + * @return the backupInstanceState value. + */ + public String backupInstanceState() { + return this.backupInstanceState; + } + + /** + * Get the dataTransferredInBytes property: Number of bytes transferred. + * + * @return the dataTransferredInBytes value. + */ + public Double dataTransferredInBytes() { + return this.dataTransferredInBytes; + } + + /** + * Get the recoveryDestination property: Destination where restore is done. + * + * @return the recoveryDestination value. + */ + public String recoveryDestination() { + return this.recoveryDestination; + } + + /** + * Get the sourceRecoverPoint property: Details of the Source Recovery Point. + * + * @return the sourceRecoverPoint value. + */ + public RestoreJobRecoveryPointDetails sourceRecoverPoint() { + return this.sourceRecoverPoint; + } + + /** + * Get the subTasks property: List of Sub Tasks of the job. + * + * @return the subTasks value. + */ + public List subTasks() { + return this.subTasks; + } + + /** + * Get the targetRecoverPoint property: Details of the Target Recovery Point. + * + * @return the targetRecoverPoint value. + */ + public RestoreJobRecoveryPointDetails targetRecoverPoint() { + return this.targetRecoverPoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceRecoverPoint() != null) { + sourceRecoverPoint().validate(); + } + if (subTasks() != null) { + subTasks().forEach(e -> e.validate()); + } + if (targetRecoverPoint() != null) { + targetRecoverPoint().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobSubTask.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobSubTask.java new file mode 100644 index 0000000000000..47b2a02310e98 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobSubTask.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Details of Job's Sub Task. */ +@Fluent +public final class JobSubTask { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobSubTask.class); + + /* + * Additional details of Sub Tasks + */ + @JsonProperty(value = "additionalDetails") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map additionalDetails; + + /* + * Task Id of the Sub Task + */ + @JsonProperty(value = "taskId", required = true) + private int taskId; + + /* + * Name of the Sub Task + */ + @JsonProperty(value = "taskName", required = true) + private String taskName; + + /* + * Progress of the Sub Task + */ + @JsonProperty(value = "taskProgress", access = JsonProperty.Access.WRITE_ONLY) + private String taskProgress; + + /* + * Status of the Sub Task + */ + @JsonProperty(value = "taskStatus", required = true) + private String taskStatus; + + /** + * Get the additionalDetails property: Additional details of Sub Tasks. + * + * @return the additionalDetails value. + */ + public Map additionalDetails() { + return this.additionalDetails; + } + + /** + * Set the additionalDetails property: Additional details of Sub Tasks. + * + * @param additionalDetails the additionalDetails value to set. + * @return the JobSubTask object itself. + */ + public JobSubTask withAdditionalDetails(Map additionalDetails) { + this.additionalDetails = additionalDetails; + return this; + } + + /** + * Get the taskId property: Task Id of the Sub Task. + * + * @return the taskId value. + */ + public int taskId() { + return this.taskId; + } + + /** + * Set the taskId property: Task Id of the Sub Task. + * + * @param taskId the taskId value to set. + * @return the JobSubTask object itself. + */ + public JobSubTask withTaskId(int taskId) { + this.taskId = taskId; + return this; + } + + /** + * Get the taskName property: Name of the Sub Task. + * + * @return the taskName value. + */ + public String taskName() { + return this.taskName; + } + + /** + * Set the taskName property: Name of the Sub Task. + * + * @param taskName the taskName value to set. + * @return the JobSubTask object itself. + */ + public JobSubTask withTaskName(String taskName) { + this.taskName = taskName; + return this; + } + + /** + * Get the taskProgress property: Progress of the Sub Task. + * + * @return the taskProgress value. + */ + public String taskProgress() { + return this.taskProgress; + } + + /** + * Get the taskStatus property: Status of the Sub Task. + * + * @return the taskStatus value. + */ + public String taskStatus() { + return this.taskStatus; + } + + /** + * Set the taskStatus property: Status of the Sub Task. + * + * @param taskStatus the taskStatus value to set. + * @return the JobSubTask object itself. + */ + public JobSubTask withTaskStatus(String taskStatus) { + this.taskStatus = taskStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (taskName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property taskName in model JobSubTask")); + } + if (taskStatus() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property taskStatus in model JobSubTask")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Jobs.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Jobs.java new file mode 100644 index 0000000000000..4930b6a7c1288 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Jobs.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Jobs. */ +public interface Jobs { + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + PagedIterable list(String resourceGroupName, String vaultName); + + /** + * Returns list of jobs belonging to a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AzureBackup Job resources. + */ + PagedIterable list(String resourceGroupName, String vaultName, Context context); + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + AzureBackupJobResource get(String resourceGroupName, String vaultName, String jobId); + + /** + * Gets a job with id in a backup vault. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job with id in a backup vault. + */ + Response getWithResponse( + String resourceGroupName, String vaultName, String jobId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Month.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Month.java new file mode 100644 index 0000000000000..e75f62ad67ce2 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Month.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Month. */ +public final class Month extends ExpandableStringEnum { + /** Static value April for Month. */ + public static final Month APRIL = fromString("April"); + + /** Static value August for Month. */ + public static final Month AUGUST = fromString("August"); + + /** Static value December for Month. */ + public static final Month DECEMBER = fromString("December"); + + /** Static value February for Month. */ + public static final Month FEBRUARY = fromString("February"); + + /** Static value January for Month. */ + public static final Month JANUARY = fromString("January"); + + /** Static value July for Month. */ + public static final Month JULY = fromString("July"); + + /** Static value June for Month. */ + public static final Month JUNE = fromString("June"); + + /** Static value March for Month. */ + public static final Month MARCH = fromString("March"); + + /** Static value May for Month. */ + public static final Month MAY = fromString("May"); + + /** Static value November for Month. */ + public static final Month NOVEMBER = fromString("November"); + + /** Static value October for Month. */ + public static final Month OCTOBER = fromString("October"); + + /** Static value September for Month. */ + public static final Month SEPTEMBER = fromString("September"); + + /** + * Creates or finds a Month from its string representation. + * + * @param name a name to look for. + * @return the corresponding Month. + */ + @JsonCreator + public static Month fromString(String name) { + return fromString(name, Month.class); + } + + /** @return known Month values. */ + public static Collection values() { + return values(Month.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationExtendedInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationExtendedInfo.java new file mode 100644 index 0000000000000..a12250e144932 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationExtendedInfo.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.dataprotection.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** OperationExtendedInfo Operation Extended Info. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = OperationExtendedInfo.class) +@JsonTypeName("OperationExtendedInfo") +@JsonSubTypes({@JsonSubTypes.Type(name = "OperationJobExtendedInfo", value = OperationJobExtendedInfoInner.class)}) +@Immutable +public class OperationExtendedInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationExtendedInfo.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationJobExtendedInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationJobExtendedInfo.java new file mode 100644 index 0000000000000..c2afd9b326544 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationJobExtendedInfo.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; + +/** An immutable client-side representation of OperationJobExtendedInfo. */ +public interface OperationJobExtendedInfo { + /** + * Gets the jobId property: Arm Id of the job created for this operation. + * + * @return the jobId value. + */ + String jobId(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner object. + * + * @return the inner object. + */ + OperationJobExtendedInfoInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResource.java new file mode 100644 index 0000000000000..33ccfceeb9a89 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResource.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.dataprotection.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. The full set of optional properties (e.g. + * inner errors / details) can be found in the "Error Response" section. + * + * @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 properties property: OperationExtendedInfo End time of the operation. + * + * @return the properties value. + */ + OperationExtendedInfo properties(); + + /** + * Gets the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the status property: The status property. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner object. + * + * @return the inner object. + */ + OperationResourceInner innerModel(); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResults.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResults.java new file mode 100644 index 0000000000000..023983ffb0bbe --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResults.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationResults. */ +public interface OperationResults { + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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. + */ + OperationJobExtendedInfo get(String operationId, String location); + + /** + * Gets the operation result for a resource. + * + * @param operationId The operationId parameter. + * @param location The location 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 getWithResponse(String operationId, String location, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResultsGetHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResultsGetHeaders.java new file mode 100644 index 0000000000000..0aeb9e443e1f4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResultsGetHeaders.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 OperationResultsGetHeaders model. */ +@Fluent +public final class OperationResultsGetHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResultsGetHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the OperationResultsGetHeaders object itself. + */ + public OperationResultsGetHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the OperationResultsGetHeaders object itself. + */ + public OperationResultsGetHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the OperationResultsGetHeaders object itself. + */ + public OperationResultsGetHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResultsGetResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResultsGetResponse.java new file mode 100644 index 0000000000000..d09babcf5deb3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResultsGetResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; + +/** Contains all response data for the get operation. */ +public final class OperationResultsGetResponse + extends ResponseBase { + /** + * Creates an instance of OperationResultsGetResponse. + * + * @param request the request which resulted in this OperationResultsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public OperationResultsGetResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + OperationJobExtendedInfoInner value, + OperationResultsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public OperationJobExtendedInfoInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationStatus.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationStatus.java new file mode 100644 index 0000000000000..27b357f339fbe --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationStatus.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationStatus. */ +public interface OperationStatus { + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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 get(String location, String operationId); + + /** + * Gets the operation status for a resource. + * + * @param location The location parameter. + * @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 getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PatchResourceRequestInput.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PatchResourceRequestInput.java new file mode 100644 index 0000000000000..99679b28ebc50 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PatchResourceRequestInput.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.dataprotection.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** PatchResourceRequestInput Patch Request content for Microsoft.DataProtection resources. */ +@Fluent +public final class PatchResourceRequestInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchResourceRequestInput.class); + + /* + * DppIdentityDetails Input Managed Identity Details + */ + @JsonProperty(value = "identity") + private DppIdentityDetails identity; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @return the identity value. + */ + public DppIdentityDetails identity() { + return this.identity; + } + + /** + * Set the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @param identity the identity value to set. + * @return the PatchResourceRequestInput object itself. + */ + public PatchResourceRequestInput withIdentity(DppIdentityDetails identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PatchResourceRequestInput object itself. + */ + public PatchResourceRequestInput withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PolicyInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PolicyInfo.java new file mode 100644 index 0000000000000..92413bd9cdb5d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PolicyInfo.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** PolicyInfo Policy Info in backupInstance. */ +@Fluent +public final class PolicyInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyInfo.class); + + /* + * The policyId property. + */ + @JsonProperty(value = "policyId", required = true) + private String policyId; + + /* + * The policyVersion property. + */ + @JsonProperty(value = "policyVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policyVersion; + + /* + * Policy parameters for the backup instance + */ + @JsonProperty(value = "policyParameters") + private PolicyParameters policyParameters; + + /** + * Get the policyId property: The policyId property. + * + * @return the policyId value. + */ + public String policyId() { + return this.policyId; + } + + /** + * Set the policyId property: The policyId property. + * + * @param policyId the policyId value to set. + * @return the PolicyInfo object itself. + */ + public PolicyInfo withPolicyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Get the policyVersion property: The policyVersion property. + * + * @return the policyVersion value. + */ + public String policyVersion() { + return this.policyVersion; + } + + /** + * Get the policyParameters property: Policy parameters for the backup instance. + * + * @return the policyParameters value. + */ + public PolicyParameters policyParameters() { + return this.policyParameters; + } + + /** + * Set the policyParameters property: Policy parameters for the backup instance. + * + * @param policyParameters the policyParameters value to set. + * @return the PolicyInfo object itself. + */ + public PolicyInfo withPolicyParameters(PolicyParameters policyParameters) { + this.policyParameters = policyParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property policyId in model PolicyInfo")); + } + if (policyParameters() != null) { + policyParameters().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PolicyParameters.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PolicyParameters.java new file mode 100644 index 0000000000000..01397badec251 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PolicyParameters.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters in Policy. */ +@Fluent +public final class PolicyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyParameters.class); + + /* + * Gets or sets the DataStore Parameters + */ + @JsonProperty(value = "dataStoreParametersList") + private List dataStoreParametersList; + + /** + * Get the dataStoreParametersList property: Gets or sets the DataStore Parameters. + * + * @return the dataStoreParametersList value. + */ + public List dataStoreParametersList() { + return this.dataStoreParametersList; + } + + /** + * Set the dataStoreParametersList property: Gets or sets the DataStore Parameters. + * + * @param dataStoreParametersList the dataStoreParametersList value to set. + * @return the PolicyParameters object itself. + */ + public PolicyParameters withDataStoreParametersList(List dataStoreParametersList) { + this.dataStoreParametersList = dataStoreParametersList; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataStoreParametersList() != null) { + dataStoreParametersList().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ProtectionStatusDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ProtectionStatusDetails.java new file mode 100644 index 0000000000000..8c2b9636df6a2 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ProtectionStatusDetails.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** ProtectionStatusDetails Protection status details. */ +@Fluent +public final class ProtectionStatusDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProtectionStatusDetails.class); + + /* + * Specifies the protection status error of the resource + */ + @JsonProperty(value = "errorDetails") + private UserFacingError errorDetails; + + /* + * Specifies the protection status of the resource + */ + @JsonProperty(value = "status") + private Status status; + + /** + * Get the errorDetails property: Specifies the protection status error of the resource. + * + * @return the errorDetails value. + */ + public UserFacingError errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails property: Specifies the protection status error of the resource. + * + * @param errorDetails the errorDetails value to set. + * @return the ProtectionStatusDetails object itself. + */ + public ProtectionStatusDetails withErrorDetails(UserFacingError errorDetails) { + this.errorDetails = errorDetails; + return this; + } + + /** + * Get the status property: Specifies the protection status of the resource. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: Specifies the protection status of the resource. + * + * @param status the status value to set. + * @return the ProtectionStatusDetails object itself. + */ + public ProtectionStatusDetails withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errorDetails() != null) { + errorDetails().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ProvisioningState.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ProvisioningState.java new file mode 100644 index 0000000000000..f8ff78a79110d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ProvisioningState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Provisioning for ProvisioningState. */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Unknown for ProvisioningState. */ + public static final ProvisioningState UNKNOWN = fromString("Unknown"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RangeBasedItemLevelRestoreCriteria.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RangeBasedItemLevelRestoreCriteria.java new file mode 100644 index 0000000000000..bee5a2b725c7e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RangeBasedItemLevelRestoreCriteria.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.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Item Level target info for restore operation. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("RangeBasedItemLevelRestoreCriteria") +@Fluent +public final class RangeBasedItemLevelRestoreCriteria extends ItemLevelRestoreCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RangeBasedItemLevelRestoreCriteria.class); + + /* + * minimum value for range prefix match + */ + @JsonProperty(value = "minMatchingValue") + private String minMatchingValue; + + /* + * maximum value for range prefix match + */ + @JsonProperty(value = "maxMatchingValue") + private String maxMatchingValue; + + /** + * Get the minMatchingValue property: minimum value for range prefix match. + * + * @return the minMatchingValue value. + */ + public String minMatchingValue() { + return this.minMatchingValue; + } + + /** + * Set the minMatchingValue property: minimum value for range prefix match. + * + * @param minMatchingValue the minMatchingValue value to set. + * @return the RangeBasedItemLevelRestoreCriteria object itself. + */ + public RangeBasedItemLevelRestoreCriteria withMinMatchingValue(String minMatchingValue) { + this.minMatchingValue = minMatchingValue; + return this; + } + + /** + * Get the maxMatchingValue property: maximum value for range prefix match. + * + * @return the maxMatchingValue value. + */ + public String maxMatchingValue() { + return this.maxMatchingValue; + } + + /** + * Set the maxMatchingValue property: maximum value for range prefix match. + * + * @param maxMatchingValue the maxMatchingValue value to set. + * @return the RangeBasedItemLevelRestoreCriteria object itself. + */ + public RangeBasedItemLevelRestoreCriteria withMaxMatchingValue(String maxMatchingValue) { + this.maxMatchingValue = maxMatchingValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryOption.java new file mode 100644 index 0000000000000..962afd9bdd39b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryOption.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecoveryOption. */ +public final class RecoveryOption extends ExpandableStringEnum { + /** Static value FailIfExists for RecoveryOption. */ + public static final RecoveryOption FAIL_IF_EXISTS = fromString("FailIfExists"); + + /** + * Creates or finds a RecoveryOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecoveryOption. + */ + @JsonCreator + public static RecoveryOption fromString(String name) { + return fromString(name, RecoveryOption.class); + } + + /** @return known RecoveryOption values. */ + public static Collection values() { + return values(RecoveryOption.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPointDataStoreDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPointDataStoreDetails.java new file mode 100644 index 0000000000000..6ea4362d6f70c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPointDataStoreDetails.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** RecoveryPointDataStoreDetails RecoveryPoint datastore details. */ +@Fluent +public final class RecoveryPointDataStoreDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoveryPointDataStoreDetails.class); + + /* + * The creationTime property. + */ + @JsonProperty(value = "creationTime") + private OffsetDateTime creationTime; + + /* + * The expiryTime property. + */ + @JsonProperty(value = "expiryTime") + private OffsetDateTime expiryTime; + + /* + * The id property. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The metaData property. + */ + @JsonProperty(value = "metaData") + private String metadata; + + /* + * The state property. + */ + @JsonProperty(value = "state") + private String state; + + /* + * The type property. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The visible property. + */ + @JsonProperty(value = "visible") + private Boolean visible; + + /* + * The rehydrationExpiryTime property. + */ + @JsonProperty(value = "rehydrationExpiryTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime rehydrationExpiryTime; + + /* + * The rehydrationStatus property. + */ + @JsonProperty(value = "rehydrationStatus", access = JsonProperty.Access.WRITE_ONLY) + private RehydrationStatus rehydrationStatus; + + /** + * Get the creationTime property: The creationTime property. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime property: The creationTime property. + * + * @param creationTime the creationTime value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withCreationTime(OffsetDateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get the expiryTime property: The expiryTime property. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.expiryTime; + } + + /** + * Set the expiryTime property: The expiryTime property. + * + * @param expiryTime the expiryTime value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withExpiryTime(OffsetDateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id property. + * + * @param id the id value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withId(String id) { + this.id = id; + return this; + } + + /** + * Get the metadata property: The metaData property. + * + * @return the metadata value. + */ + public String metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The metaData property. + * + * @param metadata the metadata value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withMetadata(String metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the state property: The state property. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state property. + * + * @param state the state value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withState(String state) { + this.state = state; + return this; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type property. + * + * @param type the type value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Get the visible property: The visible property. + * + * @return the visible value. + */ + public Boolean visible() { + return this.visible; + } + + /** + * Set the visible property: The visible property. + * + * @param visible the visible value to set. + * @return the RecoveryPointDataStoreDetails object itself. + */ + public RecoveryPointDataStoreDetails withVisible(Boolean visible) { + this.visible = visible; + return this; + } + + /** + * Get the rehydrationExpiryTime property: The rehydrationExpiryTime property. + * + * @return the rehydrationExpiryTime value. + */ + public OffsetDateTime rehydrationExpiryTime() { + return this.rehydrationExpiryTime; + } + + /** + * Get the rehydrationStatus property: The rehydrationStatus property. + * + * @return the rehydrationStatus value. + */ + public RehydrationStatus rehydrationStatus() { + return this.rehydrationStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPoints.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPoints.java new file mode 100644 index 0000000000000..9c93a4fb18a48 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPoints.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RecoveryPoints. */ +public interface RecoveryPoints { + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureBackupRecoveryPointResourceList. + */ + PagedIterable list( + String vaultName, String resourceGroupName, String backupInstanceName); + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param filter OData filter options. + * @param skipToken skipToken Filter. + * @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 azureBackupRecoveryPointResourceList. + */ + PagedIterable list( + String vaultName, + String resourceGroupName, + String backupInstanceName, + String filter, + String skipToken, + Context context); + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + AzureBackupRecoveryPointResource get( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId); + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param recoveryPointId The recoveryPointId 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 a Recovery Point using recoveryPointId for a Datasource. + */ + Response getWithResponse( + String vaultName, String resourceGroupName, String backupInstanceName, String recoveryPointId, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RehydrationPriority.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RehydrationPriority.java new file mode 100644 index 0000000000000..633d5d32e529a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RehydrationPriority.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RehydrationPriority. */ +public final class RehydrationPriority extends ExpandableStringEnum { + /** Static value Invalid for RehydrationPriority. */ + public static final RehydrationPriority INVALID = fromString("Invalid"); + + /** Static value High for RehydrationPriority. */ + public static final RehydrationPriority HIGH = fromString("High"); + + /** Static value Standard for RehydrationPriority. */ + public static final RehydrationPriority STANDARD = fromString("Standard"); + + /** + * Creates or finds a RehydrationPriority from its string representation. + * + * @param name a name to look for. + * @return the corresponding RehydrationPriority. + */ + @JsonCreator + public static RehydrationPriority fromString(String name) { + return fromString(name, RehydrationPriority.class); + } + + /** @return known RehydrationPriority values. */ + public static Collection values() { + return values(RehydrationPriority.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RehydrationStatus.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RehydrationStatus.java new file mode 100644 index 0000000000000..7091edbaca734 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RehydrationStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RehydrationStatus. */ +public final class RehydrationStatus extends ExpandableStringEnum { + /** Static value CREATE_IN_PROGRESS for RehydrationStatus. */ + public static final RehydrationStatus CREATE_IN_PROGRESS = fromString("CREATE_IN_PROGRESS"); + + /** Static value COMPLETED for RehydrationStatus. */ + public static final RehydrationStatus COMPLETED = fromString("COMPLETED"); + + /** Static value DELETE_IN_PROGRESS for RehydrationStatus. */ + public static final RehydrationStatus DELETE_IN_PROGRESS = fromString("DELETE_IN_PROGRESS"); + + /** Static value DELETED for RehydrationStatus. */ + public static final RehydrationStatus DELETED = fromString("DELETED"); + + /** Static value FAILED for RehydrationStatus. */ + public static final RehydrationStatus FAILED = fromString("FAILED"); + + /** + * Creates or finds a RehydrationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RehydrationStatus. + */ + @JsonCreator + public static RehydrationStatus fromString(String name) { + return fromString(name, RehydrationStatus.class); + } + + /** @return known RehydrationStatus values. */ + public static Collection values() { + return values(RehydrationStatus.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuard.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuard.java new file mode 100644 index 0000000000000..ecca368885d5b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuard.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceGuard model. */ +@Immutable +public final class ResourceGuard { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGuard.class); + + /* + * Provisioning state of the BackupVault resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * This flag indicates whether auto approval is allowed or not. + */ + @JsonProperty(value = "allowAutoApprovals", access = JsonProperty.Access.WRITE_ONLY) + private Boolean allowAutoApprovals; + + /* + * {readonly} List of operation details those are protected by the + * ResourceGuard resource + */ + @JsonProperty(value = "resourceGuardOperations", access = JsonProperty.Access.WRITE_ONLY) + private List resourceGuardOperations; + + /* + * List of critical operations which are not protected by this + * resourceGuard + */ + @JsonProperty(value = "vaultCriticalOperationExclusionList", access = JsonProperty.Access.WRITE_ONLY) + private List vaultCriticalOperationExclusionList; + + /* + * Description about the pre-req steps to perform all the critical + * operations. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provisioningState property: Provisioning state of the BackupVault resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the allowAutoApprovals property: This flag indicates whether auto approval is allowed or not. + * + * @return the allowAutoApprovals value. + */ + public Boolean allowAutoApprovals() { + return this.allowAutoApprovals; + } + + /** + * Get the resourceGuardOperations property: {readonly} List of operation details those are protected by the + * ResourceGuard resource. + * + * @return the resourceGuardOperations value. + */ + public List resourceGuardOperations() { + return this.resourceGuardOperations; + } + + /** + * Get the vaultCriticalOperationExclusionList property: List of critical operations which are not protected by this + * resourceGuard. + * + * @return the vaultCriticalOperationExclusionList value. + */ + public List vaultCriticalOperationExclusionList() { + return this.vaultCriticalOperationExclusionList; + } + + /** + * Get the description property: Description about the pre-req steps to perform all the critical operations. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceGuardOperations() != null) { + resourceGuardOperations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardOperation.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardOperation.java new file mode 100644 index 0000000000000..616a884ae1ddb --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardOperation.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.dataprotection.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; + +/** This class contains all the details about a critical operation. */ +@Immutable +public final class ResourceGuardOperation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGuardOperation.class); + + /* + * Name of the critical operation. + */ + @JsonProperty(value = "vaultCriticalOperation", access = JsonProperty.Access.WRITE_ONLY) + private String vaultCriticalOperation; + + /* + * Type of resource request. + */ + @JsonProperty(value = "requestResourceType", access = JsonProperty.Access.WRITE_ONLY) + private String requestResourceType; + + /** + * Get the vaultCriticalOperation property: Name of the critical operation. + * + * @return the vaultCriticalOperation value. + */ + public String vaultCriticalOperation() { + return this.vaultCriticalOperation; + } + + /** + * Get the requestResourceType property: Type of resource request. + * + * @return the requestResourceType value. + */ + public String requestResourceType() { + return this.requestResourceType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardResource.java new file mode 100644 index 0000000000000..6d17a228493b3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardResource.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner; +import java.util.Map; + +/** An immutable client-side representation of ResourceGuardResource. */ +public interface ResourceGuardResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: Optional ETag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @return the identity value. + */ + DppIdentityDetails identity(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: ResourceGuardResource properties. + * + * @return the properties value. + */ + ResourceGuard properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner object. + * + * @return the inner object. + */ + ResourceGuardResourceInner innerModel(); + + /** The entirety of the ResourceGuardResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ResourceGuardResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ResourceGuardResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ResourceGuardResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ResourceGuardResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ResourceGuardResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithEtag, + DefinitionStages.WithIdentity, + DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ResourceGuardResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ResourceGuardResource create(Context context); + } + /** The stage of the ResourceGuardResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ResourceGuardResource definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: Optional ETag.. + * + * @param etag Optional ETag. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + /** The stage of the ResourceGuardResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @param identity DppIdentityDetails Input Managed Identity Details. + * @return the next definition stage. + */ + WithCreate withIdentity(DppIdentityDetails identity); + } + /** The stage of the ResourceGuardResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: ResourceGuardResource properties. + * + * @param properties ResourceGuardResource properties. + * @return the next definition stage. + */ + WithCreate withProperties(ResourceGuard properties); + } + } + /** + * Begins update for the ResourceGuardResource resource. + * + * @return the stage of resource update. + */ + ResourceGuardResource.Update update(); + + /** The template for ResourceGuardResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ResourceGuardResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ResourceGuardResource apply(Context context); + } + /** The ResourceGuardResource update stages. */ + interface UpdateStages { + /** The stage of the ResourceGuardResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ResourceGuardResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: DppIdentityDetails Input Managed Identity Details. + * + * @param identity DppIdentityDetails Input Managed Identity Details. + * @return the next definition stage. + */ + Update withIdentity(DppIdentityDetails identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ResourceGuardResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ResourceGuardResource refresh(Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardResourceList.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardResourceList.java new file mode 100644 index 0000000000000..161dd11ceba56 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuardResourceList.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of ResourceGuard resources. */ +@Fluent +public final class ResourceGuardResourceList extends DppTrackedResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGuardResourceList.class); + + /* + * List of resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources. + * + * @param value the value value to set. + * @return the ResourceGuardResourceList object itself. + */ + public ResourceGuardResourceList withValue(List value) { + this.value = value; + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGuardResourceList withNextLink(String nextLink) { + super.withNextLink(nextLink); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuards.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuards.java new file mode 100644 index 0000000000000..5ff9c2cba2547 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceGuards.java @@ -0,0 +1,518 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceGuards. */ +public interface ResourceGuards { + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + PagedIterable list(); + + /** + * Returns ResourceGuards collection belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + PagedIterable list(Context context); + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ResourceGuard resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ResourceGuardResource getByResourceGroup(String resourceGroupName, String resourceGuardsName); + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceGuardsName); + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getDisableSoftDeleteRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getDeleteResourceGuardProxyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getBackupSecurityPinRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getDeleteProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getUpdateProtectionPolicyRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName 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 base for all lists of V2 resources. + */ + PagedIterable getUpdateProtectedItemRequestsObjects( + String resourceGroupName, String resourceGuardsName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + DppBaseResource getDefaultDisableSoftDeleteRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + Response getDefaultDisableSoftDeleteRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + DppBaseResource getDefaultDeleteResourceGuardProxyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + Response getDefaultDeleteResourceGuardProxyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + DppBaseResource getDefaultBackupSecurityPinRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + Response getDefaultBackupSecurityPinRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + DppBaseResource getDefaultDeleteProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + Response getDefaultDeleteProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + DppBaseResource getDefaultUpdateProtectionPolicyRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + Response getDefaultUpdateProtectionPolicyRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + DppBaseResource getDefaultUpdateProtectedItemRequestsObject( + String resourceGroupName, String resourceGuardsName, String requestName); + + /** + * Returns collection of operation request objects for a critical operation protected by the given ResourceGuard + * resource. + * + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The resourceGuardsName parameter. + * @param requestName The requestName 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 base resource under Microsoft.DataProtection provider namespace. + */ + Response getDefaultUpdateProtectedItemRequestsObjectWithResponse( + String resourceGroupName, String resourceGuardsName, String requestName, Context context); + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ResourceGuardResource getById(String id); + + /** + * Returns a ResourceGuard belonging to a resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a ResourceGuard resource from the resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ResourceGuardResource resource. + * + * @param name resource name. + * @return the first stage of the new ResourceGuardResource definition. + */ + ResourceGuardResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceMoveDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceMoveDetails.java new file mode 100644 index 0000000000000..461e44ed229f4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceMoveDetails.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** ResourceMoveDetails will be returned in response to GetResource call from ARM. */ +@Fluent +public final class ResourceMoveDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceMoveDetails.class); + + /* + * CorrelationId of latest ResourceMove operation attempted + */ + @JsonProperty(value = "operationId") + private String operationId; + + /* + * Start time in UTC of latest ResourceMove operation attempted. ISO 8601 + * format. + */ + @JsonProperty(value = "startTimeUtc") + private String startTimeUtc; + + /* + * Completion time in UTC of latest ResourceMove operation attempted. ISO + * 8601 format. + */ + @JsonProperty(value = "completionTimeUtc") + private String completionTimeUtc; + + /* + * ARM resource path of source resource + */ + @JsonProperty(value = "sourceResourcePath") + private String sourceResourcePath; + + /* + * ARM resource path of target resource used in latest ResourceMove + * operation + */ + @JsonProperty(value = "targetResourcePath") + private String targetResourcePath; + + /** + * Get the operationId property: CorrelationId of latest ResourceMove operation attempted. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Set the operationId property: CorrelationId of latest ResourceMove operation attempted. + * + * @param operationId the operationId value to set. + * @return the ResourceMoveDetails object itself. + */ + public ResourceMoveDetails withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Get the startTimeUtc property: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format. + * + * @return the startTimeUtc value. + */ + public String startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Set the startTimeUtc property: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format. + * + * @param startTimeUtc the startTimeUtc value to set. + * @return the ResourceMoveDetails object itself. + */ + public ResourceMoveDetails withStartTimeUtc(String startTimeUtc) { + this.startTimeUtc = startTimeUtc; + return this; + } + + /** + * Get the completionTimeUtc property: Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 + * format. + * + * @return the completionTimeUtc value. + */ + public String completionTimeUtc() { + return this.completionTimeUtc; + } + + /** + * Set the completionTimeUtc property: Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 + * format. + * + * @param completionTimeUtc the completionTimeUtc value to set. + * @return the ResourceMoveDetails object itself. + */ + public ResourceMoveDetails withCompletionTimeUtc(String completionTimeUtc) { + this.completionTimeUtc = completionTimeUtc; + return this; + } + + /** + * Get the sourceResourcePath property: ARM resource path of source resource. + * + * @return the sourceResourcePath value. + */ + public String sourceResourcePath() { + return this.sourceResourcePath; + } + + /** + * Set the sourceResourcePath property: ARM resource path of source resource. + * + * @param sourceResourcePath the sourceResourcePath value to set. + * @return the ResourceMoveDetails object itself. + */ + public ResourceMoveDetails withSourceResourcePath(String sourceResourcePath) { + this.sourceResourcePath = sourceResourcePath; + return this; + } + + /** + * Get the targetResourcePath property: ARM resource path of target resource used in latest ResourceMove operation. + * + * @return the targetResourcePath value. + */ + public String targetResourcePath() { + return this.targetResourcePath; + } + + /** + * Set the targetResourcePath property: ARM resource path of target resource used in latest ResourceMove operation. + * + * @param targetResourcePath the targetResourcePath value to set. + * @return the ResourceMoveDetails object itself. + */ + public ResourceMoveDetails withTargetResourcePath(String targetResourcePath) { + this.targetResourcePath = targetResourcePath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceMoveState.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceMoveState.java new file mode 100644 index 0000000000000..f55f0ebb4437d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceMoveState.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceMoveState. */ +public final class ResourceMoveState 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 Failed for ResourceMoveState. */ + public static final ResourceMoveState FAILED = fromString("Failed"); + + /** 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 CriticalFailure for ResourceMoveState. */ + public static final ResourceMoveState CRITICAL_FAILURE = fromString("CriticalFailure"); + + /** Static value PartialSuccess for ResourceMoveState. */ + public static final ResourceMoveState PARTIAL_SUCCESS = fromString("PartialSuccess"); + + /** Static value MoveSucceeded for ResourceMoveState. */ + public static final ResourceMoveState MOVE_SUCCEEDED = fromString("MoveSucceeded"); + + /** + * 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/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestorableTimeRange.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestorableTimeRange.java new file mode 100644 index 0000000000000..2712bf276abdb --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestorableTimeRange.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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 RestorableTimeRange model. */ +@Fluent +public final class RestorableTimeRange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableTimeRange.class); + + /* + * Start time for the available restore range + */ + @JsonProperty(value = "startTime", required = true) + private String startTime; + + /* + * End time for the available restore range + */ + @JsonProperty(value = "endTime", required = true) + private String endTime; + + /* + * The objectType property. + */ + @JsonProperty(value = "objectType") + private String objectType; + + /** + * Get the startTime property: Start time for the available restore range. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time for the available restore range. + * + * @param startTime the startTime value to set. + * @return the RestorableTimeRange object itself. + */ + public RestorableTimeRange withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time for the available restore range. + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time for the available restore range. + * + * @param endTime the endTime value to set. + * @return the RestorableTimeRange object itself. + */ + public RestorableTimeRange withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the objectType property: The objectType property. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: The objectType property. + * + * @param objectType the objectType value to set. + * @return the RestorableTimeRange object itself. + */ + public RestorableTimeRange withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property startTime in model RestorableTimeRange")); + } + if (endTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property endTime in model RestorableTimeRange")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestorableTimeRanges.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestorableTimeRanges.java new file mode 100644 index 0000000000000..3aeb74323ab6d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestorableTimeRanges.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableTimeRanges. */ +public interface RestorableTimeRanges { + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + AzureBackupFindRestorableTimeRangesResponseResource find( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters); + + /** + * @param vaultName The name of the backup vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param backupInstanceName The name of the backup instance. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list Restore Ranges Response. + */ + Response findWithResponse( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupFindRestorableTimeRangesRequest parameters, + Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreFilesTargetInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreFilesTargetInfo.java new file mode 100644 index 0000000000000..a32de43d64f3d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreFilesTargetInfo.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Class encapsulating restore as files target parameters. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("RestoreFilesTargetInfo") +@Fluent +public final class RestoreFilesTargetInfo extends RestoreTargetInfoBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestoreFilesTargetInfo.class); + + /* + * Destination of RestoreAsFiles operation, when destination is not a + * datasource + */ + @JsonProperty(value = "targetDetails", required = true) + private TargetDetails targetDetails; + + /** + * Get the targetDetails property: Destination of RestoreAsFiles operation, when destination is not a datasource. + * + * @return the targetDetails value. + */ + public TargetDetails targetDetails() { + return this.targetDetails; + } + + /** + * Set the targetDetails property: Destination of RestoreAsFiles operation, when destination is not a datasource. + * + * @param targetDetails the targetDetails value to set. + * @return the RestoreFilesTargetInfo object itself. + */ + public RestoreFilesTargetInfo withTargetDetails(TargetDetails targetDetails) { + this.targetDetails = targetDetails; + return this; + } + + /** {@inheritDoc} */ + @Override + public RestoreFilesTargetInfo withRecoveryOption(RecoveryOption recoveryOption) { + super.withRecoveryOption(recoveryOption); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestoreFilesTargetInfo withRestoreLocation(String restoreLocation) { + super.withRestoreLocation(restoreLocation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (targetDetails() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetDetails in model RestoreFilesTargetInfo")); + } else { + targetDetails().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreJobRecoveryPointDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreJobRecoveryPointDetails.java new file mode 100644 index 0000000000000..991160496ca5b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreJobRecoveryPointDetails.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The RestoreJobRecoveryPointDetails model. */ +@Fluent +public final class RestoreJobRecoveryPointDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestoreJobRecoveryPointDetails.class); + + /* + * The recoveryPointID property. + */ + @JsonProperty(value = "recoveryPointID") + private String recoveryPointId; + + /* + * The recoveryPointTime property. + */ + @JsonProperty(value = "recoveryPointTime") + private OffsetDateTime recoveryPointTime; + + /** + * Get the recoveryPointId property: The recoveryPointID property. + * + * @return the recoveryPointId value. + */ + public String recoveryPointId() { + return this.recoveryPointId; + } + + /** + * Set the recoveryPointId property: The recoveryPointID property. + * + * @param recoveryPointId the recoveryPointId value to set. + * @return the RestoreJobRecoveryPointDetails object itself. + */ + public RestoreJobRecoveryPointDetails withRecoveryPointId(String recoveryPointId) { + this.recoveryPointId = recoveryPointId; + return this; + } + + /** + * Get the recoveryPointTime property: The recoveryPointTime property. + * + * @return the recoveryPointTime value. + */ + public OffsetDateTime recoveryPointTime() { + return this.recoveryPointTime; + } + + /** + * Set the recoveryPointTime property: The recoveryPointTime property. + * + * @param recoveryPointTime the recoveryPointTime value to set. + * @return the RestoreJobRecoveryPointDetails object itself. + */ + public RestoreJobRecoveryPointDetails withRecoveryPointTime(OffsetDateTime recoveryPointTime) { + this.recoveryPointTime = recoveryPointTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreSourceDataStoreType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreSourceDataStoreType.java new file mode 100644 index 0000000000000..696f46eb0d8c2 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreSourceDataStoreType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestoreSourceDataStoreType. */ +public final class RestoreSourceDataStoreType extends ExpandableStringEnum { + /** Static value OperationalStore for RestoreSourceDataStoreType. */ + public static final RestoreSourceDataStoreType OPERATIONAL_STORE = fromString("OperationalStore"); + + /** Static value VaultStore for RestoreSourceDataStoreType. */ + public static final RestoreSourceDataStoreType VAULT_STORE = fromString("VaultStore"); + + /** Static value ArchiveStore for RestoreSourceDataStoreType. */ + public static final RestoreSourceDataStoreType ARCHIVE_STORE = fromString("ArchiveStore"); + + /** + * Creates or finds a RestoreSourceDataStoreType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreSourceDataStoreType. + */ + @JsonCreator + public static RestoreSourceDataStoreType fromString(String name) { + return fromString(name, RestoreSourceDataStoreType.class); + } + + /** @return known RestoreSourceDataStoreType values. */ + public static Collection values() { + return values(RestoreSourceDataStoreType.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfo.java new file mode 100644 index 0000000000000..b70e93d538338 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfo.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Class encapsulating restore target parameters. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("RestoreTargetInfo") +@Fluent +public final class RestoreTargetInfo extends RestoreTargetInfoBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestoreTargetInfo.class); + + /* + * Datasource Information of target DS + */ + @JsonProperty(value = "datasourceInfo", required = true) + private Datasource datasourceInfo; + + /* + * DatasourceSet Information of target DS Set + */ + @JsonProperty(value = "datasourceSetInfo") + private DatasourceSet datasourceSetInfo; + + /* + * Credentials to use to authenticate with data source provider. + */ + @JsonProperty(value = "datasourceAuthCredentials") + private AuthCredentials datasourceAuthCredentials; + + /** + * Get the datasourceInfo property: Datasource Information of target DS. + * + * @return the datasourceInfo value. + */ + public Datasource datasourceInfo() { + return this.datasourceInfo; + } + + /** + * Set the datasourceInfo property: Datasource Information of target DS. + * + * @param datasourceInfo the datasourceInfo value to set. + * @return the RestoreTargetInfo object itself. + */ + public RestoreTargetInfo withDatasourceInfo(Datasource datasourceInfo) { + this.datasourceInfo = datasourceInfo; + return this; + } + + /** + * Get the datasourceSetInfo property: DatasourceSet Information of target DS Set. + * + * @return the datasourceSetInfo value. + */ + public DatasourceSet datasourceSetInfo() { + return this.datasourceSetInfo; + } + + /** + * Set the datasourceSetInfo property: DatasourceSet Information of target DS Set. + * + * @param datasourceSetInfo the datasourceSetInfo value to set. + * @return the RestoreTargetInfo object itself. + */ + public RestoreTargetInfo withDatasourceSetInfo(DatasourceSet datasourceSetInfo) { + this.datasourceSetInfo = datasourceSetInfo; + return this; + } + + /** + * Get the datasourceAuthCredentials property: Credentials to use to authenticate with data source provider. + * + * @return the datasourceAuthCredentials value. + */ + public AuthCredentials datasourceAuthCredentials() { + return this.datasourceAuthCredentials; + } + + /** + * Set the datasourceAuthCredentials property: Credentials to use to authenticate with data source provider. + * + * @param datasourceAuthCredentials the datasourceAuthCredentials value to set. + * @return the RestoreTargetInfo object itself. + */ + public RestoreTargetInfo withDatasourceAuthCredentials(AuthCredentials datasourceAuthCredentials) { + this.datasourceAuthCredentials = datasourceAuthCredentials; + return this; + } + + /** {@inheritDoc} */ + @Override + public RestoreTargetInfo withRecoveryOption(RecoveryOption recoveryOption) { + super.withRecoveryOption(recoveryOption); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestoreTargetInfo withRestoreLocation(String restoreLocation) { + super.withRestoreLocation(restoreLocation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (datasourceInfo() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property datasourceInfo in model RestoreTargetInfo")); + } else { + datasourceInfo().validate(); + } + if (datasourceSetInfo() != null) { + datasourceSetInfo().validate(); + } + if (datasourceAuthCredentials() != null) { + datasourceAuthCredentials().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfoBase.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfoBase.java new file mode 100644 index 0000000000000..80c1fb7ef70a8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfoBase.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Base class common to RestoreTargetInfo and RestoreFilesTargetInfo. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = RestoreTargetInfoBase.class) +@JsonTypeName("RestoreTargetInfoBase") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ItemLevelRestoreTargetInfo", value = ItemLevelRestoreTargetInfo.class), + @JsonSubTypes.Type(name = "RestoreFilesTargetInfo", value = RestoreFilesTargetInfo.class), + @JsonSubTypes.Type(name = "RestoreTargetInfo", value = RestoreTargetInfo.class) +}) +@Fluent +public class RestoreTargetInfoBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestoreTargetInfoBase.class); + + /* + * Recovery Option + */ + @JsonProperty(value = "recoveryOption", required = true) + private RecoveryOption recoveryOption; + + /* + * Target Restore region + */ + @JsonProperty(value = "restoreLocation") + private String restoreLocation; + + /** + * Get the recoveryOption property: Recovery Option. + * + * @return the recoveryOption value. + */ + public RecoveryOption recoveryOption() { + return this.recoveryOption; + } + + /** + * Set the recoveryOption property: Recovery Option. + * + * @param recoveryOption the recoveryOption value to set. + * @return the RestoreTargetInfoBase object itself. + */ + public RestoreTargetInfoBase withRecoveryOption(RecoveryOption recoveryOption) { + this.recoveryOption = recoveryOption; + return this; + } + + /** + * Get the restoreLocation property: Target Restore region. + * + * @return the restoreLocation value. + */ + public String restoreLocation() { + return this.restoreLocation; + } + + /** + * Set the restoreLocation property: Target Restore region. + * + * @param restoreLocation the restoreLocation value to set. + * @return the RestoreTargetInfoBase object itself. + */ + public RestoreTargetInfoBase withRestoreLocation(String restoreLocation) { + this.restoreLocation = restoreLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recoveryOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recoveryOption in model RestoreTargetInfoBase")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetLocationType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetLocationType.java new file mode 100644 index 0000000000000..affd319d28507 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetLocationType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestoreTargetLocationType. */ +public final class RestoreTargetLocationType extends ExpandableStringEnum { + /** Static value Invalid for RestoreTargetLocationType. */ + public static final RestoreTargetLocationType INVALID = fromString("Invalid"); + + /** Static value AzureBlobs for RestoreTargetLocationType. */ + public static final RestoreTargetLocationType AZURE_BLOBS = fromString("AzureBlobs"); + + /** Static value AzureFiles for RestoreTargetLocationType. */ + public static final RestoreTargetLocationType AZURE_FILES = fromString("AzureFiles"); + + /** + * Creates or finds a RestoreTargetLocationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreTargetLocationType. + */ + @JsonCreator + public static RestoreTargetLocationType fromString(String name) { + return fromString(name, RestoreTargetLocationType.class); + } + + /** @return known RestoreTargetLocationType values. */ + public static Collection values() { + return values(RestoreTargetLocationType.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RetentionTag.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RetentionTag.java new file mode 100644 index 0000000000000..be582769762d5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RetentionTag.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** RetentionTag Retention tag. */ +@Fluent +public final class RetentionTag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RetentionTag.class); + + /* + * Retention Tag version. + */ + @JsonProperty(value = "eTag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Retention Tag version. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Retention Tag Name to relate it to retention rule. + */ + @JsonProperty(value = "tagName", required = true) + private String tagName; + + /** + * Get the etag property: Retention Tag version. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the id property: Retention Tag version. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the tagName property: Retention Tag Name to relate it to retention rule. + * + * @return the tagName value. + */ + public String tagName() { + return this.tagName; + } + + /** + * Set the tagName property: Retention Tag Name to relate it to retention rule. + * + * @param tagName the tagName value to set. + * @return the RetentionTag object itself. + */ + public RetentionTag withTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tagName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property tagName in model RetentionTag")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ScheduleBasedBackupCriteria.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ScheduleBasedBackupCriteria.java new file mode 100644 index 0000000000000..8ed995d5709e3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ScheduleBasedBackupCriteria.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.List; + +/** ScheduleBasedBackupCriteria Schedule based backup criteria. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("ScheduleBasedBackupCriteria") +@Fluent +public final class ScheduleBasedBackupCriteria extends BackupCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduleBasedBackupCriteria.class); + + /* + * it contains absolute values like "AllBackup" / "FirstOfDay" / + * "FirstOfWeek" / "FirstOfMonth" + * and should be part of AbsoluteMarker enum + */ + @JsonProperty(value = "absoluteCriteria") + private List absoluteCriteria; + + /* + * This is day of the month from 1 to 28 other wise last of month + */ + @JsonProperty(value = "daysOfMonth") + private List daysOfMonth; + + /* + * It should be Sunday/Monday/T..../Saturday + */ + @JsonProperty(value = "daysOfTheWeek") + private List daysOfTheWeek; + + /* + * It should be January/February/....../December + */ + @JsonProperty(value = "monthsOfYear") + private List monthsOfYear; + + /* + * List of schedule times for backup + */ + @JsonProperty(value = "scheduleTimes") + private List scheduleTimes; + + /* + * It should be First/Second/Third/Fourth/Last + */ + @JsonProperty(value = "weeksOfTheMonth") + private List weeksOfTheMonth; + + /** + * Get the absoluteCriteria property: it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / + * "FirstOfMonth" and should be part of AbsoluteMarker enum. + * + * @return the absoluteCriteria value. + */ + public List absoluteCriteria() { + return this.absoluteCriteria; + } + + /** + * Set the absoluteCriteria property: it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / + * "FirstOfMonth" and should be part of AbsoluteMarker enum. + * + * @param absoluteCriteria the absoluteCriteria value to set. + * @return the ScheduleBasedBackupCriteria object itself. + */ + public ScheduleBasedBackupCriteria withAbsoluteCriteria(List absoluteCriteria) { + this.absoluteCriteria = absoluteCriteria; + return this; + } + + /** + * Get the daysOfMonth property: This is day of the month from 1 to 28 other wise last of month. + * + * @return the daysOfMonth value. + */ + public List daysOfMonth() { + return this.daysOfMonth; + } + + /** + * Set the daysOfMonth property: This is day of the month from 1 to 28 other wise last of month. + * + * @param daysOfMonth the daysOfMonth value to set. + * @return the ScheduleBasedBackupCriteria object itself. + */ + public ScheduleBasedBackupCriteria withDaysOfMonth(List daysOfMonth) { + this.daysOfMonth = daysOfMonth; + return this; + } + + /** + * Get the daysOfTheWeek property: It should be Sunday/Monday/T..../Saturday. + * + * @return the daysOfTheWeek value. + */ + public List daysOfTheWeek() { + return this.daysOfTheWeek; + } + + /** + * Set the daysOfTheWeek property: It should be Sunday/Monday/T..../Saturday. + * + * @param daysOfTheWeek the daysOfTheWeek value to set. + * @return the ScheduleBasedBackupCriteria object itself. + */ + public ScheduleBasedBackupCriteria withDaysOfTheWeek(List daysOfTheWeek) { + this.daysOfTheWeek = daysOfTheWeek; + return this; + } + + /** + * Get the monthsOfYear property: It should be January/February/....../December. + * + * @return the monthsOfYear value. + */ + public List monthsOfYear() { + return this.monthsOfYear; + } + + /** + * Set the monthsOfYear property: It should be January/February/....../December. + * + * @param monthsOfYear the monthsOfYear value to set. + * @return the ScheduleBasedBackupCriteria object itself. + */ + public ScheduleBasedBackupCriteria withMonthsOfYear(List monthsOfYear) { + this.monthsOfYear = monthsOfYear; + return this; + } + + /** + * Get the scheduleTimes property: List of schedule times for backup. + * + * @return the scheduleTimes value. + */ + public List scheduleTimes() { + return this.scheduleTimes; + } + + /** + * Set the scheduleTimes property: List of schedule times for backup. + * + * @param scheduleTimes the scheduleTimes value to set. + * @return the ScheduleBasedBackupCriteria object itself. + */ + public ScheduleBasedBackupCriteria withScheduleTimes(List scheduleTimes) { + this.scheduleTimes = scheduleTimes; + return this; + } + + /** + * Get the weeksOfTheMonth property: It should be First/Second/Third/Fourth/Last. + * + * @return the weeksOfTheMonth value. + */ + public List weeksOfTheMonth() { + return this.weeksOfTheMonth; + } + + /** + * Set the weeksOfTheMonth property: It should be First/Second/Third/Fourth/Last. + * + * @param weeksOfTheMonth the weeksOfTheMonth value to set. + * @return the ScheduleBasedBackupCriteria object itself. + */ + public ScheduleBasedBackupCriteria withWeeksOfTheMonth(List weeksOfTheMonth) { + this.weeksOfTheMonth = weeksOfTheMonth; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (daysOfMonth() != null) { + daysOfMonth().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ScheduleBasedTriggerContext.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ScheduleBasedTriggerContext.java new file mode 100644 index 0000000000000..8060d36d2356b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ScheduleBasedTriggerContext.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** ScheduleBasedTriggerContext Schedule based trigger context. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("ScheduleBasedTriggerContext") +@Fluent +public final class ScheduleBasedTriggerContext extends TriggerContext { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduleBasedTriggerContext.class); + + /* + * BackupSchedule Schedule for this backup + */ + @JsonProperty(value = "schedule", required = true) + private BackupSchedule schedule; + + /* + * List of tags that can be applicable for given schedule. + */ + @JsonProperty(value = "taggingCriteria", required = true) + private List taggingCriteria; + + /** + * Get the schedule property: BackupSchedule Schedule for this backup. + * + * @return the schedule value. + */ + public BackupSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: BackupSchedule Schedule for this backup. + * + * @param schedule the schedule value to set. + * @return the ScheduleBasedTriggerContext object itself. + */ + public ScheduleBasedTriggerContext withSchedule(BackupSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the taggingCriteria property: List of tags that can be applicable for given schedule. + * + * @return the taggingCriteria value. + */ + public List taggingCriteria() { + return this.taggingCriteria; + } + + /** + * Set the taggingCriteria property: List of tags that can be applicable for given schedule. + * + * @param taggingCriteria the taggingCriteria value to set. + * @return the ScheduleBasedTriggerContext object itself. + */ + public ScheduleBasedTriggerContext withTaggingCriteria(List taggingCriteria) { + this.taggingCriteria = taggingCriteria; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (schedule() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schedule in model ScheduleBasedTriggerContext")); + } else { + schedule().validate(); + } + if (taggingCriteria() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property taggingCriteria in model ScheduleBasedTriggerContext")); + } else { + taggingCriteria().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreBasedAuthCredentials.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreBasedAuthCredentials.java new file mode 100644 index 0000000000000..b3a7c621d6f35 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreBasedAuthCredentials.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Secret store based authentication credentials. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("SecretStoreBasedAuthCredentials") +@Fluent +public final class SecretStoreBasedAuthCredentials extends AuthCredentials { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecretStoreBasedAuthCredentials.class); + + /* + * Secret store resource + */ + @JsonProperty(value = "secretStoreResource") + private SecretStoreResource secretStoreResource; + + /** + * Get the secretStoreResource property: Secret store resource. + * + * @return the secretStoreResource value. + */ + public SecretStoreResource secretStoreResource() { + return this.secretStoreResource; + } + + /** + * Set the secretStoreResource property: Secret store resource. + * + * @param secretStoreResource the secretStoreResource value to set. + * @return the SecretStoreBasedAuthCredentials object itself. + */ + public SecretStoreBasedAuthCredentials withSecretStoreResource(SecretStoreResource secretStoreResource) { + this.secretStoreResource = secretStoreResource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (secretStoreResource() != null) { + secretStoreResource().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreResource.java new file mode 100644 index 0000000000000..05358573dab36 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreResource.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.dataprotection.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; + +/** Class representing a secret store resource. */ +@Fluent +public final class SecretStoreResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecretStoreResource.class); + + /* + * Uri to get to the resource + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Gets or sets the type of secret store + */ + @JsonProperty(value = "secretStoreType", required = true) + private SecretStoreType secretStoreType; + + /** + * Get the uri property: Uri to get to the resource. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: Uri to get to the resource. + * + * @param uri the uri value to set. + * @return the SecretStoreResource object itself. + */ + public SecretStoreResource withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the secretStoreType property: Gets or sets the type of secret store. + * + * @return the secretStoreType value. + */ + public SecretStoreType secretStoreType() { + return this.secretStoreType; + } + + /** + * Set the secretStoreType property: Gets or sets the type of secret store. + * + * @param secretStoreType the secretStoreType value to set. + * @return the SecretStoreResource object itself. + */ + public SecretStoreResource withSecretStoreType(SecretStoreType secretStoreType) { + this.secretStoreType = secretStoreType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (secretStoreType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property secretStoreType in model SecretStoreResource")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreType.java new file mode 100644 index 0000000000000..6f16c358d11a0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SecretStoreType.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.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecretStoreType. */ +public final class SecretStoreType extends ExpandableStringEnum { + /** Static value Invalid for SecretStoreType. */ + public static final SecretStoreType INVALID = fromString("Invalid"); + + /** Static value AzureKeyVault for SecretStoreType. */ + public static final SecretStoreType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a SecretStoreType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecretStoreType. + */ + @JsonCreator + public static SecretStoreType fromString(String name) { + return fromString(name, SecretStoreType.class); + } + + /** @return known SecretStoreType values. */ + public static Collection values() { + return values(SecretStoreType.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceDataStoreType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceDataStoreType.java new file mode 100644 index 0000000000000..5ba8eca14deba --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceDataStoreType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SourceDataStoreType. */ +public final class SourceDataStoreType extends ExpandableStringEnum { + /** Static value ArchiveStore for SourceDataStoreType. */ + public static final SourceDataStoreType ARCHIVE_STORE = fromString("ArchiveStore"); + + /** Static value SnapshotStore for SourceDataStoreType. */ + public static final SourceDataStoreType SNAPSHOT_STORE = fromString("SnapshotStore"); + + /** Static value VaultStore for SourceDataStoreType. */ + public static final SourceDataStoreType VAULT_STORE = fromString("VaultStore"); + + /** + * Creates or finds a SourceDataStoreType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceDataStoreType. + */ + @JsonCreator + public static SourceDataStoreType fromString(String name) { + return fromString(name, SourceDataStoreType.class); + } + + /** @return known SourceDataStoreType values. */ + public static Collection values() { + return values(SourceDataStoreType.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceLifeCycle.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceLifeCycle.java new file mode 100644 index 0000000000000..cb9138f32ef77 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceLifeCycle.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SourceLifeCycle Source LifeCycle. */ +@Fluent +public final class SourceLifeCycle { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SourceLifeCycle.class); + + /* + * DeleteOption Delete Option + */ + @JsonProperty(value = "deleteAfter", required = true) + private DeleteOption deleteAfter; + + /* + * DataStoreInfoBase DataStoreInfo base + */ + @JsonProperty(value = "sourceDataStore", required = true) + private DataStoreInfoBase sourceDataStore; + + /* + * The targetDataStoreCopySettings property. + */ + @JsonProperty(value = "targetDataStoreCopySettings") + private List targetDataStoreCopySettings; + + /** + * Get the deleteAfter property: DeleteOption Delete Option. + * + * @return the deleteAfter value. + */ + public DeleteOption deleteAfter() { + return this.deleteAfter; + } + + /** + * Set the deleteAfter property: DeleteOption Delete Option. + * + * @param deleteAfter the deleteAfter value to set. + * @return the SourceLifeCycle object itself. + */ + public SourceLifeCycle withDeleteAfter(DeleteOption deleteAfter) { + this.deleteAfter = deleteAfter; + return this; + } + + /** + * Get the sourceDataStore property: DataStoreInfoBase DataStoreInfo base. + * + * @return the sourceDataStore value. + */ + public DataStoreInfoBase sourceDataStore() { + return this.sourceDataStore; + } + + /** + * Set the sourceDataStore property: DataStoreInfoBase DataStoreInfo base. + * + * @param sourceDataStore the sourceDataStore value to set. + * @return the SourceLifeCycle object itself. + */ + public SourceLifeCycle withSourceDataStore(DataStoreInfoBase sourceDataStore) { + this.sourceDataStore = sourceDataStore; + return this; + } + + /** + * Get the targetDataStoreCopySettings property: The targetDataStoreCopySettings property. + * + * @return the targetDataStoreCopySettings value. + */ + public List targetDataStoreCopySettings() { + return this.targetDataStoreCopySettings; + } + + /** + * Set the targetDataStoreCopySettings property: The targetDataStoreCopySettings property. + * + * @param targetDataStoreCopySettings the targetDataStoreCopySettings value to set. + * @return the SourceLifeCycle object itself. + */ + public SourceLifeCycle withTargetDataStoreCopySettings(List targetDataStoreCopySettings) { + this.targetDataStoreCopySettings = targetDataStoreCopySettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deleteAfter() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property deleteAfter in model SourceLifeCycle")); + } else { + deleteAfter().validate(); + } + if (sourceDataStore() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sourceDataStore in model SourceLifeCycle")); + } else { + sourceDataStore().validate(); + } + if (targetDataStoreCopySettings() != null) { + targetDataStoreCopySettings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Status.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Status.java new file mode 100644 index 0000000000000..cd7098c374c51 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Status.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Status. */ +public final class Status extends ExpandableStringEnum { + /** Static value ConfiguringProtection for Status. */ + public static final Status CONFIGURING_PROTECTION = fromString("ConfiguringProtection"); + + /** Static value ConfiguringProtectionFailed for Status. */ + public static final Status CONFIGURING_PROTECTION_FAILED = fromString("ConfiguringProtectionFailed"); + + /** Static value ProtectionConfigured for Status. */ + public static final Status PROTECTION_CONFIGURED = fromString("ProtectionConfigured"); + + /** Static value ProtectionStopped for Status. */ + public static final Status PROTECTION_STOPPED = fromString("ProtectionStopped"); + + /** Static value SoftDeleted for Status. */ + public static final Status SOFT_DELETED = fromString("SoftDeleted"); + + /** Static value SoftDeleting for Status. */ + public static final Status SOFT_DELETING = fromString("SoftDeleting"); + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** @return known Status values. */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSetting.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSetting.java new file mode 100644 index 0000000000000..a68e8d2e34c78 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSetting.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** StorageSetting Storage setting. */ +@Fluent +public final class StorageSetting { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageSetting.class); + + /* + * Gets or sets the type of the datastore. + */ + @JsonProperty(value = "datastoreType") + private StorageSettingStoreTypes datastoreType; + + /* + * Gets or sets the type. + */ + @JsonProperty(value = "type") + private StorageSettingTypes type; + + /** + * Get the datastoreType property: Gets or sets the type of the datastore. + * + * @return the datastoreType value. + */ + public StorageSettingStoreTypes datastoreType() { + return this.datastoreType; + } + + /** + * Set the datastoreType property: Gets or sets the type of the datastore. + * + * @param datastoreType the datastoreType value to set. + * @return the StorageSetting object itself. + */ + public StorageSetting withDatastoreType(StorageSettingStoreTypes datastoreType) { + this.datastoreType = datastoreType; + return this; + } + + /** + * Get the type property: Gets or sets the type. + * + * @return the type value. + */ + public StorageSettingTypes type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the type. + * + * @param type the type value to set. + * @return the StorageSetting object itself. + */ + public StorageSetting withType(StorageSettingTypes type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSettingStoreTypes.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSettingStoreTypes.java new file mode 100644 index 0000000000000..a7cd5aee9f864 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSettingStoreTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageSettingStoreTypes. */ +public final class StorageSettingStoreTypes extends ExpandableStringEnum { + /** Static value ArchiveStore for StorageSettingStoreTypes. */ + public static final StorageSettingStoreTypes ARCHIVE_STORE = fromString("ArchiveStore"); + + /** Static value SnapshotStore for StorageSettingStoreTypes. */ + public static final StorageSettingStoreTypes SNAPSHOT_STORE = fromString("SnapshotStore"); + + /** Static value VaultStore for StorageSettingStoreTypes. */ + public static final StorageSettingStoreTypes VAULT_STORE = fromString("VaultStore"); + + /** + * Creates or finds a StorageSettingStoreTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageSettingStoreTypes. + */ + @JsonCreator + public static StorageSettingStoreTypes fromString(String name) { + return fromString(name, StorageSettingStoreTypes.class); + } + + /** @return known StorageSettingStoreTypes values. */ + public static Collection values() { + return values(StorageSettingStoreTypes.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSettingTypes.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSettingTypes.java new file mode 100644 index 0000000000000..6cbaa020b6120 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/StorageSettingTypes.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.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageSettingTypes. */ +public final class StorageSettingTypes extends ExpandableStringEnum { + /** Static value GeoRedundant for StorageSettingTypes. */ + public static final StorageSettingTypes GEO_REDUNDANT = fromString("GeoRedundant"); + + /** Static value LocallyRedundant for StorageSettingTypes. */ + public static final StorageSettingTypes LOCALLY_REDUNDANT = fromString("LocallyRedundant"); + + /** + * Creates or finds a StorageSettingTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageSettingTypes. + */ + @JsonCreator + public static StorageSettingTypes fromString(String name) { + return fromString(name, StorageSettingTypes.class); + } + + /** @return known StorageSettingTypes values. */ + public static Collection values() { + return values(StorageSettingTypes.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SupportedFeature.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SupportedFeature.java new file mode 100644 index 0000000000000..4b089c23756b1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SupportedFeature.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Elements class for feature request. */ +@Fluent +public final class SupportedFeature { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SupportedFeature.class); + + /* + * support feature type. + */ + @JsonProperty(value = "featureName") + private String featureName; + + /* + * feature support status + */ + @JsonProperty(value = "supportStatus") + private FeatureSupportStatus supportStatus; + + /* + * support feature type. + */ + @JsonProperty(value = "exposureControlledFeatures") + private List exposureControlledFeatures; + + /** + * Get the featureName property: support feature type. + * + * @return the featureName value. + */ + public String featureName() { + return this.featureName; + } + + /** + * Set the featureName property: support feature type. + * + * @param featureName the featureName value to set. + * @return the SupportedFeature object itself. + */ + public SupportedFeature withFeatureName(String featureName) { + this.featureName = featureName; + return this; + } + + /** + * Get the supportStatus property: feature support status. + * + * @return the supportStatus value. + */ + public FeatureSupportStatus supportStatus() { + return this.supportStatus; + } + + /** + * Set the supportStatus property: feature support status. + * + * @param supportStatus the supportStatus value to set. + * @return the SupportedFeature object itself. + */ + public SupportedFeature withSupportStatus(FeatureSupportStatus supportStatus) { + this.supportStatus = supportStatus; + return this; + } + + /** + * Get the exposureControlledFeatures property: support feature type. + * + * @return the exposureControlledFeatures value. + */ + public List exposureControlledFeatures() { + return this.exposureControlledFeatures; + } + + /** + * Set the exposureControlledFeatures property: support feature type. + * + * @param exposureControlledFeatures the exposureControlledFeatures value to set. + * @return the SupportedFeature object itself. + */ + public SupportedFeature withExposureControlledFeatures(List exposureControlledFeatures) { + this.exposureControlledFeatures = exposureControlledFeatures; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TaggingCriteria.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TaggingCriteria.java new file mode 100644 index 0000000000000..70f1c0c1490e7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TaggingCriteria.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** TaggingCriteria Tagging criteria. */ +@Fluent +public final class TaggingCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TaggingCriteria.class); + + /* + * Criteria which decides whether the tag can be applied to a triggered + * backup. + */ + @JsonProperty(value = "criteria") + private List criteria; + + /* + * Specifies if tag is default. + */ + @JsonProperty(value = "isDefault", required = true) + private boolean isDefault; + + /* + * Retention Tag priority. + */ + @JsonProperty(value = "taggingPriority", required = true) + private long taggingPriority; + + /* + * RetentionTag Retention tag information + */ + @JsonProperty(value = "tagInfo", required = true) + private RetentionTag tagInfo; + + /** + * Get the criteria property: Criteria which decides whether the tag can be applied to a triggered backup. + * + * @return the criteria value. + */ + public List criteria() { + return this.criteria; + } + + /** + * Set the criteria property: Criteria which decides whether the tag can be applied to a triggered backup. + * + * @param criteria the criteria value to set. + * @return the TaggingCriteria object itself. + */ + public TaggingCriteria withCriteria(List criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the isDefault property: Specifies if tag is default. + * + * @return the isDefault value. + */ + public boolean isDefault() { + return this.isDefault; + } + + /** + * Set the isDefault property: Specifies if tag is default. + * + * @param isDefault the isDefault value to set. + * @return the TaggingCriteria object itself. + */ + public TaggingCriteria withIsDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Get the taggingPriority property: Retention Tag priority. + * + * @return the taggingPriority value. + */ + public long taggingPriority() { + return this.taggingPriority; + } + + /** + * Set the taggingPriority property: Retention Tag priority. + * + * @param taggingPriority the taggingPriority value to set. + * @return the TaggingCriteria object itself. + */ + public TaggingCriteria withTaggingPriority(long taggingPriority) { + this.taggingPriority = taggingPriority; + return this; + } + + /** + * Get the tagInfo property: RetentionTag Retention tag information. + * + * @return the tagInfo value. + */ + public RetentionTag tagInfo() { + return this.tagInfo; + } + + /** + * Set the tagInfo property: RetentionTag Retention tag information. + * + * @param tagInfo the tagInfo value to set. + * @return the TaggingCriteria object itself. + */ + public TaggingCriteria withTagInfo(RetentionTag tagInfo) { + this.tagInfo = tagInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (criteria() != null) { + criteria().forEach(e -> e.validate()); + } + if (tagInfo() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property tagInfo in model TaggingCriteria")); + } else { + tagInfo().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TargetCopySetting.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TargetCopySetting.java new file mode 100644 index 0000000000000..2f84ba438b49a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TargetCopySetting.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** TargetCopySetting Target copy settings. */ +@Fluent +public final class TargetCopySetting { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetCopySetting.class); + + /* + * CopyOption It can be CustomCopyOption or ImmediateCopyOption. + */ + @JsonProperty(value = "copyAfter", required = true) + private CopyOption copyAfter; + + /* + * DataStoreInfoBase Info of target datastore + */ + @JsonProperty(value = "dataStore", required = true) + private DataStoreInfoBase dataStore; + + /** + * Get the copyAfter property: CopyOption It can be CustomCopyOption or ImmediateCopyOption. + * + * @return the copyAfter value. + */ + public CopyOption copyAfter() { + return this.copyAfter; + } + + /** + * Set the copyAfter property: CopyOption It can be CustomCopyOption or ImmediateCopyOption. + * + * @param copyAfter the copyAfter value to set. + * @return the TargetCopySetting object itself. + */ + public TargetCopySetting withCopyAfter(CopyOption copyAfter) { + this.copyAfter = copyAfter; + return this; + } + + /** + * Get the dataStore property: DataStoreInfoBase Info of target datastore. + * + * @return the dataStore value. + */ + public DataStoreInfoBase dataStore() { + return this.dataStore; + } + + /** + * Set the dataStore property: DataStoreInfoBase Info of target datastore. + * + * @param dataStore the dataStore value to set. + * @return the TargetCopySetting object itself. + */ + public TargetCopySetting withDataStore(DataStoreInfoBase dataStore) { + this.dataStore = dataStore; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (copyAfter() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property copyAfter in model TargetCopySetting")); + } else { + copyAfter().validate(); + } + if (dataStore() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataStore in model TargetCopySetting")); + } else { + dataStore().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TargetDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TargetDetails.java new file mode 100644 index 0000000000000..8c005dcb08064 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TargetDetails.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** Class encapsulating target details, used where the destination is not a datasource. */ +@Fluent +public final class TargetDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetDetails.class); + + /* + * Restore operation may create multiple files inside location pointed by + * Url + * Below will be the common prefix for all of them + */ + @JsonProperty(value = "filePrefix", required = true) + private String filePrefix; + + /* + * Denotes the target location where the data will be restored, + * string value for the enum + * {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType} + */ + @JsonProperty(value = "restoreTargetLocationType", required = true) + private RestoreTargetLocationType restoreTargetLocationType; + + /* + * Url denoting the restore destination. It can point to container / file + * share etc + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get the filePrefix property: Restore operation may create multiple files inside location pointed by Url Below + * will be the common prefix for all of them. + * + * @return the filePrefix value. + */ + public String filePrefix() { + return this.filePrefix; + } + + /** + * Set the filePrefix property: Restore operation may create multiple files inside location pointed by Url Below + * will be the common prefix for all of them. + * + * @param filePrefix the filePrefix value to set. + * @return the TargetDetails object itself. + */ + public TargetDetails withFilePrefix(String filePrefix) { + this.filePrefix = filePrefix; + return this; + } + + /** + * Get the restoreTargetLocationType property: Denotes the target location where the data will be restored, string + * value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + * + * @return the restoreTargetLocationType value. + */ + public RestoreTargetLocationType restoreTargetLocationType() { + return this.restoreTargetLocationType; + } + + /** + * Set the restoreTargetLocationType property: Denotes the target location where the data will be restored, string + * value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + * + * @param restoreTargetLocationType the restoreTargetLocationType value to set. + * @return the TargetDetails object itself. + */ + public TargetDetails withRestoreTargetLocationType(RestoreTargetLocationType restoreTargetLocationType) { + this.restoreTargetLocationType = restoreTargetLocationType; + return this; + } + + /** + * Get the url property: Url denoting the restore destination. It can point to container / file share etc. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: Url denoting the restore destination. It can point to container / file share etc. + * + * @param url the url value to set. + * @return the TargetDetails object itself. + */ + public TargetDetails withUrl(String url) { + this.url = url; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filePrefix() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property filePrefix in model TargetDetails")); + } + if (restoreTargetLocationType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restoreTargetLocationType in model TargetDetails")); + } + if (url() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property url in model TargetDetails")); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerBackupRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerBackupRequest.java new file mode 100644 index 0000000000000..c147a2a0eafdf --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerBackupRequest.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** TriggerBackupRequest Trigger backup request. */ +@Fluent +public final class TriggerBackupRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TriggerBackupRequest.class); + + /* + * AdHocBackupRuleOptions Name for the Rule of the Policy which needs to be + * applied for this backup + */ + @JsonProperty(value = "backupRuleOptions", required = true) + private AdHocBackupRuleOptions backupRuleOptions; + + /** + * Get the backupRuleOptions property: AdHocBackupRuleOptions Name for the Rule of the Policy which needs to be + * applied for this backup. + * + * @return the backupRuleOptions value. + */ + public AdHocBackupRuleOptions backupRuleOptions() { + return this.backupRuleOptions; + } + + /** + * Set the backupRuleOptions property: AdHocBackupRuleOptions Name for the Rule of the Policy which needs to be + * applied for this backup. + * + * @param backupRuleOptions the backupRuleOptions value to set. + * @return the TriggerBackupRequest object itself. + */ + public TriggerBackupRequest withBackupRuleOptions(AdHocBackupRuleOptions backupRuleOptions) { + this.backupRuleOptions = backupRuleOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (backupRuleOptions() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property backupRuleOptions in model TriggerBackupRequest")); + } else { + backupRuleOptions().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerContext.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerContext.java new file mode 100644 index 0000000000000..de2763ef44652 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerContext.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** TriggerContext Trigger context. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "objectType", + defaultImpl = TriggerContext.class) +@JsonTypeName("TriggerContext") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AdhocBasedTriggerContext", value = AdhocBasedTriggerContext.class), + @JsonSubTypes.Type(name = "ScheduleBasedTriggerContext", value = ScheduleBasedTriggerContext.class) +}) +@Immutable +public class TriggerContext { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TriggerContext.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/UserFacingError.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/UserFacingError.java new file mode 100644 index 0000000000000..d92904d1ca88f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/UserFacingError.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Error object used by layers that have access to localized content, and propagate that to user. */ +@Fluent +public final class UserFacingError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserFacingError.class); + + /* + * Unique code for this error + */ + @JsonProperty(value = "code") + private String code; + + /* + * Additional related Errors + */ + @JsonProperty(value = "details") + private List details; + + /* + * InnerError Inner Error + */ + @JsonProperty(value = "innerError") + private InnerError innerError; + + /* + * Whether the operation will be retryable or not + */ + @JsonProperty(value = "isRetryable") + private Boolean isRetryable; + + /* + * Whether the operation is due to a user error or service error + */ + @JsonProperty(value = "isUserError") + private Boolean isUserError; + + /* + * Any key value pairs that can be injected inside error object + */ + @JsonProperty(value = "properties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /* + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /* + * RecommendedAction � localized. + */ + @JsonProperty(value = "recommendedAction") + private List recommendedAction; + + /* + * Target of the error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Get the code property: Unique code for this error. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Unique code for this error. + * + * @param code the code value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the details property: Additional related Errors. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: Additional related Errors. + * + * @param details the details value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get the innerError property: InnerError Inner Error. + * + * @return the innerError value. + */ + public InnerError innerError() { + return this.innerError; + } + + /** + * Set the innerError property: InnerError Inner Error. + * + * @param innerError the innerError value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withInnerError(InnerError innerError) { + this.innerError = innerError; + return this; + } + + /** + * Get the isRetryable property: Whether the operation will be retryable or not. + * + * @return the isRetryable value. + */ + public Boolean isRetryable() { + return this.isRetryable; + } + + /** + * Set the isRetryable property: Whether the operation will be retryable or not. + * + * @param isRetryable the isRetryable value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withIsRetryable(Boolean isRetryable) { + this.isRetryable = isRetryable; + return this; + } + + /** + * Get the isUserError property: Whether the operation is due to a user error or service error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Set the isUserError property: Whether the operation is due to a user error or service error. + * + * @param isUserError the isUserError value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withIsUserError(Boolean isUserError) { + this.isUserError = isUserError; + return this; + } + + /** + * Get the properties property: Any key value pairs that can be injected inside error object. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: Any key value pairs that can be injected inside error object. + * + * @param properties the properties value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get the message property: The message property. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message property. + * + * @param message the message value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the recommendedAction property: RecommendedAction � localized. + * + * @return the recommendedAction value. + */ + public List recommendedAction() { + return this.recommendedAction; + } + + /** + * Set the recommendedAction property: RecommendedAction � localized. + * + * @param recommendedAction the recommendedAction value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withRecommendedAction(List recommendedAction) { + this.recommendedAction = recommendedAction; + return this; + } + + /** + * Get the target property: Target of the error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: Target of the error. + * + * @param target the target value to set. + * @return the UserFacingError object itself. + */ + public UserFacingError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + if (innerError() != null) { + innerError().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ValidateForBackupRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ValidateForBackupRequest.java new file mode 100644 index 0000000000000..a40f07d68d30b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ValidateForBackupRequest.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** ValidateForBackupRequest Validate for backup request. */ +@Fluent +public final class ValidateForBackupRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ValidateForBackupRequest.class); + + /* + * Backup Instance + */ + @JsonProperty(value = "backupInstance", required = true) + private BackupInstance backupInstance; + + /** + * Get the backupInstance property: Backup Instance. + * + * @return the backupInstance value. + */ + public BackupInstance backupInstance() { + return this.backupInstance; + } + + /** + * Set the backupInstance property: Backup Instance. + * + * @param backupInstance the backupInstance value to set. + * @return the ValidateForBackupRequest object itself. + */ + public ValidateForBackupRequest withBackupInstance(BackupInstance backupInstance) { + this.backupInstance = backupInstance; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (backupInstance() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property backupInstance in model ValidateForBackupRequest")); + } else { + backupInstance().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ValidateRestoreRequestObject.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ValidateRestoreRequestObject.java new file mode 100644 index 0000000000000..7fd964193e2c4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ValidateRestoreRequestObject.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.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; + +/** ValidateRestoreRequestObject Validate restore request object. */ +@Fluent +public final class ValidateRestoreRequestObject { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ValidateRestoreRequestObject.class); + + /* + * AzureBackupRestoreRequest Gets or sets the restore request object. + */ + @JsonProperty(value = "restoreRequestObject", required = true) + private AzureBackupRestoreRequest restoreRequestObject; + + /** + * Get the restoreRequestObject property: AzureBackupRestoreRequest Gets or sets the restore request object. + * + * @return the restoreRequestObject value. + */ + public AzureBackupRestoreRequest restoreRequestObject() { + return this.restoreRequestObject; + } + + /** + * Set the restoreRequestObject property: AzureBackupRestoreRequest Gets or sets the restore request object. + * + * @param restoreRequestObject the restoreRequestObject value to set. + * @return the ValidateRestoreRequestObject object itself. + */ + public ValidateRestoreRequestObject withRestoreRequestObject(AzureBackupRestoreRequest restoreRequestObject) { + this.restoreRequestObject = restoreRequestObject; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restoreRequestObject() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restoreRequestObject in model ValidateRestoreRequestObject")); + } else { + restoreRequestObject().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/WeekNumber.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/WeekNumber.java new file mode 100644 index 0000000000000..dbb3ec2256357 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/WeekNumber.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WeekNumber. */ +public final class WeekNumber extends ExpandableStringEnum { + /** Static value First for WeekNumber. */ + public static final WeekNumber FIRST = fromString("First"); + + /** Static value Fourth for WeekNumber. */ + public static final WeekNumber FOURTH = fromString("Fourth"); + + /** Static value Last for WeekNumber. */ + public static final WeekNumber LAST = fromString("Last"); + + /** Static value Second for WeekNumber. */ + public static final WeekNumber SECOND = fromString("Second"); + + /** Static value Third for WeekNumber. */ + public static final WeekNumber THIRD = fromString("Third"); + + /** + * Creates or finds a WeekNumber from its string representation. + * + * @param name a name to look for. + * @return the corresponding WeekNumber. + */ + @JsonCreator + public static WeekNumber fromString(String name) { + return fromString(name, WeekNumber.class); + } + + /** @return known WeekNumber values. */ + public static Collection values() { + return values(WeekNumber.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/package-info.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/package-info.java new file mode 100644 index 0000000000000..ba817d86188e4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for DataProtectionClient. Open API 2.0 Specs for Azure Data Protection service. + */ +package com.azure.resourcemanager.dataprotection.models; diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/package-info.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/package-info.java new file mode 100644 index 0000000000000..c90a2b2bfd247 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for DataProtectionClient. Open API 2.0 Specs for Azure Data Protection service. */ +package com.azure.resourcemanager.dataprotection; diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/module-info.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/module-info.java new file mode 100644 index 0000000000000..97dbdf7bf57ca --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.dataprotection { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.dataprotection; + exports com.azure.resourcemanager.dataprotection.fluent; + exports com.azure.resourcemanager.dataprotection.fluent.models; + exports com.azure.resourcemanager.dataprotection.models; + + opens com.azure.resourcemanager.dataprotection.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.dataprotection.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/dataprotection/ci.yml b/sdk/dataprotection/ci.yml new file mode 100644 index 0000000000000..f6fc8df7ba973 --- /dev/null +++ b/sdk/dataprotection/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ci.yml + - sdk/dataprotection/azure-resourcemanager-dataprotection/ + exclude: + - sdk/dataprotection/pom.xml + - sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ci.yml + - sdk/dataprotection/azure-resourcemanager-dataprotection/ + exclude: + - sdk/dataprotection/pom.xml + - sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dataprotection + Artifacts: + - name: azure-resourcemanager-dataprotection + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdataprotection diff --git a/sdk/dataprotection/pom.xml b/sdk/dataprotection/pom.xml new file mode 100644 index 0000000000000..dda2ad0351a56 --- /dev/null +++ b/sdk/dataprotection/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-dataprotection-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-dataprotection + + + +