From 02894d19c0a1b2f4f0c1b190f6534643dea9fac2 Mon Sep 17 00:00:00 2001 From: Sameeksha Vaity Date: Fri, 26 Jul 2019 15:08:02 -0700 Subject: [PATCH] addint toMono --- .../keyvault/secrets/SecretAsyncClient.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java index 25a7775cec376..e6630fdeaafa6 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java @@ -13,6 +13,7 @@ import com.azure.core.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.secrets.models.DeletedSecret; @@ -87,7 +88,7 @@ public final class SecretAsyncClient { @ServiceMethod(returns = ReturnType.SINGLE) public Mono setSecret(Secret secret) { return withContext(context -> setSecretWithResponse(secret)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -147,7 +148,7 @@ Mono> setSecret(Secret secret, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono setSecret(String name, String value) { return withContext(context -> setSecret(name, value, context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } Mono> setSecret(String name, String value, Context context) { @@ -182,7 +183,7 @@ Mono> setSecret(String name, String value, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSecret(String name, String version) { return withContext(context -> getSecretWithResponse(name, version)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -249,7 +250,7 @@ public Mono getSecret(SecretBase secretBase) { return getSecret(secretBase.name()); } return getSecretWithResponse(secretBase.name(), secretBase.version()) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -307,7 +308,7 @@ Mono> getSecret(SecretBase secretBase, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSecret(String name) { return getSecretWithResponse(name, "") - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } Mono> getSecret(String name, Context context) { @@ -335,7 +336,7 @@ Mono> getSecret(String name, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSecret(SecretBase secret) { return withContext(context -> updateSecretWithResponse(secret)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -392,7 +393,7 @@ Mono> updateSecret(SecretBase secret, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteSecret(String name) { return withContext(context -> deleteSecretWithResponse(name)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -443,7 +444,7 @@ Mono> deleteSecret(String name, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono getDeletedSecret(String name) { return withContext(context -> getDeletedSecretWithResponse(name)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -527,7 +528,7 @@ Mono purgeDeletedSecret(String name, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono recoverDeletedSecret(String name) { return withContext(context -> recoverDeletedSecretWithResponse(name)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -578,7 +579,7 @@ Mono> recoverDeletedSecret(String name, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono backupSecret(String name) { return withContext(context -> backupSecretWithResponse(name)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /** @@ -631,7 +632,7 @@ Mono> backupSecret(String name, Context context) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono restoreSecret(byte[] backup) { return withContext(context -> restoreSecretWithResponse(backup)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(FluxUtil::toMono); } /**