Skip to content

Commit

Permalink
addint toMono
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity committed Jul 26, 2019
1 parent 7d8f835 commit 02894d1
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,7 +88,7 @@ public final class SecretAsyncClient {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Secret> setSecret(Secret secret) {
return withContext(context -> setSecretWithResponse(secret))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -147,7 +148,7 @@ Mono<Response<Secret>> setSecret(Secret secret, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Secret> setSecret(String name, String value) {
return withContext(context -> setSecret(name, value, context))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

Mono<Response<Secret>> setSecret(String name, String value, Context context) {
Expand Down Expand Up @@ -182,7 +183,7 @@ Mono<Response<Secret>> setSecret(String name, String value, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Secret> getSecret(String name, String version) {
return withContext(context -> getSecretWithResponse(name, version))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -249,7 +250,7 @@ public Mono<Secret> getSecret(SecretBase secretBase) {
return getSecret(secretBase.name());
}
return getSecretWithResponse(secretBase.name(), secretBase.version())
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -307,7 +308,7 @@ Mono<Response<Secret>> getSecret(SecretBase secretBase, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Secret> getSecret(String name) {
return getSecretWithResponse(name, "")
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

Mono<Response<Secret>> getSecret(String name, Context context) {
Expand Down Expand Up @@ -335,7 +336,7 @@ Mono<Response<Secret>> getSecret(String name, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SecretBase> updateSecret(SecretBase secret) {
return withContext(context -> updateSecretWithResponse(secret))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -392,7 +393,7 @@ Mono<Response<SecretBase>> updateSecret(SecretBase secret, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DeletedSecret> deleteSecret(String name) {
return withContext(context -> deleteSecretWithResponse(name))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -443,7 +444,7 @@ Mono<Response<DeletedSecret>> deleteSecret(String name, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DeletedSecret> getDeletedSecret(String name) {
return withContext(context -> getDeletedSecretWithResponse(name))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -527,7 +528,7 @@ Mono<VoidResponse> purgeDeletedSecret(String name, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Secret> recoverDeletedSecret(String name) {
return withContext(context -> recoverDeletedSecretWithResponse(name))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -578,7 +579,7 @@ Mono<Response<Secret>> recoverDeletedSecret(String name, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<byte[]> backupSecret(String name) {
return withContext(context -> backupSecretWithResponse(name))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down Expand Up @@ -631,7 +632,7 @@ Mono<Response<byte[]>> backupSecret(String name, Context context) {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Secret> restoreSecret(byte[] backup) {
return withContext(context -> restoreSecretWithResponse(backup))
.flatMap(response -> Mono.justOrEmpty(response.value()));
.flatMap(FluxUtil::toMono);
}

/**
Expand Down

0 comments on commit 02894d1

Please sign in to comment.