Skip to content

Commit 3106c8a

Browse files
authored
Removed the exportKey operation from KeyAsyncClient and KeyClient. (Azure#21010)
* Removed the exportKey operation from KeyAsyncClient and KeyClient. * Removed code snippets for the exportKey operation. * Removed unused import from KeyAsyncClientJavaDocCodeSnippets. * Updated CHANGELOG.
1 parent 526fdf2 commit 3106c8a

File tree

6 files changed

+12
-227
lines changed

6 files changed

+12
-227
lines changed

sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Release History
22

3-
## 4.3.0-beta.7 (Unreleased)
3+
## 4.3.0-beta.7 (2021-04-29)
44

5+
### Bug fixes
6+
- Fixed issue that prevented setting tags on keys when creating or importing them.
7+
8+
### Breaking Changes
9+
- Removed the `exportKey()` operation from `KeyAsyncClient` and `KeyClient`, as it is not yet supported in the current service version.
510

611
## 4.3.0-beta.6 (2021-04-09)
712

@@ -29,6 +34,12 @@
2934
- `KeyEncryptionKeyClientBuilder.buildAsyncKeyEncryptionKey(JsonWebKey)`
3035
- `CryptograhpyClientBuilder.keyIdentifier(String)` now throws a `NullPointerException` if a `null` value is provided as an argument.
3136

37+
### Dependency Updates
38+
- Upgraded `azure-core` dependency to `1.15.0`
39+
- Upgraded `azure-core-http-netty` dependency to `1.9.1`
40+
- Upgraded `azure-core-http-okhttp` dependency to `1.6.1`
41+
- Upgraded `azure-identity` dependency to `1.2.5`
42+
3243
## 4.3.0-beta.5 (2021-03-12)
3344

3445
### Breaking Changes

sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -519,99 +519,6 @@ Mono<Response<KeyVaultKey>> importKeyWithResponse(ImportKeyOptions importKeyOpti
519519
.doOnError(error -> logger.warning("Failed to import key - {}", importKeyOptions.getName(), error));
520520
}
521521

522-
/**
523-
* Exports the latest version of a key from the key vault. The export key operation may be used to import any key
524-
* from the Azure Key Vault as long as it is marked as exportable and its release policy is satisfied.
525-
*
526-
* <p><strong>Code Samples</strong></p>
527-
* <p>Exports a key from a key vault. Subscribes to the call asynchronously and prints out the newly exported key
528-
* details when a response has been received.</p>
529-
*
530-
* {@codesnippet com.azure.security.keyvault.keys.keyasyncclient.exportKey#String-String}
531-
*
532-
* @param name The name of the key to be exported.
533-
* @param environment The target environment assertion.
534-
* @return A {@link Mono} containing the {@link KeyVaultKey exported key}.
535-
* @throws NullPointerException If the specified {@code name} or {@code environment} are {@code null}.
536-
*/
537-
@ServiceMethod(returns = ReturnType.SINGLE)
538-
public Mono<KeyVaultKey> exportKey(String name, String environment) {
539-
try {
540-
return exportKeyWithResponse(name, "", environment).flatMap(FluxUtil::toMono);
541-
} catch (RuntimeException ex) {
542-
return monoError(logger, ex);
543-
}
544-
}
545-
546-
/**
547-
* Exports a key from the key vault. The export key operation may be used to import any key from the Azure Key Vault
548-
* as long as it is marked as exportable and its release policy is satisfied.
549-
*
550-
* <p><strong>Code Samples</strong></p>
551-
* <p>Exports a key from a key vault. Subscribes to the call asynchronously and prints out the newly exported key
552-
* details when a response has been received.</p>
553-
*
554-
* {@codesnippet com.azure.security.keyvault.keys.keyasyncclient.exportKey#String-String-String}
555-
*
556-
* @param name The name of the key to be exported.
557-
* @param version The key version.
558-
* @param environment The target environment assertion.
559-
* @return A {@link Mono} containing the {@link KeyVaultKey exported key}.
560-
* @throws NullPointerException If the specified {@code name}, {@code version} or {@code environment} are
561-
* {@code null}.
562-
*/
563-
@ServiceMethod(returns = ReturnType.SINGLE)
564-
public Mono<KeyVaultKey> exportKey(String name, String version, String environment) {
565-
try {
566-
return exportKeyWithResponse(name, version, environment).flatMap(FluxUtil::toMono);
567-
} catch (RuntimeException ex) {
568-
return monoError(logger, ex);
569-
}
570-
}
571-
572-
/**
573-
* Exports a key from the key vault. The export key operation may be used to import any key from the Azure Key Vault
574-
* as long as it is marked as exportable and its release policy is satisfied.
575-
*
576-
* <p><strong>Code Samples</strong></p>
577-
* <p>Exports a key from a key vault. Subscribes to the call asynchronously and prints out the newly exported key
578-
* details when a response has been received.</p>
579-
*
580-
* {@codesnippet com.azure.security.keyvault.keys.keyasyncclient.exportKeyWithResponse#String-String-String}
581-
*
582-
* @param name The name of the key to be exported.
583-
* @param version The key version.
584-
* @param environment The target environment assertion.
585-
* @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the
586-
* {@link KeyVaultKey exported key}.
587-
* @throws NullPointerException If the specified {@code name}, {@code version} or {@code environment} are
588-
* {@code null}.
589-
*/
590-
@ServiceMethod(returns = ReturnType.SINGLE)
591-
public Mono<Response<KeyVaultKey>> exportKeyWithResponse(String name, String version, String environment) {
592-
try {
593-
return withContext(context -> exportKeyWithResponse(name, version, environment, context));
594-
} catch (RuntimeException ex) {
595-
return monoError(logger, ex);
596-
}
597-
}
598-
599-
Mono<Response<KeyVaultKey>> exportKeyWithResponse(String name, String version, String environment,
600-
Context context) {
601-
Objects.requireNonNull(name, "The key name cannot be null.");
602-
Objects.requireNonNull(version, "The key version cannot be null.");
603-
Objects.requireNonNull(environment, "The environment parameter cannot be null.");
604-
605-
context = context == null ? Context.NONE : context;
606-
KeyExportRequestParameters parameters = new KeyExportRequestParameters().setEnvironment(environment);
607-
608-
return service.exportKey(vaultUrl, name, version, apiVersion, ACCEPT_LANGUAGE, parameters,
609-
CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE))
610-
.doOnRequest(ignored -> logger.verbose("Exporting key - {}", name))
611-
.doOnSuccess(response -> logger.verbose("Exported key - {}", response.getValue().getName()))
612-
.doOnError(error -> logger.warning("Failed to export key - {}", name, error));
613-
}
614-
615522
/**
616523
* Gets the public part of the specified key and key version. The get key operation is applicable to all key types
617524
* and it requires the {@code keys/get} permission.

sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -321,69 +321,6 @@ public Response<KeyVaultKey> importKeyWithResponse(ImportKeyOptions importKeyOpt
321321
return client.importKeyWithResponse(importKeyOptions, context).block();
322322
}
323323

324-
/**
325-
* Exports the latest version of a key from the key vault. The export key operation may be used to import any key
326-
* from the Azure Key Vault as long as it is marked as exportable and its release policy is satisfied.
327-
*
328-
* <p><strong>Code Samples</strong></p>
329-
* <p>Exports a key from a key vault. Subscribes to the call asynchronously and prints out the newly exported key
330-
* details when a response has been received.</p>
331-
*
332-
* {@codesnippet com.azure.security.keyvault.keys.keyclient.exportKey#String-String}
333-
*
334-
* @param name The name of the key to be exported.
335-
* @param environment The target environment assertion.
336-
* @return The {@link KeyVaultKey exported key}.
337-
* @throws NullPointerException If the specified {@code name} or {@code environment} are {@code null}.
338-
*/
339-
public KeyVaultKey exportKey(String name, String environment) {
340-
return client.exportKey(name, environment).block();
341-
}
342-
343-
/**
344-
* Exports a key from the key vault. The export key operation may be used to import any key from the Azure Key Vault
345-
* as long as it is marked as exportable and its release policy is satisfied.
346-
*
347-
* <p><strong>Code Samples</strong></p>
348-
* <p>Exports a key from a key vault. Subscribes to the call asynchronously and prints out the newly exported key
349-
* details when a response has been received.</p>
350-
*
351-
* {@codesnippet com.azure.security.keyvault.keys.keyclient.exportKey#String-String-String}
352-
*
353-
* @param name The name of the key to be exported.
354-
* @param version The key version.
355-
* @param environment The target environment assertion.
356-
* @return The {@link KeyVaultKey exported key}.
357-
* @throws NullPointerException If the specified {@code name}, {@code version} or {@code environment} are
358-
* {@code null}.
359-
*/
360-
public KeyVaultKey exportKey(String name, String version, String environment) {
361-
return client.exportKey(name, version, environment).block();
362-
}
363-
364-
/**
365-
* Exports a key from the key vault. The export key operation may be used to import any key from the Azure Key Vault
366-
* as long as it is marked as exportable and its release policy is satisfied.
367-
*
368-
* <p><strong>Code Samples</strong></p>
369-
* <p>Exports a key from a key vault. Subscribes to the call asynchronously and prints out the newly exported key
370-
* details when a response has been received.</p>
371-
*
372-
* {@codesnippet com.azure.security.keyvault.keys.keyclient.exportKeyWithResponse#String-String-String-Context}
373-
*
374-
* @param name The name of the key to be exported.
375-
* @param version The key version.
376-
* @param environment The target environment assertion.
377-
* @param context Additional context that is passed through the HTTP pipeline during the service call.
378-
* @return A {@link Response} whose {@link Response#getValue() value} contains the {@link KeyVaultKey exported key}.
379-
* @throws NullPointerException If the specified {@code name}, {@code version} or {@code environment} are
380-
* {@code null}.
381-
*/
382-
public Response<KeyVaultKey> exportKeyWithResponse(String name, String version, String environment,
383-
Context context) {
384-
return client.exportKeyWithResponse(name, version, environment, context).block();
385-
}
386-
387324
/**
388325
* Gets the public part of the specified key and key version. The get key operation is applicable to all key types
389326
* and it requires the {@code keys/get} permission.

sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyService.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,6 @@ Mono<Response<KeyVaultKey>> importKey(@HostParam("url") String url,
8989
@HeaderParam("Content-Type") String type,
9090
Context context);
9191

92-
@Post("keys/{key-name}/{key-version}/export")
93-
@ExpectedResponses({200})
94-
@UnexpectedResponseExceptionType(HttpResponseException.class)
95-
Mono<Response<KeyVaultKey>> exportKey(@HostParam("url") String url,
96-
@PathParam("key-name") String keyName,
97-
@PathParam("key-version") String keyVersion,
98-
@QueryParam("api-version") String apiVersion,
99-
@HeaderParam("accept-language") String acceptLanguage,
100-
@BodyParam("application/json") KeyExportRequestParameters parameters,
101-
@HeaderParam("Content-Type") String type,
102-
Context context);
103-
10492
@Delete("keys/{key-name}")
10593
@ExpectedResponses({200})
10694
@UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class)

sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.azure.security.keyvault.keys.models.KeyOperation;
2222
import com.azure.security.keyvault.keys.models.KeyProperties;
2323
import com.azure.security.keyvault.keys.models.KeyType;
24-
import com.azure.security.keyvault.keys.models.KeyVaultKey;
2524
import reactor.util.context.Context;
2625

2726
import java.time.Duration;
@@ -186,36 +185,6 @@ public void importKeySnippets() {
186185
// END: com.azure.security.keyvault.keys.keyasyncclient.importKeyWithResponse#options-response
187186
}
188187

189-
/**
190-
* Generates code samples for using {@link KeyAsyncClient#exportKey(String, String)},
191-
* {@link KeyAsyncClient#exportKey(String, String, String)} and
192-
* {@link KeyAsyncClient#exportKeyWithResponse(String, String, String)}
193-
*/
194-
public void exportKeySnippets() {
195-
KeyAsyncClient keyAsyncClient = createAsyncClient();
196-
197-
// BEGIN: com.azure.security.keyvault.keys.keyasyncclient.exportKey#String-String
198-
keyAsyncClient.exportKey("keyName", "environment").subscribe(exportedKey ->
199-
System.out.printf("Key was exported with name: %s and id: %s. \n", exportedKey.getName(),
200-
exportedKey.getId()));
201-
// END: com.azure.security.keyvault.keys.keyasyncclient.exportKey#String-String
202-
203-
// BEGIN: com.azure.security.keyvault.keys.keyasyncclient.exportKey#String-String-String
204-
keyAsyncClient.exportKey("keyName", "version", "environment").subscribe(exportedKey ->
205-
System.out.printf("Key was exported with name: %s and id: %s. \n", exportedKey.getName(),
206-
exportedKey.getId()));
207-
// END: com.azure.security.keyvault.keys.keyasyncclient.exportKey#String-String-String
208-
209-
// BEGIN: com.azure.security.keyvault.keys.keyasyncclient.exportKeyWithResponse#String-String-String
210-
keyAsyncClient.exportKeyWithResponse("keyName", "version", "environment")
211-
.subscribe(exportKeyResponse -> {
212-
KeyVaultKey exportedKey = exportKeyResponse.getValue();
213-
System.out.printf("Key was exported with name: %s and id: %s. \n", exportedKey.getName(),
214-
exportedKey.getId());
215-
});
216-
// END: com.azure.security.keyvault.keys.keyasyncclient.exportKeyWithResponse#String-String-String
217-
}
218-
219188
/**
220189
* Generates a code sample for using {@link KeyAsyncClient#getDeletedKey(String)}
221190
*/

sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -116,33 +116,6 @@ public void importKeySnippets() {
116116
// END: com.azure.security.keyvault.keys.keyclient.importKeyWithResponse#options-response
117117
}
118118

119-
/**
120-
* Generates code samples for using {@link KeyClient#exportKey(String, String)},
121-
* {@link KeyClient#exportKey(String, String, String)} and
122-
* {@link KeyClient#exportKeyWithResponse(String, String, String, Context)}
123-
*/
124-
public void exportKeySnippets() {
125-
KeyClient keyClient = createClient();
126-
127-
// BEGIN: com.azure.security.keyvault.keys.keyclient.exportKey#String-String
128-
KeyVaultKey exportedKey = keyClient.exportKey("keyName", "environment");
129-
System.out.printf("Key was exported with name: %s and id: %s. \n", exportedKey.getName(), exportedKey.getId());
130-
// END: com.azure.security.keyvault.keys.keyclient.exportKey#String-String
131-
132-
// BEGIN: com.azure.security.keyvault.keys.keyclient.exportKey#String-String-String
133-
KeyVaultKey exportKey = keyClient.exportKey("keyName", "version", "environment");
134-
System.out.printf("Key was exported with name: %s and id: %s. \n", exportKey.getName(),
135-
exportKey.getId());
136-
// END: com.azure.security.keyvault.keys.keyclient.exportKey#String-String-String
137-
138-
// BEGIN: com.azure.security.keyvault.keys.keyclient.exportKeyWithResponse#String-String-String-Context
139-
KeyVaultKey exportedKeyFromResponse = keyClient.exportKeyWithResponse("keyName", "version", "environment",
140-
new Context(key1, value1)).getValue();
141-
System.out.printf("Key was exported with name: %s and id: %s. \n", exportedKeyFromResponse.getName(),
142-
exportedKeyFromResponse.getId());
143-
// END: com.azure.security.keyvault.keys.keyclient.exportKeyWithResponse#String-String-String-Context
144-
}
145-
146119
/**
147120
* Generates a code sample for using {@link KeyClient#beginDeleteKey(String)} and
148121
* {@link KeyClient#beginDeleteKey(String, Duration)}.

0 commit comments

Comments
 (0)