Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
540a16d
Initial changes
aayush3011 Apr 24, 2024
6f49c75
Initial changes
aayush3011 Apr 25, 2024
97509eb
Merge branch 'main' into users/akataria/nonStreamingOrderBy
aayush3011 Apr 25, 2024
938279a
Increment versions for core releases (#40003)
azure-sdk May 2, 2024
c6c520e
Ensure ServiceBus session idle timeout fall back to retry-options::tr…
anuchandy May 2, 2024
222f2d9
Added Alpha3 Java Media Streaming Events (#40002)
v-durgeshs May 2, 2024
387170a
Update version of github-event-processor to 1.0.0-dev.20240502.2 (#40…
azure-sdk May 2, 2024
b1e8fdc
Prepare May 2024 Identity Release (#40006)
billwert May 2, 2024
c3c4648
Prepare Identity Broker May 2024 Release (#40014)
billwert May 2, 2024
a5127c6
Increment package versions for identity releases (#40015)
azure-sdk May 2, 2024
ba334df
[JobRouter] SDK Review updates (#40011)
williamzhao87 May 2, 2024
5682de3
FixFaultInjectionRuleFailedToApplyPerPartitionInGatewayMode (#40005)
xinlian12 May 3, 2024
39cb79f
azure-cosmos-test_1.0.0.beta.7Release (#40021)
xinlian12 May 3, 2024
86b36d3
Merge branch 'main' into users/akataria/nonStreamingOrderBy
aayush3011 May 3, 2024
9a38357
Fixed existsById API in ReactiveCosmosTemplate (#40022)
kushagraThapar May 3, 2024
a979c11
Initial changes
aayush3011 May 3, 2024
e2756a5
Initial changes
aayush3011 May 3, 2024
d768057
Skip Recorded test and delete Event record until test proxy to work w…
minwoolee-msft May 3, 2024
71b1905
Fix invalid CODEOWNERS (#40032)
alzimmermsft May 3, 2024
8be2277
Initial changes
aayush3011 May 3, 2024
28a2b5a
ServiceBus: fix session tracing (#39962)
May 3, 2024
deff567
[Automation] Generate SDK based on TypeSpec 0.15.15 (#40048)
azure-sdk May 6, 2024
058f8a8
[CODEOWNERS] Updates for org changes (#40049)
jsquire May 6, 2024
9406783
Move from using the docker image to java2docfx for docs validation (#…
JimSuplizio May 6, 2024
6dee85b
owners (#39686)
harsimar May 6, 2024
61b177c
Use ClientLogger in testing output (#40010)
alzimmermsft May 6, 2024
8349880
Fix null pointer exception and context usage (#40053)
alzimmermsft May 6, 2024
c75b369
Rename AML to AzureMachineLearning (#40056)
alzimmermsft May 6, 2024
af7f403
Fixed the Key Vault `test-resources.json` file to properly configure …
vcolin7 May 6, 2024
c9da24c
Close response body in bearer policy (#40052)
May 6, 2024
7055e66
Running Prepare-Release for azure-messaging-servicebus 7.17.0 (#40058)
anuchandy May 7, 2024
4428897
mgmt, TypeSpec code generation pipeline (#39963)
XiaofeiCao May 7, 2024
a755e6a
Add codeowner linter owners (#39997)
weshaggard May 7, 2024
23b7d1e
Update to ESRP task version that supports federated auth (#40059)
hallipr May 7, 2024
94bd0d4
Increment package versions for cosmos releases (#40031)
azure-sdk May 7, 2024
149bd61
Update azure-sdk-build-tools Repository Resource Refs in Yaml files (…
azure-sdk May 7, 2024
847a8ae
Add reduced embeddings sample to azure-search-documents (#40069)
alzimmermsft May 7, 2024
376955f
Search May Preview Regen Updates (#40057)
jairmyree May 7, 2024
f01f7f4
Preparing Search May 2024 Beta Release (#40071)
jairmyree May 7, 2024
e491b9d
Resolving comments
aayush3011 May 7, 2024
151bb50
Fixing build issues
aayush3011 May 7, 2024
c86b87e
eng, update autorest.java, improve error output in sdk automation (#4…
weidongxu-microsoft May 8, 2024
a3d2d26
Merge to main after spring cloud azure 4.18.0 released (#40075)
Netyyyy May 8, 2024
f6909fb
Miscellaneous Core performance improvements (#39552)
alzimmermsft May 8, 2024
73afd5b
Merge branch 'Azure:main' into users/akataria/nonStreamingOrderBy
aayush3011 May 8, 2024
3271984
Increment package versions for search releases (#40072)
azure-sdk May 9, 2024
0e921d2
Update io.fabric8:kubernetes-client (#40086)
jairmyree May 9, 2024
b2a4bef
Increment package versions for servicebus releases (#40094)
azure-sdk May 9, 2024
6884420
Emit stable auto-instrumented otel metrics (#39960)
heyams May 9, 2024
3b0d751
Merge branch 'Azure:main' into users/akataria/nonStreamingOrderBy
aayush3011 May 9, 2024
87572f7
Merge branch 'feature/vector_search' into users/akataria/nonStreaming…
aayush3011 May 9, 2024
92a1a90
[Key Vault] Added support for `/prerestore` and `/prebackup` endpoint…
vcolin7 May 9, 2024
179f904
Initial changes
aayush3011 May 9, 2024
5602e33
Merge branch 'users/akataria/nonStreamingOrderBy' of github.com:aayus…
aayush3011 May 9, 2024
36ab9b7
Merge branch 'feature/vector_search' into users/akataria/nonStreaming…
aayush3011 May 9, 2024
0b29ce1
Prepare to release beta.22 (#40097)
heyams May 9, 2024
28217eb
Fix template name (#40099)
JimSuplizio May 9, 2024
a8fcba9
Update partner release to use WIF (#40101)
weshaggard May 9, 2024
0db1017
core mgmt, `SubResource` implements `JsonSerializable` to support azu…
XiaofeiCao May 10, 2024
2fae403
Update spring-reference and sync changelog (#40105)
Netyyyy May 10, 2024
47b1085
Support per-call response timeout in all HttpClient implementations (…
alzimmermsft May 10, 2024
e7deb7b
Change how JavaType is resolved to support JsonSerializable better (#…
alzimmermsft May 10, 2024
70639b5
Initial changes
aayush3011 May 10, 2024
c45c3a5
Fixes
aayush3011 May 10, 2024
6c255ee
Merge branch 'Azure:main' into users/akataria/nonStreamingOrderBy
aayush3011 May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Key Vault] Added support for /prerestore and /prebackup endpoint…
…s in Backup clients (#39878)

* Updated `autorest.md` files in all swagger folders.

* Re-generated implementation code.

* Updated ServiceVersion expandable enums.

* Added public APIs for the new /prebacukp and /prerestore endpoints.

* Added tests.

* Refactored Backup client tests.

* Updated tests.

* Updated test recordings.

* Updated documentation and samples.

* Addressed PR feedback.
  • Loading branch information
vcolin7 authored May 9, 2024
commit 92a1a90a8562ab4f4476aefa78ccce81922267f0
126 changes: 109 additions & 17 deletions sdk/keyvault/azure-security-keyvault-administration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ The Key Vault Backup Client provides both synchronous and asynchronous operation

> NOTE: The backing store for key backups is a blob storage container using Shared Access Signature authentication. For more details on creating a SAS token using the `BlobServiceClient`, see the [Azure Storage Blobs client README][storage_readme_sas_token]. Alternatively, it is possible to [generate a SAS token in Storage Explorer][portal_sas_token].

### Pre-Backup Operation
A pre-backup operation represents a long-running operation that checks if it is possible to perform a full key backup.

### Backup Operation
A backup operation represents a long-running operation for a full key backup.

### Pre-Restore Operation
A pre-restore operation represents a long-running operation that checks if it is possible to perform a full key restore from a backup.

### Restore Operation
A restore operation represents a long-running operation for both a full key and selective key restore.

Expand Down Expand Up @@ -340,20 +346,47 @@ keyVaultAccessControlAsyncClient.deleteRoleAssignment(KeyVaultRoleScope.GLOBAL,
### Examples
#### Sync API
The following sections provide several code snippets covering some of the most common Azure Key Vault Backup client tasks, including:
- [Pre-backup check for a Key Vault](#run-pre-backup-check-for-a-collection-of-keys)
- [Backup a Key Vault](#backup-a-collection-of-keys)
- [Pre-restore check for a Key Vault](#run-pre-restore-check-for-a-collection-of-keys)
- [Restore a Key Vault](#restore-a-collection-of-keys)
- [Restore a key](#selectively-restore-a-key)

##### Run pre-backup check for a collection of keys
Check if an entire collection of keys can be backed up by using `beginPreBackup()`.

```java readme-sample-beginPreBackup
String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
String sasToken = "<sas-token>";

SyncPoller<KeyVaultBackupOperation, String> preBackupPoller =
keyVaultBackupClient.beginPreBackup(blobStorageUrl, sasToken);
PollResponse<KeyVaultBackupOperation> pollResponse = preBackupPoller.poll();

System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());

PollResponse<KeyVaultBackupOperation> finalPollResponse = preBackupPoller.waitForCompletion();

if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
String folderUrl = preBackupPoller.getFinalResult();

System.out.printf("Pre-backup check completed successfully.%n");
} else {
KeyVaultBackupOperation operation = preBackupPoller.poll().getValue();

System.out.printf("Pre-backup check failed with error: %s.%n", operation.getError().getMessage());
}
```

##### Backup a collection of keys
Back up an entire collection of keys using `beginBackup()`.

```java readme-sample-beginBackup
String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
String sasToken = "<sas-token>";

SyncPoller<KeyVaultBackupOperation, String> backupPoller =
keyVaultBackupClient.beginBackup(blobStorageUrl, sasToken);

PollResponse<KeyVaultBackupOperation> pollResponse = backupPoller.poll();

System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
Expand All @@ -371,26 +404,49 @@ if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COM
}
```

##### Run pre-restore check for a collection of keys
Check if an entire collection of keys can be restored from a backup by using `beginPreRestore()`.

```java readme-sample-beginPreRestore
String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
String sasToken = "<sas-token>";

SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> preRestorePoller =
keyVaultBackupClient.beginPreRestore(folderUrl, sasToken);
PollResponse<KeyVaultRestoreOperation> pollResponse = preRestorePoller.poll();

System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());

PollResponse<KeyVaultRestoreOperation> finalPollResponse = preRestorePoller.waitForCompletion();

if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
System.out.printf("Pre-restore check completed successfully.%n");
} else {
KeyVaultRestoreOperation operation = preRestorePoller.poll().getValue();

System.out.printf("Pre-restore check failed with error: %s.%n", operation.getError().getMessage());
}
```

##### Restore a collection of keys
Restore an entire collection of keys from a backup using `beginRestore()`.

```java readme-sample-beginRestore
String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
String sasToken = "<sas-token>";

SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> backupPoller =
SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> restorePoller =
keyVaultBackupClient.beginRestore(folderUrl, sasToken);

PollResponse<KeyVaultRestoreOperation> pollResponse = backupPoller.poll();
PollResponse<KeyVaultRestoreOperation> pollResponse = restorePoller.poll();

System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());

PollResponse<KeyVaultRestoreOperation> finalPollResponse = backupPoller.waitForCompletion();
PollResponse<KeyVaultRestoreOperation> finalPollResponse = restorePoller.waitForCompletion();

if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
System.out.printf("Backup restored successfully.%n");
} else {
KeyVaultRestoreOperation operation = backupPoller.poll().getValue();
KeyVaultRestoreOperation operation = restorePoller.poll().getValue();

System.out.printf("Restore failed with error: %s.%n", operation.getError().getMessage());
}
Expand All @@ -401,41 +457,60 @@ Restore a specific key from a backup using `beginSelectiveRestore()`.

```java readme-sample-beginSelectiveKeyRestore
String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
String sasToken = "<sas-token>";
String keyName = "myKey";

SyncPoller<KeyVaultSelectiveKeyRestoreOperation, KeyVaultSelectiveKeyRestoreResult> backupPoller =
SyncPoller<KeyVaultSelectiveKeyRestoreOperation, KeyVaultSelectiveKeyRestoreResult> restorePoller =
keyVaultBackupClient.beginSelectiveKeyRestore(folderUrl, sasToken, keyName);

PollResponse<KeyVaultSelectiveKeyRestoreOperation> pollResponse = backupPoller.poll();
PollResponse<KeyVaultSelectiveKeyRestoreOperation> pollResponse = restorePoller.poll();

System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());

PollResponse<KeyVaultSelectiveKeyRestoreOperation> finalPollResponse = backupPoller.waitForCompletion();
PollResponse<KeyVaultSelectiveKeyRestoreOperation> finalPollResponse = restorePoller.waitForCompletion();

if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
System.out.printf("Key restored successfully.%n");
} else {
KeyVaultSelectiveKeyRestoreOperation operation = backupPoller.poll().getValue();
KeyVaultSelectiveKeyRestoreOperation operation = restorePoller.poll().getValue();

System.out.printf("Key restore failed with error: %s.%n", operation.getError().getMessage());
}
```

#### Async API
The following sections provide several code snippets covering some of the most common asynchronous Azure Key Vault Backup client tasks, including:
- [Run pre-backup check for a collection of keys asynchronously](#run-pre-backup-check-for-a-collection-of-keys-asynchronously)
- [Backup a Key Vault asynchronously](#backup-a-collection-of-keys-asynchronously)
- [Run pre-restore check for a collection of keys asynchronously](#run-pre-restore-check-for-a-collection-of-keys-asynchronously)
- [Restore a Key Vault asynchronously](#restore-a-collection-of-keys-asynchronously)
- [Restore a key asynchronously](#selectively-restore-a-key-asynchronously)

> Note : You should add `System.in.read()` or `Thread.sleep()` after the function calls in the main class/thread to allow async functions/operations to execute and finish before the main application/thread exits.

##### Run pre-backup check for a collection of keys asynchronously
Check if an entire collection of keys can be backed up by using `beginPreBackup()`.

```java readme-sample-beginPreBackupAsync
String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
String sasToken = "<sas-token>";

keyVaultBackupAsyncClient.beginPreBackup(blobStorageUrl, sasToken)
.setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
.doOnError(e -> System.out.printf("Pre-backup check failed with error: %s.%n", e.getMessage()))
.doOnNext(pollResponse ->
System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
.filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(folderUrl ->
System.out.printf("Pre-backup check completed successfully.%n"));
```

##### Backup a collection of keys asynchronously
Back up an entire collection of keys using `beginBackup()`.

```java readme-sample-beginBackupAsync
String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
String sasToken = "<sas-token>";

keyVaultBackupAsyncClient.beginBackup(blobStorageUrl, sasToken)
.setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
Expand All @@ -448,12 +523,29 @@ keyVaultBackupAsyncClient.beginBackup(blobStorageUrl, sasToken)
System.out.printf("Backup completed. The storage location of this backup is: %s.%n", folderUrl));
```

##### Run pre-restore check for a collection of keys asynchronously
Check if an entire collection of keys can be restored from a backup by using `beginPreRestore()`.

```java readme-sample-beginPreRestoreAsync
String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
String sasToken = "<sas-token>";

keyVaultBackupAsyncClient.beginPreRestore(folderUrl, sasToken)
.setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
.doOnError(e -> System.out.printf("Pre-restore check failed with error: %s.%n", e.getMessage()))
.doOnNext(pollResponse ->
System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
.filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(unused -> System.out.printf("Pre-restore check completed successfully.%n"));
```

##### Restore a collection of keys asynchronously
Restore an entire collection of keys from a backup using `beginRestore()`.

```java readme-sample-beginRestoreAsync
String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
String sasToken = "<sas-token>";

keyVaultBackupAsyncClient.beginRestore(folderUrl, sasToken)
.setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
Expand All @@ -470,7 +562,7 @@ Restore an entire collection of keys from a backup using `beginSelectiveRestore(

```java readme-sample-beginSelectiveKeyRestoreAsync
String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
String sasToken = "<sas-token>";
String keyName = "myKey";

keyVaultBackupAsyncClient.beginSelectiveKeyRestore(folderUrl, sasToken, keyName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/keyvault/azure-security-keyvault-administration",
"Tag": "java/keyvault/azure-security-keyvault-administration_95d2cbb133"
"Tag": "java/keyvault/azure-security-keyvault-administration_18fc6d4e27"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ public enum KeyVaultAdministrationServiceVersion implements ServiceVersion {
/**
* Service version {@code 7.5}.
*/
V7_5("7.5");
V7_5("7.5"),

/**
* Service version {@code 7.6-preview.1}.
*/
V7_6_PREVIEW_1("7.6-preview.1");

private final String version;

Expand All @@ -46,6 +51,6 @@ public String getVersion() {
* @return The latest {@link KeyVaultAdministrationServiceVersion}.
*/
public static KeyVaultAdministrationServiceVersion getLatest() {
return V7_5;
return V7_6_PREVIEW_1;
}
}
Loading