Skip to content

Commit c4905e7

Browse files
authored
Added code snippets for Key Vault Administration clients and builders. (Azure#22341)
* Added classes containing code snippets for AccessControl and Backup clients. * Added code snippets to clients and client builders. * Updated KV Administration README and added embedded samples. * Updated embedme paths in README. * Removed localization in link. * Fixed JavaDoc line length issue. * Fixed CheckStyle issue.
1 parent 4f09a8b commit c4905e7

File tree

12 files changed

+1824
-331
lines changed

12 files changed

+1824
-331
lines changed

sdk/keyvault/azure-security-keyvault-administration/README.md

Lines changed: 261 additions & 159 deletions
Large diffs are not rendered by default.

sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClient.java

Lines changed: 167 additions & 78 deletions
Large diffs are not rendered by default.

sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClient.java

Lines changed: 171 additions & 72 deletions
Large diffs are not rendered by default.

sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,13 @@
4242
* <p> The minimal configuration options required by {@link KeyVaultAccessControlClientBuilder} to build an
4343
* an {@link KeyVaultAccessControlAsyncClient} are {@link String vaultUrl} and {@link TokenCredential credential}.</p>
4444
*
45-
* <p>The {@link HttpLogDetailLevel}, multiple custom {@link HttpLoggingPolicy policies} and custom
46-
* {@link HttpClient} can be optionally configured in the {@link KeyVaultAccessControlClientBuilder}.</p>
45+
* <p><strong>Samples to construct a sync client</strong></p>
46+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultAccessControlClient.instantiation}
47+
* <p><strong>Samples to construct an async client</strong></p>
48+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultAccessControlAsyncClient.instantiation}
4749
*
48-
* <p>Alternatively, a custom {@link HttpPipeline} with custom {@link HttpPipelinePolicy} policies and {@link String
49-
* vaultUrl} can be specified. It provides finer control over the construction of
50-
* {@link KeyVaultAccessControlAsyncClient} and {@link KeyVaultAccessControlClient} instances.</p>
51-
*
52-
* <p> The minimal configuration options required by {@link KeyVaultAccessControlClientBuilder} to build an
53-
* {@link KeyVaultAccessControlClient} are {@link String vaultUrl} and {@link TokenCredential credential}. </p>
54-
*
55-
* @see KeyVaultAccessControlAsyncClient
5650
* @see KeyVaultAccessControlClient
51+
* @see KeyVaultAccessControlAsyncClient
5752
*/
5853
@ServiceClientBuilder(serviceClients = {KeyVaultAccessControlClient.class, KeyVaultAccessControlAsyncClient.class})
5954
public final class KeyVaultAccessControlClientBuilder {

sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
/**
5353
* The {@link KeyVaultBackupAsyncClient} provides asynchronous methods to perform full backup and restore of an Azure
5454
* Key Vault.
55+
*
56+
* <p>Instances of this client are obtained by calling the {@link KeyVaultBackupClientBuilder#buildAsyncClient()}
57+
* method on a {@link KeyVaultBackupClientBuilder} object.</p>
58+
*
59+
* <p><strong>Samples to construct an async client</strong></p>
60+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupAsyncClient.instantiation}
61+
*
62+
* @see KeyVaultBackupClientBuilder
5563
*/
5664
@ServiceClient(builder = KeyVaultBackupClientBuilder.class, isAsync = true)
5765
public final class KeyVaultBackupAsyncClient {
@@ -129,6 +137,12 @@ HttpPipeline getHttpPipeline() {
129137
/**
130138
* Initiates a full backup of the Key Vault.
131139
*
140+
* <p><strong>Code Samples</strong></p>
141+
* <p>Starts a {@link KeyVaultBackupOperation backup operation}, polls for its status and waits for it to complete.
142+
* Prints out the details of the operation's final result in case of success or prints out details of an error in
143+
* case the operation fails.</p>
144+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupAsyncClient.beginBackup#String-String}
145+
*
132146
* @param blobStorageUrl The URL for the Blob Storage resource where the backup will be located.
133147
* @param sasToken A Shared Access Signature (SAS) token to authorize access to the blob.
134148
*
@@ -286,6 +300,11 @@ private static LongRunningOperationStatus toLongRunningOperationStatus(String op
286300
/**
287301
* Initiates a full restore of the Key Vault.
288302
*
303+
* <p><strong>Code Samples</strong></p>
304+
* <p>Starts a {@link KeyVaultRestoreOperation restore operation}, polls for its status and waits for it to
305+
* complete. Prints out error details in case the operation fails.</p>
306+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupAsyncClient.beginRestore#String-String}
307+
*
289308
* @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to
290309
* the blob container where the backup resides. This would be the exact value that is returned as the result of a
291310
* backup operation. An example of such a URL may look like the following:
@@ -427,6 +446,11 @@ private static Mono<PollResponse<KeyVaultRestoreOperation>> processRestoreOperat
427446
* Restores all versions of a given key using the supplied SAS token pointing to a previously stored Azure Blob
428447
* storage backup folder.
429448
*
449+
* <p><strong>Code Samples</strong></p>
450+
* <p>Starts a {@link KeyVaultSelectiveKeyRestoreOperation selective key restore operation}, polls for its status
451+
* and waits for it to complete. Prints out error details in case the operation fails.</p>
452+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupAsyncClient.beginSelectiveKeyRestore#String-String-String}
453+
*
430454
* @param keyName The name of the key to be restored.
431455
* @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to
432456
* the blob container where the backup resides. This would be the exact value that is returned as the result of a

sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClient.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@
1515
import com.azure.security.keyvault.administration.models.KeyVaultSelectiveKeyRestoreResult;
1616

1717
/**
18-
* The {@link KeyVaultBackupClient} provides synchronous methods to perform full backup and restore of an Azure Key
19-
* Vault.
18+
* The {@link KeyVaultBackupClient} provides synchronous methods to perform backup and restore operations of an Azure
19+
* Key Vault.
20+
*
21+
* <p>Instances of this client are obtained by calling the {@link KeyVaultBackupClientBuilder#buildClient()}
22+
* method on a {@link KeyVaultBackupClientBuilder} object.</p>
23+
*
24+
* <p><strong>Samples to construct a sync client</strong></p>
25+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupClient.instantiation}
26+
*
27+
* @see KeyVaultBackupClientBuilder
2028
*/
2129
@ServiceClient(builder = KeyVaultBackupClientBuilder.class)
2230
public final class KeyVaultBackupClient {
@@ -43,6 +51,12 @@ public String getVaultUrl() {
4351
/**
4452
* Initiates a full backup of the Key Vault.
4553
*
54+
* <p><strong>Code Samples</strong></p>
55+
* <p>Starts a {@link KeyVaultBackupOperation backup operation}, polls for its status and waits for it to complete.
56+
* Prints out the details of the operation's final result in case of success or prints out error details in case the
57+
* operation fails.</p>
58+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupClient.beginBackup#String-String}
59+
*
4660
* @param blobStorageUrl The URL for the Blob Storage resource where the backup will be located.
4761
* @param sasToken A Shared Access Signature (SAS) token to authorize access to the blob.
4862
*
@@ -59,6 +73,11 @@ public SyncPoller<KeyVaultBackupOperation, String> beginBackup(String blobStorag
5973
/**
6074
* Initiates a full restore of the Key Vault.
6175
*
76+
* <p><strong>Code Samples</strong></p>
77+
* <p>Starts a {@link KeyVaultRestoreOperation restore operation}, polls for its status and waits for it to
78+
* complete. Prints out error details in case the operation fails.</p>
79+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupClient.beginBackup#String-String}
80+
*
6281
* @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to
6382
* the blob container where the backup resides. This would be the exact value that is returned as the result of a
6483
* backup operation. An example of such a URL may look like the following:
@@ -79,6 +98,11 @@ public SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> beginRestore(
7998
* Restores all versions of a given key using the supplied SAS token pointing to a previously stored Azure Blob
8099
* storage backup folder.
81100
*
101+
* <p><strong>Code Samples</strong></p>
102+
* <p>Starts a {@link KeyVaultSelectiveKeyRestoreOperation selective key restore operation}, polls for its status
103+
* and waits for it to complete. Prints out error details in case the operation fails.</p>
104+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupClient.beginSelectiveKeyRestore#String-String-String}
105+
*
82106
* @param keyName The name of the key to be restored.
83107
* @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to
84108
* the blob container where the backup resides. This would be the exact value that is returned as the result of a

sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,13 @@
4141
* <p> The minimal configuration options required by {@link KeyVaultBackupClientBuilder} to build an
4242
* an {@link KeyVaultBackupAsyncClient} are {@link String vaultUrl} and {@link TokenCredential credential}.</p>
4343
*
44-
* <p>The {@link HttpLogDetailLevel}, multiple custom {@link HttpLoggingPolicy policies} and custom
45-
* {@link HttpClient} can be optionally configured in the {@link KeyVaultBackupClientBuilder}.</p>
44+
* <p><strong>Samples to construct a sync client</strong></p>
45+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupClient.instantiation}
46+
* <p><strong>Samples to construct an async client</strong></p>
47+
* {@codesnippet com.azure.security.keyvault.administration.keyVaultBackupAsyncClient.instantiation}
4648
*
47-
* <p>Alternatively, a custom {@link HttpPipeline} with custom {@link HttpPipelinePolicy} policies and {@link String
48-
* vaultUrl} can be specified. It provides finer control over the construction of {@link KeyVaultBackupAsyncClient}
49-
* and {@link KeyVaultBackupClient} instances.</p>
50-
*
51-
* <p> The minimal configuration options required by {@link KeyVaultBackupClientBuilder} to build an
52-
* {@link KeyVaultBackupClient} are {@link String vaultUrl} and {@link TokenCredential credential}. </p>
53-
*
54-
* @see KeyVaultBackupAsyncClient
5549
* @see KeyVaultBackupClient
50+
* @see KeyVaultBackupAsyncClient
5651
*/
5752
@ServiceClientBuilder(serviceClients = {KeyVaultBackupClient.class, KeyVaultBackupAsyncClient.class})
5853
public final class KeyVaultBackupClientBuilder {

0 commit comments

Comments
 (0)