Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
827 changes: 823 additions & 4 deletions sdk/dataprotection/azure-resourcemanager-dataprotection/CHANGELOG.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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-2023-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for DataProtection Management SDK. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2024-04. 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

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-dataprotection</artifactId>
<version>1.2.0</version>
<version>1.3.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen

### Authentication

By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables.
Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package.

- `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.
Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

With above configuration, `azure` client can be authenticated using the following code:
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
Expand Down Expand Up @@ -132,6 +128,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
Expand Down
1,222 changes: 1,029 additions & 193 deletions sdk/dataprotection/azure-resourcemanager-dataprotection/SAMPLE.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for DataProtection Management</name>
<description>This package contains Microsoft Azure SDK for DataProtection Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2023-11.</description>
<description>This package contains Microsoft Azure SDK for DataProtection Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2024-04.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down Expand Up @@ -48,6 +48,11 @@
<revapi.skip>true</revapi.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
Expand Down Expand Up @@ -88,8 +93,6 @@
<version>4.11.0</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>
<!-- bytebuddy dependencies are required for mockito 4.11.0 to work with Java 21. Mockito 4.11.0 is the last release -->
<!-- of Mockito supporting Java 8 as a baseline. -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
Expand All @@ -24,6 +24,7 @@
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.BackupInstancesExtensionRoutingsImpl;
import com.azure.resourcemanager.dataprotection.implementation.BackupInstancesImpl;
import com.azure.resourcemanager.dataprotection.implementation.BackupPoliciesImpl;
import com.azure.resourcemanager.dataprotection.implementation.BackupVaultOperationResultsImpl;
Expand All @@ -47,6 +48,7 @@
import com.azure.resourcemanager.dataprotection.implementation.ResourceGuardsImpl;
import com.azure.resourcemanager.dataprotection.implementation.RestorableTimeRangesImpl;
import com.azure.resourcemanager.dataprotection.models.BackupInstances;
import com.azure.resourcemanager.dataprotection.models.BackupInstancesExtensionRoutings;
import com.azure.resourcemanager.dataprotection.models.BackupPolicies;
import com.azure.resourcemanager.dataprotection.models.BackupVaultOperationResults;
import com.azure.resourcemanager.dataprotection.models.BackupVaults;
Expand Down Expand Up @@ -107,6 +109,8 @@ public final class DataProtectionManager {

private FetchCrossRegionRestoreJobsOperations fetchCrossRegionRestoreJobsOperations;

private BackupInstancesExtensionRoutings backupInstancesExtensionRoutings;

private Jobs jobs;

private RestorableTimeRanges restorableTimeRanges;
Expand All @@ -127,8 +131,10 @@ private DataProtectionManager(HttpPipeline httpPipeline, AzureProfile profile, D
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();
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}

/**
Expand Down Expand Up @@ -279,12 +285,19 @@ public DataProtectionManager authenticate(TokenCredential credential, AzureProfi
Objects.requireNonNull(profile, "'profile' cannot be null.");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.dataprotection")
.append("/").append("1.2.0");
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)");
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)");
}
Expand All @@ -303,18 +316,21 @@ public DataProtectionManager authenticate(TokenCredential credential, AzureProfi
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList()));
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient)
.policies(policies.toArray(new HttpPipelinePolicy[0])).build();
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.build();
return new DataProtectionManager(httpPipeline, profile, defaultPollInterval);
}
}
Expand Down Expand Up @@ -494,6 +510,19 @@ public FetchCrossRegionRestoreJobsOperations fetchCrossRegionRestoreJobsOperatio
return fetchCrossRegionRestoreJobsOperations;
}

/**
* Gets the resource collection API of BackupInstancesExtensionRoutings.
*
* @return Resource collection API of BackupInstancesExtensionRoutings.
*/
public BackupInstancesExtensionRoutings backupInstancesExtensionRoutings() {
if (this.backupInstancesExtensionRoutings == null) {
this.backupInstancesExtensionRoutings
= new BackupInstancesExtensionRoutingsImpl(clientObject.getBackupInstancesExtensionRoutings(), this);
}
return backupInstancesExtensionRoutings;
}

/**
* Gets the resource collection API of Jobs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import com.azure.resourcemanager.dataprotection.models.AzureBackupRehydrationRequest;
import com.azure.resourcemanager.dataprotection.models.AzureBackupRestoreRequest;
import com.azure.resourcemanager.dataprotection.models.CrossRegionRestoreRequestObject;
import com.azure.resourcemanager.dataprotection.models.StopProtectionRequest;
import com.azure.resourcemanager.dataprotection.models.SuspendBackupRequest;
import com.azure.resourcemanager.dataprotection.models.SyncBackupInstanceRequest;
import com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest;
import com.azure.resourcemanager.dataprotection.models.ValidateCrossRegionRestoreRequestObject;
Expand Down Expand Up @@ -764,6 +766,7 @@ SyncPoller<PollResult<Void>, Void> beginStopProtection(String resourceGroupName,
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param vaultName The name of the backup vault.
* @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.
Expand All @@ -772,7 +775,7 @@ SyncPoller<PollResult<Void>, Void> beginStopProtection(String resourceGroupName,
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<Void>, Void> beginStopProtection(String resourceGroupName, String vaultName,
String backupInstanceName, Context context);
String backupInstanceName, StopProtectionRequest parameters, Context context);

/**
* This operation will stop protection of a backup instance and data will be held forever.
Expand All @@ -793,13 +796,15 @@ SyncPoller<PollResult<Void>, Void> beginStopProtection(String resourceGroupName,
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param vaultName The name of the backup vault.
* @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 stopProtection(String resourceGroupName, String vaultName, String backupInstanceName, Context context);
void stopProtection(String resourceGroupName, String vaultName, String backupInstanceName,
StopProtectionRequest parameters, Context context);

/**
* This operation will stop backup for a backup instance and retains the backup data as per the policy (except
Expand All @@ -824,6 +829,7 @@ SyncPoller<PollResult<Void>, Void> beginSuspendBackups(String resourceGroupName,
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param vaultName The name of the backup vault.
* @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.
Expand All @@ -832,7 +838,7 @@ SyncPoller<PollResult<Void>, Void> beginSuspendBackups(String resourceGroupName,
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<Void>, Void> beginSuspendBackups(String resourceGroupName, String vaultName,
String backupInstanceName, Context context);
String backupInstanceName, SuspendBackupRequest parameters, Context context);

/**
* This operation will stop backup for a backup instance and retains the backup data as per the policy (except
Expand All @@ -855,13 +861,15 @@ SyncPoller<PollResult<Void>, Void> beginSuspendBackups(String resourceGroupName,
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param vaultName The name of the backup vault.
* @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 suspendBackups(String resourceGroupName, String vaultName, String backupInstanceName, Context context);
void suspendBackups(String resourceGroupName, String vaultName, String backupInstanceName,
SuspendBackupRequest parameters, Context context);

/**
* Sync backup instance again in case of failure
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.dataprotection.fluent;

import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.util.Context;
import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner;

/**
* An instance of this class provides access to all the operations defined in BackupInstancesExtensionRoutingsClient.
*/
public interface BackupInstancesExtensionRoutingsClient {
/**
* Gets a list of backup instances associated with a tracked resource.
*
* @param resourceId ARM path of the resource to be protected using Microsoft.DataProtection.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.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 list of backup instances associated with a tracked resource as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<BackupInstanceResourceInner> list(String resourceId);

/**
* Gets a list of backup instances associated with a tracked resource.
*
* @param resourceId ARM path of the resource to be protected using Microsoft.DataProtection.
* @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 list of backup instances associated with a tracked resource as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<BackupInstanceResourceInner> list(String resourceId, Context context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ public interface DataProtectionClient {
*/
FetchCrossRegionRestoreJobsOperationsClient getFetchCrossRegionRestoreJobsOperations();

/**
* Gets the BackupInstancesExtensionRoutingsClient object to access its operations.
*
* @return the BackupInstancesExtensionRoutingsClient object.
*/
BackupInstancesExtensionRoutingsClient getBackupInstancesExtensionRoutings();

/**
* Gets the JobsClient object to access its operations.
*
Expand Down
Loading