diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 74a1c2e2aef3..2d4879571505 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -206,6 +206,7 @@ com.azure.resourcemanager:azure-resourcemanager-digitaltwins;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-netapp;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagecache;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redisenterprise;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 8069fdfba48a..fc7809c45152 100644 --- a/pom.xml +++ b/pom.xml @@ -586,6 +586,7 @@ sdk/core sdk/cosmos sdk/costmanagement + sdk/dataprotection sdk/digitaltwins sdk/eventgrid sdk/eventhubs diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md b/sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md new file mode 100644 index 000000000000..36c1c113e4e8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-02-25) + +- 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-02-preview. 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 000000000000..6e817dcfe91d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/README.md @@ -0,0 +1,99 @@ +# 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-02-preview. 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/master/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/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/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 000000000000..a847df7d4e7e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml @@ -0,0 +1,67 @@ + + 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. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2021-02-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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.13.0 + + + com.azure + azure-core-management + 1.1.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + 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 000000000000..6387dbf71b0f --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/DataProtectionManager.java @@ -0,0 +1,348 @@ +// 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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.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.BackupVaultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.DataProtectionClientBuilder; +import com.azure.resourcemanager.dataprotection.implementation.ExportJobsImpl; +import com.azure.resourcemanager.dataprotection.implementation.ExportJobsOperationResultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.JobOperationsImpl; +import com.azure.resourcemanager.dataprotection.implementation.JobsImpl; +import com.azure.resourcemanager.dataprotection.implementation.OperationResultsImpl; +import com.azure.resourcemanager.dataprotection.implementation.OperationsImpl; +import com.azure.resourcemanager.dataprotection.implementation.RecoveryPointOperationsImpl; +import com.azure.resourcemanager.dataprotection.implementation.RecoveryPointsImpl; +import com.azure.resourcemanager.dataprotection.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.dataprotection.models.BackupInstances; +import com.azure.resourcemanager.dataprotection.models.BackupPolicies; +import com.azure.resourcemanager.dataprotection.models.BackupVaults; +import com.azure.resourcemanager.dataprotection.models.ExportJobs; +import com.azure.resourcemanager.dataprotection.models.ExportJobsOperationResults; +import com.azure.resourcemanager.dataprotection.models.JobOperations; +import com.azure.resourcemanager.dataprotection.models.Jobs; +import com.azure.resourcemanager.dataprotection.models.OperationResults; +import com.azure.resourcemanager.dataprotection.models.Operations; +import com.azure.resourcemanager.dataprotection.models.RecoveryPointOperations; +import com.azure.resourcemanager.dataprotection.models.RecoveryPoints; +import com.azure.resourcemanager.dataprotection.models.ResourceProviders; +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 ResourceProviders resourceProviders; + + private Operations operations; + + private BackupPolicies backupPolicies; + + private BackupInstances backupInstances; + + private RecoveryPoints recoveryPoints; + + private RecoveryPointOperations recoveryPointOperations; + + private Jobs jobs; + + private JobOperations jobOperations; + + private ExportJobs exportJobs; + + private ExportJobsOperationResults exportJobsOperationResults; + + 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 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; + } + + /** + * 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 (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 BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + 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 ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @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 RecoveryPointOperations. */ + public RecoveryPointOperations recoveryPointOperations() { + if (this.recoveryPointOperations == null) { + this.recoveryPointOperations = + new RecoveryPointOperationsImpl(clientObject.getRecoveryPointOperations(), this); + } + return recoveryPointOperations; + } + + /** @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 JobOperations. */ + public JobOperations jobOperations() { + if (this.jobOperations == null) { + this.jobOperations = new JobOperationsImpl(clientObject.getJobOperations(), this); + } + return jobOperations; + } + + /** @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 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 000000000000..fabb386014b4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupInstancesClient.java @@ -0,0 +1,549 @@ +// 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.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 getBackupInstancesInVault(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 getBackupInstancesInVault( + 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); + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupInstanceResourceInner> beginPut( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner 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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupInstanceResourceInner> beginPut( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInstanceResourceInner put( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner 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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInstanceResourceInner put( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * @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); + + /** + * @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); + + /** + * @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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginValidateRestore( + 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginValidateRestore( + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void validateRestore( + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void validateRestore( + 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 000000000000..22624ad8c3e7 --- /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 list of BaseBackupPolicy resources. + */ + @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 list of BaseBackupPolicy resources. + */ + @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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BaseBackupPolicyResourceInner put( + 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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse( + 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/BackupVaultsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultsClient.java new file mode 100644 index 000000000000..0263429a6b0e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/BackupVaultsClient.java @@ -0,0 +1,274 @@ +// 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 list of BackupVault resources. + */ + @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 list of BackupVault resources. + */ + @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 list of BackupVault resources. + */ + @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 list of BackupVault resources. + */ + @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 backup Vault 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 backup Vault 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginPut( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginPut( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner put(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner put( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginPatch( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupVaultResourceInner> beginPatch( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner patch(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner patch( + 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 checkNameAvailability Result. + */ + @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 checkNameAvailability Result. + */ + @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 000000000000..f411dcb84dc8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/DataProtectionClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * 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 RecoveryPointOperationsClient object to access its operations. + * + * @return the RecoveryPointOperationsClient object. + */ + RecoveryPointOperationsClient getRecoveryPointOperations(); + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + JobsClient getJobs(); + + /** + * Gets the JobOperationsClient object to access its operations. + * + * @return the JobOperationsClient object. + */ + JobOperationsClient getJobOperations(); + + /** + * 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(); +} 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 000000000000..d807fc789928 --- /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 000000000000..71636c714b0e --- /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/JobOperationsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobOperationsClient.java new file mode 100644 index 000000000000..f9790253f668 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobOperationsClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.AzureBackupJobResourceInner; + +/** An instance of this class provides access to all the operations defined in JobOperationsClient. */ +public interface JobOperationsClient { + /** + * 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/JobsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobsClient.java new file mode 100644 index 000000000000..3ed5d80431f1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/JobsClient.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.PagedIterable; +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); +} 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 000000000000..36d20ca2a9f4 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationResultsClient.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.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; + +/** 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void 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) + Response getWithResponse(String operationId, String location, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationsClient.java new file mode 100644 index 000000000000..ccb8bf0df683 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/OperationsClient.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 OperationsClient. */ +public interface OperationsClient { + /** + * 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 operations List response which contains list of available APIs. + */ + @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 operations List response which contains list of available APIs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointOperationsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointOperationsClient.java new file mode 100644 index 000000000000..9fe22bdcc11c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointOperationsClient.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.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.AzureBackupRecoveryPointResourceInner; + +/** An instance of this class provides access to all the operations defined in RecoveryPointOperationsClient. */ +public interface RecoveryPointOperationsClient { + /** + * 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/RecoveryPointsClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointsClient.java new file mode 100644 index 000000000000..153cead8881d --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/RecoveryPointsClient.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.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.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 azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getList( + 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 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 azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getList( + String vaultName, String resourceGroupName, String backupInstanceName, Context context); +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ResourceProvidersClient.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..9c804556cc46 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/ResourceProvidersClient.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.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.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationRequestBase; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Gets the operation status for a resource. + * + * @param 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 getOperationStatus(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 getOperationStatusWithResponse( + String location, String operationId, 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupVaultResourceInner getOperationResultPatch(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationResultPatchWithResponse( + String vaultName, String resourceGroupName, String operationId, 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 com.azure.core.management.exception.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/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 000000000000..f3fc551c9511 --- /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 000000000000..bfe1f1ede704 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/AzureBackupRecoveryPointResourceInner.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Azure backup recoveryPoint resource. */ +@JsonFlatten +@Immutable +public class AzureBackupRecoveryPointResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBackupRecoveryPointResourceInner.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/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 000000000000..e073f1190445 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupInstanceResourceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.Datasource; +import com.azure.resourcemanager.dataprotection.models.DatasourceSet; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.azure.resourcemanager.dataprotection.models.PolicyInfo; +import com.azure.resourcemanager.dataprotection.models.ProtectionStatusDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** BackupInstance Resource. */ +@JsonFlatten +@Fluent +public class BackupInstanceResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstanceResourceInner.class); + + /* + * Gets or sets the data source information. + */ + @JsonProperty(value = "properties.dataSourceInfo") + private Datasource dataSourceInfo; + + /* + * Gets or sets the data source set information. + */ + @JsonProperty(value = "properties.dataSourceSetInfo") + private DatasourceSet dataSourceSetInfo; + + /* + * The objectType property. + */ + @JsonProperty(value = "properties.objectType") + private String objectType; + + /* + * Gets or sets the policy information. + */ + @JsonProperty(value = "properties.policyInfo") + private PolicyInfo policyInfo; + + /* + * Specifies the protection status of the resource + */ + @JsonProperty(value = "properties.protectionStatus", access = JsonProperty.Access.WRITE_ONLY) + private ProtectionStatusDetails protectionStatus; + + /* + * Specifies the provisioning state of the resource i.e. + * provisioning/updating/Succeeded/Failed + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the dataSourceInfo property: Gets or sets the data source information. + * + * @return the dataSourceInfo value. + */ + public Datasource dataSourceInfo() { + return this.dataSourceInfo; + } + + /** + * Set the dataSourceInfo property: Gets or sets the data source information. + * + * @param dataSourceInfo the dataSourceInfo value to set. + * @return the BackupInstanceResourceInner object itself. + */ + public BackupInstanceResourceInner withDataSourceInfo(Datasource dataSourceInfo) { + this.dataSourceInfo = dataSourceInfo; + return this; + } + + /** + * Get the dataSourceSetInfo property: Gets or sets the data source set information. + * + * @return the dataSourceSetInfo value. + */ + public DatasourceSet dataSourceSetInfo() { + return this.dataSourceSetInfo; + } + + /** + * Set the dataSourceSetInfo property: Gets or sets the data source set information. + * + * @param dataSourceSetInfo the dataSourceSetInfo value to set. + * @return the BackupInstanceResourceInner object itself. + */ + public BackupInstanceResourceInner withDataSourceSetInfo(DatasourceSet dataSourceSetInfo) { + this.dataSourceSetInfo = dataSourceSetInfo; + 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 BackupInstanceResourceInner object itself. + */ + public BackupInstanceResourceInner withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Get the policyInfo property: Gets or sets the policy information. + * + * @return the policyInfo value. + */ + public PolicyInfo policyInfo() { + return this.policyInfo; + } + + /** + * Set the policyInfo property: Gets or sets the policy information. + * + * @param policyInfo the policyInfo value to set. + * @return the BackupInstanceResourceInner object itself. + */ + public BackupInstanceResourceInner withPolicyInfo(PolicyInfo policyInfo) { + this.policyInfo = policyInfo; + return this; + } + + /** + * Get the protectionStatus property: Specifies the protection status of the resource. + * + * @return the protectionStatus value. + */ + public ProtectionStatusDetails protectionStatus() { + return this.protectionStatus; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (dataSourceInfo() != null) { + dataSourceInfo().validate(); + } + if (dataSourceSetInfo() != null) { + dataSourceSetInfo().validate(); + } + if (policyInfo() != null) { + policyInfo().validate(); + } + if (protectionStatus() != null) { + protectionStatus().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 000000000000..2abe1b279cba --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BackupVaultResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +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.ProvisioningState; +import com.azure.resourcemanager.dataprotection.models.StorageSetting; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Backup Vault Resource. */ +@JsonFlatten +@Fluent +public class BackupVaultResourceInner extends DppTrackedResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupVaultResourceInner.class); + + /* + * Provisioning state of the BackupVault resource + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Storage Settings + */ + @JsonProperty(value = "properties.storageSettings") + 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 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 BackupVaultResourceInner object itself. + */ + public BackupVaultResourceInner withStorageSettings(List storageSettings) { + this.storageSettings = storageSettings; + 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 (storageSettings() != null) { + storageSettings().forEach(e -> e.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 000000000000..b2cf54ee16ca --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/BaseBackupPolicyResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.DppResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** BaseBackupPolicy resource. */ +@JsonFlatten +@Fluent +public class BaseBackupPolicyResourceInner extends DppResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BaseBackupPolicyResourceInner.class); + + /* + * Type of datasource for the backup management + */ + @JsonProperty(value = "properties.datasourceTypes") + 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 BaseBackupPolicyResourceInner object itself. + */ + public BaseBackupPolicyResourceInner withDatasourceTypes(List datasourceTypes) { + this.datasourceTypes = datasourceTypes; + 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/CheckNameAvailabilityResultInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..e11c9e3e7dfd --- /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; + +/** 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 000000000000..0c05904d754a --- /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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryDisplay; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryForServiceSpecification; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Available operation details. */ +@JsonFlatten +@Fluent +public class ClientDiscoveryValueForSingleApiInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientDiscoveryValueForSingleApiInner.class); + + /* + * 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; + + /* + * Operation properties. + */ + @JsonProperty(value = "properties.serviceSpecification") + private ClientDiscoveryForServiceSpecification serviceSpecification; + + /** + * Get the display property: Contains the localized display information for this particular operation. + * + * @return the display value. + */ + public ClientDiscoveryDisplay display() { + return this.display; + } + + /** + * Set the display property: 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 serviceSpecification property: Operation properties. + * + * @return the serviceSpecification value. + */ + public ClientDiscoveryForServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: Operation properties. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the ClientDiscoveryValueForSingleApiInner object itself. + */ + public ClientDiscoveryValueForSingleApiInner withServiceSpecification( + ClientDiscoveryForServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (serviceSpecification() != null) { + serviceSpecification().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 000000000000..1fc6bb9a6ea2 --- /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; + +/** 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 000000000000..0e9a3db10739 --- /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/OperationResourceInner.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationResourceInner.java new file mode 100644 index 000000000000..6cfd25af97b0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/fluent/models/OperationResourceInner.java @@ -0,0 +1,224 @@ +// 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.annotation.JsonFlatten; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Operation Resource. */ +@JsonFlatten +@Fluent +public 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; + + /* + * Start time of the operation + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The status property. + */ + @JsonProperty(value = "status") + private String status; + + /* + * This property will be used as the discriminator for deciding the + * specific types in the polymorphic chain of types. + */ + @JsonProperty(value = "properties.objectType") + private String objectType; + + /** + * 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 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; + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @param objectType the objectType value to set. + * @return the OperationResourceInner object itself. + */ + public OperationResourceInner withObjectType(String objectType) { + this.objectType = objectType; + 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/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 000000000000..a6a6163c4875 --- /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 000000000000..8494f21366f8 --- /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/AzureBackupJobResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupJobResourceImpl.java new file mode 100644 index 000000000000..2d7bc6978e15 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupJobResourceImpl.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.implementation; + +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJob; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJobResource; +import com.azure.resourcemanager.dataprotection.models.SystemData; + +public final class AzureBackupJobResourceImpl implements AzureBackupJobResource { + private AzureBackupJobResourceInner innerObject; + + private final DataProtectionManager serviceManager; + + AzureBackupJobResourceImpl(AzureBackupJobResourceInner innerObject, 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 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 000000000000..6e6633d8de61 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/AzureBackupRecoveryPointResourceImpl.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.implementation; + +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPointResource; +import com.azure.resourcemanager.dataprotection.models.SystemData; + +public final class AzureBackupRecoveryPointResourceImpl implements AzureBackupRecoveryPointResource { + private AzureBackupRecoveryPointResourceInner innerObject; + + private final DataProtectionManager serviceManager; + + AzureBackupRecoveryPointResourceImpl( + AzureBackupRecoveryPointResourceInner innerObject, 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 AzureBackupRecoveryPointResourceInner innerModel() { + return this.innerObject; + } + + private 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 000000000000..0515e775f357 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstanceResourceImpl.java @@ -0,0 +1,220 @@ +// 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.resourcemanager.dataprotection.DataProtectionManager; +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.BackupInstanceResource; +import com.azure.resourcemanager.dataprotection.models.Datasource; +import com.azure.resourcemanager.dataprotection.models.DatasourceSet; +import com.azure.resourcemanager.dataprotection.models.PolicyInfo; +import com.azure.resourcemanager.dataprotection.models.ProtectionStatusDetails; +import com.azure.resourcemanager.dataprotection.models.SystemData; +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 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 Datasource dataSourceInfo() { + return this.innerModel().dataSourceInfo(); + } + + public DatasourceSet dataSourceSetInfo() { + return this.innerModel().dataSourceSetInfo(); + } + + public String objectType() { + return this.innerModel().objectType(); + } + + public PolicyInfo policyInfo() { + return this.innerModel().policyInfo(); + } + + public ProtectionStatusDetails protectionStatus() { + return this.innerModel().protectionStatus(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public BackupInstanceResourceInner innerModel() { + return this.innerObject; + } + + private 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() + .put(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public BackupInstanceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .put(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), context); + return this; + } + + BackupInstanceResourceImpl(String name, 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() + .put(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public BackupInstanceResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupInstances() + .put(vaultName, resourceGroupName, backupInstanceName, this.innerModel(), context); + return this; + } + + BackupInstanceResourceImpl(BackupInstanceResourceInner innerObject, 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 void adhocBackup(TriggerBackupRequest parameters) { + serviceManager.backupInstances().adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public void adhocBackup(TriggerBackupRequest parameters, Context context) { + 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 void triggerRestore(AzureBackupRestoreRequest parameters) { + serviceManager.backupInstances().triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public void triggerRestore(AzureBackupRestoreRequest parameters, Context context) { + serviceManager + .backupInstances() + .triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public void validateRestore(ValidateRestoreRequestObject parameters) { + serviceManager.backupInstances().validateRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public void validateRestore(ValidateRestoreRequestObject parameters, Context context) { + serviceManager + .backupInstances() + .validateRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public BackupInstanceResourceImpl withDataSourceInfo(Datasource dataSourceInfo) { + this.innerModel().withDataSourceInfo(dataSourceInfo); + return this; + } + + public BackupInstanceResourceImpl withDataSourceSetInfo(DatasourceSet dataSourceSetInfo) { + this.innerModel().withDataSourceSetInfo(dataSourceSetInfo); + return this; + } + + public BackupInstanceResourceImpl withObjectType(String objectType) { + this.innerModel().withObjectType(objectType); + return this; + } + + public BackupInstanceResourceImpl withPolicyInfo(PolicyInfo policyInfo) { + this.innerModel().withPolicyInfo(policyInfo); + 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 000000000000..a099fdad2c71 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesClientImpl.java @@ -0,0 +1,2668 @@ +// 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.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> getBackupInstancesInVault( + @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>> put( + @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({202, 204}) + @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({202, 204}) + @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({202, 204}) + @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({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateRestore( + @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> getBackupInstancesInVaultNext( + @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> getBackupInstancesInVaultSinglePageAsync( + 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 + .getBackupInstancesInVault( + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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> getBackupInstancesInVaultSinglePageAsync( + 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 + .getBackupInstancesInVault( + 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 getBackupInstancesInVaultAsync( + String vaultName, String resourceGroupName) { + return new PagedFlux<>( + () -> getBackupInstancesInVaultSinglePageAsync(vaultName, resourceGroupName), + nextLink -> getBackupInstancesInVaultNextSinglePageAsync(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 getBackupInstancesInVaultAsync( + String vaultName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> getBackupInstancesInVaultSinglePageAsync(vaultName, resourceGroupName, context), + nextLink -> getBackupInstancesInVaultNextSinglePageAsync(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 getBackupInstancesInVault( + String vaultName, String resourceGroupName) { + return new PagedIterable<>(getBackupInstancesInVaultAsync(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 getBackupInstancesInVault( + String vaultName, String resourceGroupName, Context context) { + return new PagedIterable<>(getBackupInstancesInVaultAsync(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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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(); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> putWithResponseAsync( + 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 + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> putWithResponseAsync( + 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 + .put( + 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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupInstanceResourceInner> beginPutAsync( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + Mono>> mono = + putWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInstanceResourceInner.class, + BackupInstanceResourceInner.class, + Context.NONE); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupInstanceResourceInner> beginPutAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + putWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInstanceResourceInner.class, + BackupInstanceResourceInner.class, + 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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupInstanceResourceInner> beginPut( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + return beginPutAsync(vaultName, resourceGroupName, backupInstanceName, parameters).getSyncPoller(); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupInstanceResourceInner> beginPut( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + return beginPutAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).getSyncPoller(); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + return beginPutAsync(vaultName, resourceGroupName, backupInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + return beginPutAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * @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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInstanceResourceInner put( + String vaultName, String resourceGroupName, String backupInstanceName, BackupInstanceResourceInner parameters) { + return putAsync(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 backupInstance Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInstanceResourceInner put( + String vaultName, + String resourceGroupName, + String backupInstanceName, + BackupInstanceResourceInner parameters, + Context context) { + return putAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * @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); + } + + /** + * @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); + } + + /** + * @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); + } + + /** + * @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(); + } + + /** + * @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(); + } + + /** + * @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); + } + + /** + * @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); + } + + /** + * @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(); + } + + /** + * @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 the completion. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 the completion. + */ + @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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAdhocBackupAsync( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + Mono>> mono = + adhocBackupWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> 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(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> 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 the completion. + */ + @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 the completion. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void adhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void adhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + 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 the completion. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 the completion. + */ + @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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginValidateForBackupAsync( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + Mono>> mono = + validateForBackupWithResponseAsync(vaultName, resourceGroupName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> 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(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> 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 the completion. + */ + @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 the completion. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void validateForBackup(String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 the completion. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 the completion. + */ + @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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerRestoreAsync( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + Mono>> mono = + triggerRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> 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(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> 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 the completion. + */ + @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 the completion. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateRestoreWithResponseAsync( + 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 + .validateRestore( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateRestoreWithResponseAsync( + 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 + .validateRestore( + 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginValidateRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + Mono>> mono = + validateRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginValidateRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateRestoreWithResponseAsync(vaultName, resourceGroupName, backupInstanceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginValidateRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + return beginValidateRestoreAsync(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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginValidateRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + return beginValidateRestoreAsync(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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + return beginValidateRestoreAsync(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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateRestoreAsync( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + return beginValidateRestoreAsync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void validateRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + validateRestoreAsync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void validateRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + validateRestoreAsync(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 backupInstance Resource list response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupInstancesInVaultNextSinglePageAsync( + 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.getBackupInstancesInVaultNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 backupInstance Resource list response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupInstancesInVaultNextSinglePageAsync( + 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 + .getBackupInstancesInVaultNext(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 000000000000..90682c7789c0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesImpl.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.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.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.BackupInstancesClient; +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.BackupInstanceResource; +import com.azure.resourcemanager.dataprotection.models.BackupInstances; +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 DataProtectionManager serviceManager; + + public BackupInstancesImpl(BackupInstancesClient innerClient, DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable getBackupInstancesInVault(String vaultName, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().getBackupInstancesInVault(vaultName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new BackupInstanceResourceImpl(inner1, this.manager())); + } + + public PagedIterable getBackupInstancesInVault( + String vaultName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().getBackupInstancesInVault(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 void adhocBackup( + String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { + this.serviceClient().adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public void adhocBackup( + String vaultName, + String resourceGroupName, + String backupInstanceName, + TriggerBackupRequest parameters, + Context context) { + this.serviceClient().adhocBackup(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public void validateForBackup(String vaultName, String resourceGroupName, ValidateForBackupRequest parameters) { + this.serviceClient().validateForBackup(vaultName, resourceGroupName, parameters); + } + + public void validateForBackup( + String vaultName, String resourceGroupName, ValidateForBackupRequest parameters, Context context) { + this.serviceClient().validateForBackup(vaultName, resourceGroupName, parameters, context); + } + + 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 void triggerRestore( + String vaultName, String resourceGroupName, String backupInstanceName, AzureBackupRestoreRequest parameters) { + this.serviceClient().triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public void triggerRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + AzureBackupRestoreRequest parameters, + Context context) { + this.serviceClient().triggerRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + public void validateRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters) { + this.serviceClient().validateRestore(vaultName, resourceGroupName, backupInstanceName, parameters); + } + + public void validateRestore( + String vaultName, + String resourceGroupName, + String backupInstanceName, + ValidateRestoreRequestObject parameters, + Context context) { + this.serviceClient().validateRestore(vaultName, resourceGroupName, backupInstanceName, parameters, context); + } + + 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 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 000000000000..983f4f9373e6 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesClientImpl.java @@ -0,0 +1,902 @@ +// 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> put( + @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 list of BaseBackupPolicy resources. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 list of BaseBackupPolicy resources. + */ + @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 list of BaseBackupPolicy resources. + */ + @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 list of BaseBackupPolicy resources. + */ + @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 list of BaseBackupPolicy resources. + */ + @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 list of BaseBackupPolicy resources. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + 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 + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupPolicyName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + 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 + .put( + 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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String vaultName, String resourceGroupName, String backupPolicyName, BaseBackupPolicyResourceInner parameters) { + return putWithResponseAsync(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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BaseBackupPolicyResourceInner put( + String vaultName, String resourceGroupName, String backupPolicyName, BaseBackupPolicyResourceInner parameters) { + return putAsync(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 The backupPolicyName 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 baseBackupPolicy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse( + String vaultName, + String resourceGroupName, + String backupPolicyName, + BaseBackupPolicyResourceInner parameters, + Context context) { + return putWithResponseAsync(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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 list of BaseBackupPolicy 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 BaseBackupPolicy 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/BackupPoliciesImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesImpl.java new file mode 100644 index 000000000000..8317d19e1e2b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupPoliciesImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + public BackupPoliciesImpl(BackupPoliciesClient innerClient, 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 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/BackupVaultResourceImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultResourceImpl.java new file mode 100644 index 000000000000..21fc30aa23d7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultResourceImpl.java @@ -0,0 +1,221 @@ +// 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.util.Context; +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultResource; +import com.azure.resourcemanager.dataprotection.models.DppIdentityDetails; +import com.azure.resourcemanager.dataprotection.models.PatchResourceRequestInput; +import com.azure.resourcemanager.dataprotection.models.ProvisioningState; +import com.azure.resourcemanager.dataprotection.models.StorageSetting; +import com.azure.resourcemanager.dataprotection.models.SystemData; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class BackupVaultResourceImpl + implements BackupVaultResource, BackupVaultResource.Definition, BackupVaultResource.Update { + private BackupVaultResourceInner innerObject; + + private final 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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List storageSettings() { + List inner = this.innerModel().storageSettings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public BackupVaultResourceInner innerModel() { + return this.innerObject; + } + + private 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() + .put(vaultName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public BackupVaultResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .put(vaultName, resourceGroupName, this.innerModel(), context); + return this; + } + + BackupVaultResourceImpl(String name, 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() + .patch(vaultName, resourceGroupName, updateParameters, Context.NONE); + return this; + } + + public BackupVaultResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupVaults() + .patch(vaultName, resourceGroupName, updateParameters, context); + return this; + } + + BackupVaultResourceImpl(BackupVaultResourceInner innerObject, 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 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; + } + } + + public BackupVaultResourceImpl withStorageSettings(List storageSettings) { + this.innerModel().withStorageSettings(storageSettings); + 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 000000000000..1bf1d5489e25 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupVaultsClientImpl.java @@ -0,0 +1,1645 @@ +// 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>> put( + @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>> patch( + @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> 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); + } + + /** + * 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 list of BackupVault 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 list of BackupVault 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 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 list of BackupVault resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> getResourcesInSubscriptionNextSinglePageAsync(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 list of BackupVault resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), + nextLink -> getResourcesInSubscriptionNextSinglePageAsync(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 list of BackupVault resources. + */ + @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 list of BackupVault resources. + */ + @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 list of BackupVault 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 (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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 list of BackupVault 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 (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 list of BackupVault resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> getResourcesInResourceGroupNextSinglePageAsync(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 list of BackupVault resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> getResourcesInResourceGroupNextSinglePageAsync(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 list of BackupVault resources. + */ + @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 list of BackupVault resources. + */ + @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 backup Vault 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 backup Vault 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 backup Vault 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 backup Vault 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 backup Vault 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> putWithResponseAsync( + 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 + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> putWithResponseAsync( + 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 + .put( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginPutAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + Mono>> mono = putWithResponseAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginPutAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = putWithResponseAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginPut( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + return beginPutAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginPut( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + return beginPutAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + return beginPutAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + return beginPutAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner put( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters) { + return putAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner put( + String vaultName, String resourceGroupName, BackupVaultResourceInner parameters, Context context) { + return putAsync(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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> patchWithResponseAsync( + 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 + .patch( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> patchWithResponseAsync( + 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 + .patch( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginPatchAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + Mono>> mono = patchWithResponseAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupVaultResourceInner> beginPatchAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + patchWithResponseAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginPatch( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + return beginPatchAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupVaultResourceInner> beginPatch( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + return beginPatchAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono patchAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + return beginPatchAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono patchAsync( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + return beginPatchAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner patch( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters) { + return patchAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner patch( + String vaultName, String resourceGroupName, PatchResourceRequestInput parameters, Context context) { + return patchAsync(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 checkNameAvailability Result. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 checkNameAvailability Result. + */ + @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 checkNameAvailability Result. + */ + @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 checkNameAvailability Result. + */ + @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 checkNameAvailability Result. + */ + @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 list of BackupVault 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 BackupVault 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 BackupVault 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 BackupVault 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)); + } +} 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 000000000000..f5a014196034 --- /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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + public BackupVaultsImpl(BackupVaultsClient innerClient, 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 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 000000000000..40e1eb80ccb0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BaseBackupPolicyResourceImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; +import com.azure.resourcemanager.dataprotection.models.BaseBackupPolicyResource; +import com.azure.resourcemanager.dataprotection.models.SystemData; +import java.util.Collections; +import java.util.List; + +public final class BaseBackupPolicyResourceImpl + implements BaseBackupPolicyResource, BaseBackupPolicyResource.Definition, BaseBackupPolicyResource.Update { + private BaseBackupPolicyResourceInner innerObject; + + private final 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 List datasourceTypes() { + List inner = this.innerModel().datasourceTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public BaseBackupPolicyResourceInner innerModel() { + return this.innerObject; + } + + private 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() + .putWithResponse(vaultName, resourceGroupName, backupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public BaseBackupPolicyResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .putWithResponse(vaultName, resourceGroupName, backupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + BaseBackupPolicyResourceImpl(String name, 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() + .putWithResponse(vaultName, resourceGroupName, backupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public BaseBackupPolicyResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupPolicies() + .putWithResponse(vaultName, resourceGroupName, backupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + BaseBackupPolicyResourceImpl(BaseBackupPolicyResourceInner innerObject, 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 withDatasourceTypes(List datasourceTypes) { + this.innerModel().withDatasourceTypes(datasourceTypes); + 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 000000000000..06c581b6be81 --- /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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + CheckNameAvailabilityResultImpl( + CheckNameAvailabilityResultInner innerObject, 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 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 000000000000..07f7f54bf32c --- /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.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryDisplay; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryForServiceSpecification; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryValueForSingleApi; + +public final class ClientDiscoveryValueForSingleApiImpl implements ClientDiscoveryValueForSingleApi { + private ClientDiscoveryValueForSingleApiInner innerObject; + + private final DataProtectionManager serviceManager; + + ClientDiscoveryValueForSingleApiImpl( + ClientDiscoveryValueForSingleApiInner innerObject, 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 ClientDiscoveryForServiceSpecification serviceSpecification() { + return this.innerModel().serviceSpecification(); + } + + public ClientDiscoveryValueForSingleApiInner innerModel() { + return this.innerObject; + } + + private 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 000000000000..3b406729a3ef --- /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 000000000000..0e7952e2333b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/DataProtectionClientImpl.java @@ -0,0 +1,447 @@ +// 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.BackupVaultsClient; +import com.azure.resourcemanager.dataprotection.fluent.DataProtectionClient; +import com.azure.resourcemanager.dataprotection.fluent.ExportJobsClient; +import com.azure.resourcemanager.dataprotection.fluent.ExportJobsOperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.JobOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.JobsClient; +import com.azure.resourcemanager.dataprotection.fluent.OperationResultsClient; +import com.azure.resourcemanager.dataprotection.fluent.OperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.RecoveryPointOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.RecoveryPointsClient; +import com.azure.resourcemanager.dataprotection.fluent.ResourceProvidersClient; +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 ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The 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 RecoveryPointOperationsClient object to access its operations. */ + private final RecoveryPointOperationsClient recoveryPointOperations; + + /** + * Gets the RecoveryPointOperationsClient object to access its operations. + * + * @return the RecoveryPointOperationsClient object. + */ + public RecoveryPointOperationsClient getRecoveryPointOperations() { + return this.recoveryPointOperations; + } + + /** 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 JobOperationsClient object to access its operations. */ + private final JobOperationsClient jobOperations; + + /** + * Gets the JobOperationsClient object to access its operations. + * + * @return the JobOperationsClient object. + */ + public JobOperationsClient getJobOperations() { + return this.jobOperations; + } + + /** 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; + } + + /** + * 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-02-01-preview"; + this.backupVaults = new BackupVaultsClientImpl(this); + this.operationResults = new OperationResultsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.backupPolicies = new BackupPoliciesClientImpl(this); + this.backupInstances = new BackupInstancesClientImpl(this); + this.recoveryPoints = new RecoveryPointsClientImpl(this); + this.recoveryPointOperations = new RecoveryPointOperationsClientImpl(this); + this.jobs = new JobsClientImpl(this); + this.jobOperations = new JobOperationsClientImpl(this); + this.exportJobs = new ExportJobsClientImpl(this); + this.exportJobsOperationResults = new ExportJobsOperationResultsClientImpl(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/ExportJobsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsClientImpl.java new file mode 100644 index 000000000000..02d78d42b73b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsClientImpl.java @@ -0,0 +1,298 @@ +// 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.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, + @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.getSubscriptionId(), + resourceGroupName, + vaultName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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.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 000000000000..aa5a2c905ce5 --- /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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + public ExportJobsImpl(ExportJobsClient innerClient, 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 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 000000000000..9f6350489068 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsOperationResultsClientImpl.java @@ -0,0 +1,243 @@ +// 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.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, + @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.getSubscriptionId(), + resourceGroupName, + vaultName, + operationId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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.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 000000000000..b9b1e601e2f2 --- /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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + public ExportJobsOperationResultsImpl( + ExportJobsOperationResultsClient innerClient, 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 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 000000000000..767c85f66765 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ExportJobsResultImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.implementation; + +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +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 DataProtectionManager serviceManager; + + ExportJobsResultImpl(ExportJobsResultInner innerObject, 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 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 000000000000..3f3de66d2ae0 --- /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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + FeatureValidationResponseBaseImpl( + FeatureValidationResponseBaseInner innerObject, DataProtectionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public FeatureValidationResponseBaseInner innerModel() { + return this.innerObject; + } + + private DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobOperationsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobOperationsClientImpl.java new file mode 100644 index 000000000000..ff9b2ac31fb5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobOperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.JobOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobOperationsClient. */ +public final class JobOperationsClientImpl implements JobOperationsClient { + private final ClientLogger logger = new ClientLogger(JobOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobOperationsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of JobOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobOperationsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(JobOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientJobOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface JobOperationsService { + @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); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobOperationsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobOperationsImpl.java new file mode 100644 index 000000000000..f525e856b334 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobOperationsImpl.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.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.JobOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupJobResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupJobResource; +import com.azure.resourcemanager.dataprotection.models.JobOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobOperationsImpl implements JobOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobOperationsImpl.class); + + private final JobOperationsClient innerClient; + + private final DataProtectionManager serviceManager; + + public JobOperationsImpl(JobOperationsClient innerClient, DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 JobOperationsClient serviceClient() { + return this.innerClient; + } + + private 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 000000000000..441c4a7d624b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsClientImpl.java @@ -0,0 +1,336 @@ +// 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("{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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 000000000000..ce673a13475e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/JobsImpl.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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + public JobsImpl(JobsClient innerClient, 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())); + } + + private JobsClient serviceClient() { + return this.innerClient; + } + + private 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 000000000000..e1c3c62bf106 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResourceImpl.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.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.dataprotection.models.OperationResource; +import java.time.OffsetDateTime; + +public final class OperationResourceImpl implements OperationResource { + private OperationResourceInner innerObject; + + private final DataProtectionManager serviceManager; + + OperationResourceImpl(OperationResourceInner innerObject, 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 OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public String objectType() { + return this.innerModel().objectType(); + } + + public OperationResourceInner innerModel() { + return this.innerObject; + } + + private 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 000000000000..8804b1169ab0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.OperationResultsClient; +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({204}) + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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((Response res) -> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void get(String operationId, String location) { + 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 Response 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 000000000000..38b46c398c94 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationResultsImpl.java @@ -0,0 +1,42 @@ +// 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.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dataprotection.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.OperationResultsClient; +import com.azure.resourcemanager.dataprotection.models.OperationResults; +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 DataProtectionManager serviceManager; + + public OperationResultsImpl(OperationResultsClient innerClient, DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void get(String operationId, String location) { + this.serviceClient().get(operationId, location); + } + + public Response getWithResponse(String operationId, String location, Context context) { + return this.serviceClient().getWithResponse(operationId, location, context); + } + + private OperationResultsClient serviceClient() { + return this.innerClient; + } + + private DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..b9eca06fa487 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// 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.OperationsClient; +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 OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface OperationsService { + @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 operations List response which contains list of available APIs. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 operations List response which contains list of available APIs. + */ + @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 operations List response which contains list of available APIs. + */ + @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 operations List response which contains list of available APIs. + */ + @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 operations List response which contains list of available APIs. + */ + @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 operations List response which contains list of available APIs. + */ + @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 operations List response which contains list of available APIs. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 operations List response which contains list of available APIs. + */ + @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/OperationsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationsImpl.java new file mode 100644 index 000000000000..56ca2ec72066 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/OperationsImpl.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.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.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.OperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; +import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryValueForSingleApi; +import com.azure.resourcemanager.dataprotection.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final DataProtectionManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, 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 OperationsClient serviceClient() { + return this.innerClient; + } + + private DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointOperationsClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointOperationsClientImpl.java new file mode 100644 index 000000000000..1469f3a1acef --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointOperationsClientImpl.java @@ -0,0 +1,264 @@ +// 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.RecoveryPointOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoveryPointOperationsClient. */ +public final class RecoveryPointOperationsClientImpl implements RecoveryPointOperationsClient { + private final ClientLogger logger = new ClientLogger(RecoveryPointOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecoveryPointOperationsService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of RecoveryPointOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoveryPointOperationsClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy + .create(RecoveryPointOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientRecoveryPointOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface RecoveryPointOperationsService { + @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); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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(); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointOperationsImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointOperationsImpl.java new file mode 100644 index 000000000000..1a604fcaeb7a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointOperationsImpl.java @@ -0,0 +1,70 @@ +// 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.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.RecoveryPointOperationsClient; +import com.azure.resourcemanager.dataprotection.fluent.models.AzureBackupRecoveryPointResourceInner; +import com.azure.resourcemanager.dataprotection.models.AzureBackupRecoveryPointResource; +import com.azure.resourcemanager.dataprotection.models.RecoveryPointOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecoveryPointOperationsImpl implements RecoveryPointOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoveryPointOperationsImpl.class); + + private final RecoveryPointOperationsClient innerClient; + + private final DataProtectionManager serviceManager; + + public RecoveryPointOperationsImpl( + RecoveryPointOperationsClient innerClient, DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 RecoveryPointOperationsClient serviceClient() { + return this.innerClient; + } + + private 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 000000000000..0157546af0da --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsClientImpl.java @@ -0,0 +1,358 @@ +// 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> getList( + @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"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getListNext( + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getListSinglePageAsync( + 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 + .getList( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getListSinglePageAsync( + 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 + .getList( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + backupInstanceName, + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getListAsync( + String vaultName, String resourceGroupName, String backupInstanceName) { + return new PagedFlux<>( + () -> getListSinglePageAsync(vaultName, resourceGroupName, backupInstanceName), + nextLink -> getListNextSinglePageAsync(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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getListAsync( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + return new PagedFlux<>( + () -> getListSinglePageAsync(vaultName, resourceGroupName, backupInstanceName, context), + nextLink -> getListNextSinglePageAsync(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 azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getList( + String vaultName, String resourceGroupName, String backupInstanceName) { + return new PagedIterable<>(getListAsync(vaultName, resourceGroupName, 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getList( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + return new PagedIterable<>(getListAsync(vaultName, resourceGroupName, backupInstanceName, 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 azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getListNextSinglePageAsync(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.getListNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 azure backup recoveryPoint resource list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getListNextSinglePageAsync( + 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 + .getListNext(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 000000000000..e0c936e6a4e7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/RecoveryPointsImpl.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.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.DataProtectionManager; +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 DataProtectionManager serviceManager; + + public RecoveryPointsImpl(RecoveryPointsClient innerClient, DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable getList( + String vaultName, String resourceGroupName, String backupInstanceName) { + PagedIterable inner = + this.serviceClient().getList(vaultName, resourceGroupName, backupInstanceName); + return Utils.mapPage(inner, inner1 -> new AzureBackupRecoveryPointResourceImpl(inner1, this.manager())); + } + + public PagedIterable getList( + String vaultName, String resourceGroupName, String backupInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().getList(vaultName, resourceGroupName, backupInstanceName, context); + return Utils.mapPage(inner, inner1 -> new AzureBackupRecoveryPointResourceImpl(inner1, this.manager())); + } + + private RecoveryPointsClient serviceClient() { + return this.innerClient; + } + + private DataProtectionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceProvidersClientImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..0502bd5234ae --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,562 @@ +// 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.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.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.ResourceProvidersClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +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 ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final DataProtectionClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(DataProtectionClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataProtectionClientResourceProviders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataProtectionClient") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus" + + "/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOperationStatus( + @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); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection" + + "/backupVaults/{vaultName}/operationResults/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOperationResultPatch( + @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); + + @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); + } + + /** + * 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> getOperationStatusWithResponseAsync( + 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 + .getOperationStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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> getOperationStatusWithResponseAsync( + 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 + .getOperationStatus( + 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 getOperationStatusAsync(String location, String operationId) { + return getOperationStatusWithResponseAsync(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 getOperationStatus(String location, String operationId) { + return getOperationStatusAsync(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 getOperationStatusWithResponse( + String location, String operationId, Context context) { + return getOperationStatusWithResponseAsync(location, operationId, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultPatchWithResponseAsync( + 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 + .getOperationResultPatch( + this.client.getEndpoint(), + this.client.getApiVersion(), + vaultName, + resourceGroupName, + this.client.getSubscriptionId(), + operationId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * @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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultPatchWithResponseAsync( + 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 + .getOperationResultPatch( + 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationResultPatchAsync( + String vaultName, String resourceGroupName, String operationId) { + return getOperationResultPatchWithResponseAsync(vaultName, resourceGroupName, operationId) + .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 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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupVaultResourceInner getOperationResultPatch( + String vaultName, String resourceGroupName, String operationId) { + return getOperationResultPatchAsync(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 backup Vault Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationResultPatchWithResponse( + String vaultName, String resourceGroupName, String operationId, Context context) { + return getOperationResultPatchWithResponseAsync(vaultName, resourceGroupName, operationId, context).block(); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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/ResourceProvidersImpl.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..1b683c46108a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/ResourceProvidersImpl.java @@ -0,0 +1,117 @@ +// 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.DataProtectionManager; +import com.azure.resourcemanager.dataprotection.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import com.azure.resourcemanager.dataprotection.fluent.models.FeatureValidationResponseBaseInner; +import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner; +import com.azure.resourcemanager.dataprotection.models.BackupVaultResource; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationRequestBase; +import com.azure.resourcemanager.dataprotection.models.FeatureValidationResponseBase; +import com.azure.resourcemanager.dataprotection.models.OperationResource; +import com.azure.resourcemanager.dataprotection.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final DataProtectionManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, DataProtectionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResource getOperationStatus(String location, String operationId) { + OperationResourceInner inner = this.serviceClient().getOperationStatus(location, operationId); + if (inner != null) { + return new OperationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationStatusWithResponse( + String location, String operationId, Context context) { + Response inner = + this.serviceClient().getOperationStatusWithResponse(location, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BackupVaultResource getOperationResultPatch(String vaultName, String resourceGroupName, String operationId) { + BackupVaultResourceInner inner = + this.serviceClient().getOperationResultPatch(vaultName, resourceGroupName, operationId); + if (inner != null) { + return new BackupVaultResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationResultPatchWithResponse( + String vaultName, String resourceGroupName, String operationId, Context context) { + Response inner = + this + .serviceClient() + .getOperationResultPatchWithResponse(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; + } + } + + 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 ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private 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 000000000000..53f9fc25f8c6 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/Utils.java @@ -0,0 +1,196 @@ +// 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.Mono; + +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 pageIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { + super(new PagedFlux(Mono::empty)); + this.pageIterable = pageIterable; + this.mapper = mapper; + this.pageMapper = + page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pageIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pageIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pageIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pageIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/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 000000000000..ff44e329d694 --- /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 000000000000..602f7870e4f0 --- /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.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; + +/** Delete option with duration. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("AbsoluteDeleteOption") +@Immutable +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 000000000000..57c1ff536962 --- /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 000000000000..abb7fb6f0422 --- /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; + +/** 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; + + /* + * 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: Adhoc backup trigger option. + * + * @return the triggerOption value. + */ + public AdhocBackupTriggerOption triggerOption() { + return this.triggerOption; + } + + /** + * Set the triggerOption property: 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 000000000000..460ef0e75ed3 --- /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; + +/** 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 000000000000..d22d3a53d5dc --- /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; + +/** Adhoc backup tagging criteria. */ +@Fluent +public final class AdhocBasedTaggingCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdhocBasedTaggingCriteria.class); + + /* + * Retention tag information + */ + @JsonProperty(value = "tagInfo") + private RetentionTag tagInfo; + + /** + * Get the tagInfo property: Retention tag information. + * + * @return the tagInfo value. + */ + public RetentionTag tagInfo() { + return this.tagInfo; + } + + /** + * Set the tagInfo property: 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 000000000000..6c41ae15f2d3 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AdhocBasedTriggerContext.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.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** 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); + + /* + * Tagging Criteria containing retention tag for adhoc backup. + */ + @JsonProperty(value = "taggingCriteria", required = true) + private AdhocBasedTaggingCriteria taggingCriteria; + + /** + * Get the taggingCriteria property: Tagging Criteria containing retention tag for adhoc backup. + * + * @return the taggingCriteria value. + */ + public AdhocBasedTaggingCriteria taggingCriteria() { + return this.taggingCriteria; + } + + /** + * Set the taggingCriteria property: 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/AzureBackupDiscreteRecoveryPoint.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupDiscreteRecoveryPoint.java new file mode 100644 index 000000000000..0367a4d6cda8 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupDiscreteRecoveryPoint.java @@ -0,0 +1,198 @@ +// 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; + +/** 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 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 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/AzureBackupJob.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJob.java new file mode 100644 index 000000000000..3b4b8f263fa1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJob.java @@ -0,0 +1,727 @@ +// 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.Duration; +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", required = true) + 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", access = JsonProperty.Access.WRITE_ONLY) + private Duration 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 JobOperationCategory 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; + + /** + * 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 Duration duration() { + return this.duration; + } + + /** + * 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 JobOperationCategory 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(JobOperationCategory 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; + } + + /** + * 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 (dataSourceSetName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dataSourceSetName 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 000000000000..f5a85af67344 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupJobResource.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.models; + +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 000000000000..5e07952c798f --- /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 000000000000..8bba59d555af --- /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; + +/** 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 000000000000..077ba457aa4f --- /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; + +/** 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 000000000000..8015fefe17c1 --- /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; + +/** 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 000000000000..8e390eaa6d3e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRecoveryPointResource.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.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 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 000000000000..9d62f6d4429d --- /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; + +/** 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/AzureBackupRehydrationRequest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRehydrationRequest.java new file mode 100644 index 000000000000..e4565e8c408b --- /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; + +/** 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 000000000000..9076be9edcb1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/AzureBackupRestoreRequest.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +/** 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) +}) +@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 000000000000..ba0c1df60dc3 --- /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; + +/** 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 000000000000..92231d502203 --- /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; + +/** 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 base + */ + @JsonProperty(value = "backupParameters") + private BackupParameters backupParameters; + + /* + * DataStoreInfo base + */ + @JsonProperty(value = "dataStore", required = true) + private DataStoreInfoBase dataStore; + + /* + * Trigger context + */ + @JsonProperty(value = "trigger", required = true) + private TriggerContext trigger; + + /** + * Get the backupParameters property: BackupParameters base. + * + * @return the backupParameters value. + */ + public BackupParameters backupParameters() { + return this.backupParameters; + } + + /** + * Set the backupParameters property: 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: DataStoreInfo base. + * + * @return the dataStore value. + */ + public DataStoreInfoBase dataStore() { + return this.dataStore; + } + + /** + * Set the dataStore property: 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: Trigger context. + * + * @return the trigger value. + */ + public TriggerContext trigger() { + return this.trigger; + } + + /** + * Set the trigger property: 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 000000000000..fb6326fa42f7 --- /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 Resource Group Uri. + */ + @JsonProperty(value = "resourceGroupId") + private String resourceGroupId; + + /** + * Get the resourceGroupId property: Gets or sets the Resource Group Uri. + * + * @return the resourceGroupId value. + */ + public String resourceGroupId() { + return this.resourceGroupId; + } + + /** + * Set the resourceGroupId property: Gets or sets the 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 000000000000..27d154098c6a --- /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; + +/** 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 000000000000..9c670c738fdd --- /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 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 000000000000..3217fad757d6 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstance.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 data source information. + */ + @JsonProperty(value = "dataSourceInfo", required = true) + private Datasource dataSourceInfo; + + /* + * Gets or sets the data source set information. + */ + @JsonProperty(value = "dataSourceSetInfo") + private DatasourceSet dataSourceSetInfo; + + /* + * The objectType property. + */ + @JsonProperty(value = "objectType") + private String objectType; + + /* + * Gets or sets the policy information. + */ + @JsonProperty(value = "policyInfo", required = true) + private PolicyInfo policyInfo; + + /* + * Specifies the protection status of the resource + */ + @JsonProperty(value = "protectionStatus", access = JsonProperty.Access.WRITE_ONLY) + private ProtectionStatusDetails protectionStatus; + + /* + * Specifies the provisioning state of the resource i.e. + * provisioning/updating/Succeeded/Failed + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the dataSourceInfo property: Gets or sets the data source information. + * + * @return the dataSourceInfo value. + */ + public Datasource dataSourceInfo() { + return this.dataSourceInfo; + } + + /** + * Set the dataSourceInfo property: 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: Gets or sets the data source set information. + * + * @return the dataSourceSetInfo value. + */ + public DatasourceSet dataSourceSetInfo() { + return this.dataSourceSetInfo; + } + + /** + * Set the dataSourceSetInfo property: 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 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; + } + + /** + * Get the policyInfo property: Gets or sets the policy information. + * + * @return the policyInfo value. + */ + public PolicyInfo policyInfo() { + return this.policyInfo; + } + + /** + * Set the policyInfo property: 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: Specifies the protection status of the resource. + * + * @return the protectionStatus value. + */ + public ProtectionStatusDetails protectionStatus() { + return this.protectionStatus; + } + + /** + * 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; + } + + /** + * 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(); + } + } +} 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 000000000000..c37f73b3844c --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstanceResource.java @@ -0,0 +1,344 @@ +// 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; +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 dataSourceInfo property: Gets or sets the data source information. + * + * @return the dataSourceInfo value. + */ + Datasource dataSourceInfo(); + + /** + * Gets the dataSourceSetInfo property: Gets or sets the data source set information. + * + * @return the dataSourceSetInfo value. + */ + DatasourceSet dataSourceSetInfo(); + + /** + * Gets the objectType property: The objectType property. + * + * @return the objectType value. + */ + String objectType(); + + /** + * Gets the policyInfo property: Gets or sets the policy information. + * + * @return the policyInfo value. + */ + PolicyInfo policyInfo(); + + /** + * Gets the protectionStatus property: Specifies the protection status of the resource. + * + * @return the protectionStatus value. + */ + ProtectionStatusDetails protectionStatus(); + + /** + * Gets the provisioningState property: Specifies the provisioning state of the resource i.e. + * provisioning/updating/Succeeded/Failed. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * 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.WithDataSourceInfo, + DefinitionStages.WithDataSourceSetInfo, + DefinitionStages.WithObjectType, + DefinitionStages.WithPolicyInfo { + /** + * 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 dataSourceInfo. */ + interface WithDataSourceInfo { + /** + * Specifies the dataSourceInfo property: Gets or sets the data source information.. + * + * @param dataSourceInfo Gets or sets the data source information. + * @return the next definition stage. + */ + WithCreate withDataSourceInfo(Datasource dataSourceInfo); + } + /** The stage of the BackupInstanceResource definition allowing to specify dataSourceSetInfo. */ + interface WithDataSourceSetInfo { + /** + * Specifies the dataSourceSetInfo property: Gets or sets the data source set information.. + * + * @param dataSourceSetInfo Gets or sets the data source set information. + * @return the next definition stage. + */ + WithCreate withDataSourceSetInfo(DatasourceSet dataSourceSetInfo); + } + /** The stage of the BackupInstanceResource definition allowing to specify objectType. */ + interface WithObjectType { + /** + * Specifies the objectType property: The objectType property.. + * + * @param objectType The objectType property. + * @return the next definition stage. + */ + WithCreate withObjectType(String objectType); + } + /** The stage of the BackupInstanceResource definition allowing to specify policyInfo. */ + interface WithPolicyInfo { + /** + * Specifies the policyInfo property: Gets or sets the policy information.. + * + * @param policyInfo Gets or sets the policy information. + * @return the next definition stage. + */ + WithCreate withPolicyInfo(PolicyInfo policyInfo); + } + } + /** + * Begins update for the BackupInstanceResource resource. + * + * @return the stage of resource update. + */ + BackupInstanceResource.Update update(); + + /** The template for BackupInstanceResource update. */ + interface Update + extends UpdateStages.WithDataSourceInfo, + UpdateStages.WithDataSourceSetInfo, + UpdateStages.WithObjectType, + UpdateStages.WithPolicyInfo { + /** + * 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 dataSourceInfo. */ + interface WithDataSourceInfo { + /** + * Specifies the dataSourceInfo property: Gets or sets the data source information.. + * + * @param dataSourceInfo Gets or sets the data source information. + * @return the next definition stage. + */ + Update withDataSourceInfo(Datasource dataSourceInfo); + } + /** The stage of the BackupInstanceResource update allowing to specify dataSourceSetInfo. */ + interface WithDataSourceSetInfo { + /** + * Specifies the dataSourceSetInfo property: Gets or sets the data source set information.. + * + * @param dataSourceSetInfo Gets or sets the data source set information. + * @return the next definition stage. + */ + Update withDataSourceSetInfo(DatasourceSet dataSourceSetInfo); + } + /** The stage of the BackupInstanceResource update allowing to specify objectType. */ + interface WithObjectType { + /** + * Specifies the objectType property: The objectType property.. + * + * @param objectType The objectType property. + * @return the next definition stage. + */ + Update withObjectType(String objectType); + } + /** The stage of the BackupInstanceResource update allowing to specify policyInfo. */ + interface WithPolicyInfo { + /** + * Specifies the policyInfo property: Gets or sets the policy information.. + * + * @param policyInfo Gets or sets the policy information. + * @return the next definition stage. + */ + Update withPolicyInfo(PolicyInfo policyInfo); + } + } + /** + * 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. + */ + void 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. + */ + void 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. + */ + void 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. + */ + void 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. + */ + void validateRestore(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. + */ + void validateRestore(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 000000000000..a2fa4e843803 --- /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; + +/** 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 000000000000..f486dba225e0 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstances.java @@ -0,0 +1,296 @@ +// 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 getBackupInstancesInVault(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 getBackupInstancesInVault( + 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); + + /** + * @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); + + /** + * @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. + */ + void 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. + */ + void 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. + */ + void 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. + */ + void 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. + */ + void 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. + */ + void 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. + */ + void validateRestore( + 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. + */ + void validateRestore( + 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); + + /** + * @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); + + /** + * @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 000000000000..55959dd528e3 --- /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 000000000000..4be4199b619e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesAdhocBackupResponse.java @@ -0,0 +1,30 @@ +// 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 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, + Void value, + BackupInstancesAdhocBackupHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} 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 000000000000..79dd0fce3d25 --- /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 000000000000..6b1472197160 --- /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 000000000000..c77f61d552e5 --- /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 000000000000..27be63eea233 --- /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 000000000000..385c730a2b3e --- /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 000000000000..6e6233129922 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesTriggerRestoreResponse.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 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, + Void value, + BackupInstancesTriggerRestoreHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} 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 000000000000..8a1cca7cbba1 --- /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 000000000000..92983c774f46 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateForBackupResponse.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 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, + Void value, + BackupInstancesValidateForBackupHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateRestoreHeaders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateRestoreHeaders.java new file mode 100644 index 000000000000..613818bd7f00 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateRestoreHeaders.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 BackupInstancesValidateRestoreHeaders model. */ +@Fluent +public final class BackupInstancesValidateRestoreHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInstancesValidateRestoreHeaders.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 BackupInstancesValidateRestoreHeaders object itself. + */ + public BackupInstancesValidateRestoreHeaders 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 BackupInstancesValidateRestoreHeaders object itself. + */ + public BackupInstancesValidateRestoreHeaders 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 BackupInstancesValidateRestoreHeaders object itself. + */ + public BackupInstancesValidateRestoreHeaders 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/BackupInstancesValidateRestoreResponse.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateRestoreResponse.java new file mode 100644 index 000000000000..aae1ce98c8f2 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupInstancesValidateRestoreResponse.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 validateRestore operation. */ +public final class BackupInstancesValidateRestoreResponse + extends ResponseBase { + /** + * Creates an instance of BackupInstancesValidateRestoreResponse. + * + * @param request the request which resulted in this BackupInstancesValidateRestoreResponse. + * @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 BackupInstancesValidateRestoreResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + BackupInstancesValidateRestoreHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} 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 000000000000..43ebf0e88e39 --- /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 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 000000000000..e323922c9cb3 --- /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 list of BaseBackupPolicy resources. + */ + 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 list of BaseBackupPolicy resources. + */ + 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 000000000000..aceb224949af --- /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; + +/** 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 000000000000..44f2da98ad31 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupSchedule.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.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; + +/** 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; + + /** + * 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; + } + + /** + * 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/BackupVaultResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResource.java new file mode 100644 index 000000000000..f539fbd6b426 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/BackupVaultResource.java @@ -0,0 +1,272 @@ +// 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.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BackupVaultResourceInner; +import java.util.List; +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: 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 provisioningState property: Provisioning state of the BackupVault resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the storageSettings property: Storage Settings. + * + * @return the storageSettings value. + */ + List storageSettings(); + + /** + * 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.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. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * 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, + DefinitionStages.WithStorageSettings { + /** + * 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: Input Managed Identity Details. + * + * @param identity Input Managed Identity Details. + * @return the next definition stage. + */ + WithCreate withIdentity(DppIdentityDetails identity); + } + /** The stage of the BackupVaultResource definition allowing to specify storageSettings. */ + interface WithStorageSettings { + /** + * Specifies the storageSettings property: Storage Settings. + * + * @param storageSettings Storage Settings. + * @return the next definition stage. + */ + WithCreate withStorageSettings(List storageSettings); + } + } + /** + * 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: Input Managed Identity Details. + * + * @param identity 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 000000000000..daac1099a53d --- /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; + +/** 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 000000000000..ce87fd39ea84 --- /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 list of BackupVault resources. + */ + 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 list of BackupVault resources. + */ + 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 list of BackupVault resources. + */ + 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 list of BackupVault resources. + */ + 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 backup Vault 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 backup Vault 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 checkNameAvailability Result. + */ + 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 checkNameAvailability Result. + */ + 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 backup Vault 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 backup Vault 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 000000000000..e8fd34440c81 --- /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; + +/** 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 000000000000..bd83f91ef8a8 --- /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.util.Context; +import com.azure.resourcemanager.dataprotection.fluent.models.BaseBackupPolicyResourceInner; +import java.util.List; + +/** 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 datasourceTypes property: Type of datasource for the backup management. + * + * @return the datasourceTypes value. + */ + List datasourceTypes(); + + /** + * 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.WithDatasourceTypes { + /** + * 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 datasourceTypes. */ + interface WithDatasourceTypes { + /** + * Specifies the datasourceTypes property: Type of datasource for the backup management. + * + * @param datasourceTypes Type of datasource for the backup management. + * @return the next definition stage. + */ + WithCreate withDatasourceTypes(List datasourceTypes); + } + } + /** + * Begins update for the BaseBackupPolicyResource resource. + * + * @return the stage of resource update. + */ + BaseBackupPolicyResource.Update update(); + + /** The template for BaseBackupPolicyResource update. */ + interface Update extends UpdateStages.WithDatasourceTypes { + /** + * 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 datasourceTypes. */ + interface WithDatasourceTypes { + /** + * Specifies the datasourceTypes property: Type of datasource for the backup management. + * + * @param datasourceTypes Type of datasource for the backup management. + * @return the next definition stage. + */ + Update withDatasourceTypes(List datasourceTypes); + } + } + /** + * 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 000000000000..7eafbc368958 --- /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; + +/** 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 000000000000..38ff4d68aedf --- /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; + +/** 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 000000000000..49dcfab5487f --- /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; + +/** 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 000000000000..d788c17384df --- /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 000000000000..95647a26670c --- /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; + +/** 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 000000000000..d870d6eaad73 --- /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; + +/** 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/ClientDiscoveryForServiceSpecification.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryForServiceSpecification.java new file mode 100644 index 000000000000..95ccc4c9c382 --- /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; + +/** 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 000000000000..52ec4d0a1ca6 --- /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; + +/** 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 000000000000..319b38c3a92e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ClientDiscoveryValueForSingleApi.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.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner; + +/** An immutable client-side representation of ClientDiscoveryValueForSingleApi. */ +public interface ClientDiscoveryValueForSingleApi { + /** + * Gets the display property: 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 serviceSpecification property: Operation properties. + * + * @return the serviceSpecification value. + */ + ClientDiscoveryForServiceSpecification serviceSpecification(); + + /** + * 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 000000000000..a626fdfbf1e4 --- /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; + +/** 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 000000000000..429c48558c08 --- /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; + +/** 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/CreatedByType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CreatedByType.java new file mode 100644 index 000000000000..5ced2a196449 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/CreatedByType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dataprotection.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreatedByType. */ +public final class CreatedByType extends ExpandableStringEnum { + /** Static value User for CreatedByType. */ + public static final CreatedByType USER = fromString("User"); + + /** Static value Application for CreatedByType. */ + public static final CreatedByType APPLICATION = fromString("Application"); + + /** Static value ManagedIdentity for CreatedByType. */ + public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value Key for CreatedByType. */ + public static final CreatedByType KEY = fromString("Key"); + + /** + * Creates or finds a CreatedByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreatedByType. + */ + @JsonCreator + public static CreatedByType fromString(String name) { + return fromString(name, CreatedByType.class); + } + + /** @return known CreatedByType values. */ + public static Collection values() { + return values(CreatedByType.class); + } +} diff --git a/sdk/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 000000000000..1ff156348bbd --- /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; + +/** 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/DataStoreInfoBase.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DataStoreInfoBase.java new file mode 100644 index 000000000000..e1a2561a7c05 --- /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; + +/** 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 000000000000..84ea553cc511 --- /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 000000000000..6e57b84f201c --- /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 000000000000..69b3d638a321 --- /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 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 000000000000..dc6e7314cee7 --- /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 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 000000000000..d005b085644a --- /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 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 000000000000..0c67c4a59688 --- /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 000000000000..8c022b67f226 --- /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; + +/** 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/DppIdentityDetails.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppIdentityDetails.java new file mode 100644 index 000000000000..d998c9ea316a --- /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; + +/** 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 000000000000..92b6a1879c57 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppResource.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.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** 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() { + if (systemData() != null) { + systemData().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 000000000000..b32ff87ccff6 --- /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; + +/** 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 000000000000..ba2294d74683 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/DppTrackedResource.java @@ -0,0 +1,113 @@ +// 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.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; + + /* + * 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: Input Managed Identity Details. + * + * @return the identity value. + */ + public DppIdentityDetails identity() { + return this.identity; + } + + /** + * Set the identity property: 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(); + } + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ErrorAdditionalInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..b69d4a0ec870 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ErrorAdditionalInfo.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/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 000000000000..e57a9732a743 --- /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 000000000000..5c011ef84fef --- /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 000000000000..2263f8eb650c --- /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 000000000000..0bf1e8e6d19a --- /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 000000000000..01d12acd48fa --- /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 000000000000..78a88f1d7971 --- /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 000000000000..f79b9b134078 --- /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 000000000000..c7a6f237d770 --- /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 000000000000..d2512c623479 --- /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 000000000000..4c15bdee2315 --- /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 000000000000..1d462443c14b --- /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 000000000000..23f59f24bb06 --- /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; + +/** 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 000000000000..cde56c7c3b3a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/InnerError.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.Map; + +/** 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") + private Map additionalInfo; + + /* + * Unique code for this error + */ + @JsonProperty(value = "code") + private String code; + + /* + * 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: Child Inner Error, to allow Nesting. + * + * @return the embeddedInnerError value. + */ + public InnerError embeddedInnerError() { + return this.embeddedInnerError; + } + + /** + * Set the embeddedInnerError property: 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/JobExtendedInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobExtendedInfo.java new file mode 100644 index 000000000000..c2fca7e9912a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobExtendedInfo.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +/** 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") + 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/JobOperationCategory.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobOperationCategory.java new file mode 100644 index 000000000000..c6c498481c53 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobOperationCategory.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobOperationCategory. */ +public final class JobOperationCategory extends ExpandableStringEnum { + /** Static value Backup for JobOperationCategory. */ + public static final JobOperationCategory BACKUP = fromString("Backup"); + + /** Static value Restore for JobOperationCategory. */ + public static final JobOperationCategory RESTORE = fromString("Restore"); + + /** Static value Management for JobOperationCategory. */ + public static final JobOperationCategory MANAGEMENT = fromString("Management"); + + /** Static value Tiering for JobOperationCategory. */ + public static final JobOperationCategory TIERING = fromString("Tiering"); + + /** + * Creates or finds a JobOperationCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobOperationCategory. + */ + @JsonCreator + public static JobOperationCategory fromString(String name) { + return fromString(name, JobOperationCategory.class); + } + + /** @return known JobOperationCategory values. */ + public static Collection values() { + return values(JobOperationCategory.class); + } +} diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobOperations.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobOperations.java new file mode 100644 index 000000000000..ad3b7df5dce1 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobOperations.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.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobOperations. */ +public interface JobOperations { + /** + * 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/JobSubTask.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobSubTask.java new file mode 100644 index 000000000000..08a68c02f3ef --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/JobSubTask.java @@ -0,0 +1,154 @@ +// 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.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") + 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 000000000000..7536606c425b --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Jobs.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.PagedIterable; +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); +} 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 000000000000..e75f62ad67ce --- /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 000000000000..29bdedf9e10a --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationExtendedInfo.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; + +/** Operation Extended Info. */ +@Fluent +public class OperationExtendedInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationExtendedInfo.class); + + /* + * This property will be used as the discriminator for deciding the + * specific types in the polymorphic chain of types. + */ + @JsonProperty(value = "objectType") + private String objectType; + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @param objectType the objectType value to set. + * @return the OperationExtendedInfo object itself. + */ + public OperationExtendedInfo withObjectType(String objectType) { + this.objectType = objectType; + 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/OperationJobExtendedInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationJobExtendedInfo.java new file mode 100644 index 000000000000..9ecfb2049358 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationJobExtendedInfo.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; + +/** Operation Job Extended Info. */ +@Fluent +public final class OperationJobExtendedInfo extends OperationExtendedInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationJobExtendedInfo.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 OperationJobExtendedInfo object itself. + */ + public OperationJobExtendedInfo withJobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** {@inheritDoc} */ + @Override + public OperationJobExtendedInfo withObjectType(String objectType) { + super.withObjectType(objectType); + 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/OperationResource.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResource.java new file mode 100644 index 000000000000..864494dd9875 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResource.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.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 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 objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + String objectType(); + + /** + * 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 000000000000..4a81a07bb0c7 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/OperationResults.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 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. + */ + void 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/Operations.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Operations.java new file mode 100644 index 000000000000..7d43a9ad8535 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/Operations.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 Operations. */ +public interface Operations { + /** + * 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 operations List response which contains list of available APIs. + */ + 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 operations List response which contains list of available APIs. + */ + PagedIterable list(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 000000000000..602fe8aa5938 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/PatchResourceRequestInput.java @@ -0,0 +1,80 @@ +// 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.Map; + +/** Patch Request content for Microsoft.DataProtection resources. */ +@Fluent +public final class PatchResourceRequestInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchResourceRequestInput.class); + + /* + * Input Managed Identity Details + */ + @JsonProperty(value = "identity") + private DppIdentityDetails identity; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the identity property: Input Managed Identity Details. + * + * @return the identity value. + */ + public DppIdentityDetails identity() { + return this.identity; + } + + /** + * Set the identity property: 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 000000000000..7dad03aba8fc --- /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; + +/** 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 000000000000..01397badec25 --- /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 000000000000..c9f7e3ff978a --- /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; + +/** 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 000000000000..f8ff78a79110 --- /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/RecoveryOption.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryOption.java new file mode 100644 index 000000000000..962afd9bdd39 --- /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 000000000000..e9c624435f55 --- /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; + +/** 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/RecoveryPointOperations.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPointOperations.java new file mode 100644 index 000000000000..123990513186 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPointOperations.java @@ -0,0 +1,42 @@ +// 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 RecoveryPointOperations. */ +public interface RecoveryPointOperations { + /** + * 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/RecoveryPoints.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPoints.java new file mode 100644 index 000000000000..8bf014dd1d21 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RecoveryPoints.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.models; + +import com.azure.core.http.rest.PagedIterable; +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 azure backup recoveryPoint resource list. + */ + PagedIterable getList( + 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 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 azure backup recoveryPoint resource list. + */ + PagedIterable getList( + String vaultName, String resourceGroupName, String backupInstanceName, 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 000000000000..633d5d32e529 --- /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 000000000000..7091edbaca73 --- /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/ResourceProviders.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceProviders.java new file mode 100644 index 000000000000..1048cb39c2d5 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/ResourceProviders.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.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Gets the operation status for a resource. + * + * @param 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 getOperationStatus(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 getOperationStatusWithResponse(String location, String operationId, 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup Vault Resource. + */ + BackupVaultResource getOperationResultPatch(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 backup Vault Resource. + */ + Response getOperationResultPatchWithResponse( + String vaultName, String resourceGroupName, String operationId, 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 com.azure.core.management.exception.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/RestoreFilesTargetInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreFilesTargetInfo.java new file mode 100644 index 000000000000..a32de43d64f3 --- /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 000000000000..991160496ca5 --- /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/RestoreTargetInfo.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfo.java new file mode 100644 index 000000000000..8c8f753f773e --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfo.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.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); + + /* + * Information of target DS + */ + @JsonProperty(value = "datasourceInfo", required = true) + private Datasource datasourceInfo; + + /* + * Information of target DS Set + */ + @JsonProperty(value = "datasourceSetInfo") + private DatasourceSet datasourceSetInfo; + + /** + * Get the datasourceInfo property: Information of target DS. + * + * @return the datasourceInfo value. + */ + public Datasource datasourceInfo() { + return this.datasourceInfo; + } + + /** + * Set the datasourceInfo property: 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: Information of target DS Set. + * + * @return the datasourceSetInfo value. + */ + public DatasourceSet datasourceSetInfo() { + return this.datasourceSetInfo; + } + + /** + * Set the datasourceSetInfo property: 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; + } + + /** {@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(); + } + } +} 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 000000000000..42cee770f2ab --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/RestoreTargetInfoBase.java @@ -0,0 +1,95 @@ +// 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 = "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 000000000000..affd319d2850 --- /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 000000000000..6b596fe18405 --- /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; + +/** 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 000000000000..71dbfa023ebc --- /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; + +/** 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 000000000000..2d53685f875e --- /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; + +/** 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); + + /* + * 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: Schedule for this backup. + * + * @return the schedule value. + */ + public BackupSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: 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/SourceDataStoreType.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SourceDataStoreType.java new file mode 100644 index 000000000000..5ba8eca14deb --- /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 000000000000..634cb518576c --- /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; + +/** Source LifeCycle. */ +@Fluent +public final class SourceLifeCycle { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SourceLifeCycle.class); + + /* + * Delete Option + */ + @JsonProperty(value = "deleteAfter", required = true) + private DeleteOption deleteAfter; + + /* + * DataStoreInfo base + */ + @JsonProperty(value = "sourceDataStore", required = true) + private DataStoreInfoBase sourceDataStore; + + /* + * The targetDataStoreCopySettings property. + */ + @JsonProperty(value = "targetDataStoreCopySettings") + private List targetDataStoreCopySettings; + + /** + * Get the deleteAfter property: Delete Option. + * + * @return the deleteAfter value. + */ + public DeleteOption deleteAfter() { + return this.deleteAfter; + } + + /** + * Set the deleteAfter property: 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: DataStoreInfo base. + * + * @return the sourceDataStore value. + */ + public DataStoreInfoBase sourceDataStore() { + return this.sourceDataStore; + } + + /** + * Set the sourceDataStore property: 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 000000000000..cd7098c374c5 --- /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 000000000000..4ff97d15c78c --- /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; + +/** 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 000000000000..a7cd5aee9f86 --- /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 000000000000..6cbaa020b612 --- /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 000000000000..4b089c23756b --- /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/SystemData.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SystemData.java new file mode 100644 index 000000000000..59e9a883fe44 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/SystemData.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +/** Metadata pertaining to creation and last modification of the resource. */ +@Fluent +public final class SystemData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); + + /* + * The identity that created the resource. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /* + * The type of identity that created the resource. + */ + @JsonProperty(value = "createdByType") + private CreatedByType createdByType; + + /* + * The timestamp of resource creation (UTC). + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedBy") + private String lastModifiedBy; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedByType") + private CreatedByType lastModifiedByType; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedAt") + private OffsetDateTime lastModifiedAt; + + /** + * Get the createdBy property: The identity that created the resource. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The identity that created the resource. + * + * @param createdBy the createdBy value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the createdByType property: The type of identity that created the resource. + * + * @return the createdByType value. + */ + public CreatedByType createdByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: The type of identity that created the resource. + * + * @param createdByType the createdByType value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedByType(CreatedByType createdByType) { + this.createdByType = createdByType; + return this; + } + + /** + * Get the createdAt property: The timestamp of resource creation (UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The timestamp of resource creation (UTC). + * + * @param createdAt the createdAt value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the lastModifiedBy property: The identity that last modified the resource. + * + * @return the lastModifiedBy value. + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: The identity that last modified the resource. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Get the lastModifiedByType property: The type of identity that last modified the resource. + * + * @return the lastModifiedByType value. + */ + public CreatedByType lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the lastModifiedByType property: The type of identity that last modified the resource. + * + * @param lastModifiedByType the lastModifiedByType value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + return this; + } + + /** + * Get the lastModifiedAt property: The type of identity that last modified the resource. + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The type of identity that last modified the resource. + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/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 000000000000..4394fbfaee41 --- /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; + +/** 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; + + /* + * 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: Retention tag information. + * + * @return the tagInfo value. + */ + public RetentionTag tagInfo() { + return this.tagInfo; + } + + /** + * Set the tagInfo property: 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 000000000000..27e591c4a31a --- /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; + +/** Target copy settings. */ +@Fluent +public final class TargetCopySetting { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetCopySetting.class); + + /* + * It can be CustomCopyOption or ImmediateCopyOption. + */ + @JsonProperty(value = "copyAfter", required = true) + private CopyOption copyAfter; + + /* + * Info of target datastore + */ + @JsonProperty(value = "dataStore", required = true) + private DataStoreInfoBase dataStore; + + /** + * Get the copyAfter property: It can be CustomCopyOption or ImmediateCopyOption. + * + * @return the copyAfter value. + */ + public CopyOption copyAfter() { + return this.copyAfter; + } + + /** + * Set the copyAfter property: 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: Info of target datastore. + * + * @return the dataStore value. + */ + public DataStoreInfoBase dataStore() { + return this.dataStore; + } + + /** + * Set the dataStore property: 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 000000000000..8c005dcb0806 --- /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 000000000000..410161aa0906 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/TriggerBackupRequest.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; + +/** Trigger backup request. */ +@Fluent +public final class TriggerBackupRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TriggerBackupRequest.class); + + /* + * 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: 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: 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 000000000000..cb6219641cf5 --- /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; + +/** 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 000000000000..0a7e19f6a751 --- /dev/null +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/models/UserFacingError.java @@ -0,0 +1,239 @@ +// 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; + +/** 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; + + /* + * 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; + + /* + * 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: Inner Error. + * + * @return the innerError value. + */ + public InnerError innerError() { + return this.innerError; + } + + /** + * Set the innerError property: 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 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 000000000000..6b437ccc5e6d --- /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; + +/** 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 000000000000..b5be94dd9da7 --- /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; + +/** Validate restore request object. */ +@Fluent +public final class ValidateRestoreRequestObject { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ValidateRestoreRequestObject.class); + + /* + * Gets or sets the restore request object. + */ + @JsonProperty(value = "restoreRequestObject", required = true) + private AzureBackupRestoreRequest restoreRequestObject; + + /** + * Get the restoreRequestObject property: Gets or sets the restore request object. + * + * @return the restoreRequestObject value. + */ + public AzureBackupRestoreRequest restoreRequestObject() { + return this.restoreRequestObject; + } + + /** + * Set the restoreRequestObject property: 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 000000000000..dbb3ec225635 --- /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 000000000000..ba817d86188e --- /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 000000000000..c90a2b2bfd24 --- /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 000000000000..97dbdf7bf57c --- /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 000000000000..1e45f85a670e --- /dev/null +++ b/sdk/dataprotection/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ + +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 000000000000..dda2ad0351a5 --- /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 + + + +