Search in sources :

Example 1 with SecretUpdateParameters

use of com.microsoft.azure.keyvault.models.SecretUpdateParameters in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateSecretWithServiceResponseAsync.

/**
     * Updates the attributes associated with a specified secret in a given key vault.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param secretName The name of the secret.
     * @param secretVersion The version of the secret.
     * @param contentType Type of the secret value such as a password.
     * @param secretAttributes The secret management attributes.
     * @param tags Application specific metadata in the form of key-value pairs.
     * @return the observable to the SecretBundle object
     */
public Observable<ServiceResponse<SecretBundle>> updateSecretWithServiceResponseAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (secretName == null) {
        throw new IllegalArgumentException("Parameter secretName is required and cannot be null.");
    }
    if (secretVersion == null) {
        throw new IllegalArgumentException("Parameter secretVersion is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    Validator.validate(secretAttributes);
    Validator.validate(tags);
    SecretUpdateParameters parameters = new SecretUpdateParameters();
    parameters.withContentType(contentType);
    parameters.withSecretAttributes(secretAttributes);
    parameters.withTags(tags);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateSecret(secretName, secretVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SecretBundle>>>() {

        @Override
        public Observable<ServiceResponse<SecretBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<SecretBundle> clientResponse = updateSecretDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) SecretBundle(com.microsoft.azure.keyvault.models.SecretBundle) ServiceResponse(com.microsoft.rest.ServiceResponse) SecretUpdateParameters(com.microsoft.azure.keyvault.models.SecretUpdateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 2 with SecretUpdateParameters

use of com.microsoft.azure.keyvault.models.SecretUpdateParameters in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateSecretWithServiceResponseAsync.

/**
     * Updates the attributes associated with a specified secret in a given key vault.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param secretName The name of the secret.
     * @param secretVersion The version of the secret.
     * @return the observable to the SecretBundle object
     */
public Observable<ServiceResponse<SecretBundle>> updateSecretWithServiceResponseAsync(String vaultBaseUrl, String secretName, String secretVersion) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (secretName == null) {
        throw new IllegalArgumentException("Parameter secretName is required and cannot be null.");
    }
    if (secretVersion == null) {
        throw new IllegalArgumentException("Parameter secretVersion is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    final String contentType = null;
    final SecretAttributes secretAttributes = null;
    final Map<String, String> tags = null;
    SecretUpdateParameters parameters = new SecretUpdateParameters();
    parameters.withContentType(null);
    parameters.withSecretAttributes(null);
    parameters.withTags(null);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateSecret(secretName, secretVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SecretBundle>>>() {

        @Override
        public Observable<ServiceResponse<SecretBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<SecretBundle> clientResponse = updateSecretDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : SecretUpdateParameters(com.microsoft.azure.keyvault.models.SecretUpdateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) SecretBundle(com.microsoft.azure.keyvault.models.SecretBundle) ServiceResponse(com.microsoft.rest.ServiceResponse) SecretAttributes(com.microsoft.azure.keyvault.models.SecretAttributes)

Aggregations

SecretBundle (com.microsoft.azure.keyvault.models.SecretBundle)2 SecretUpdateParameters (com.microsoft.azure.keyvault.models.SecretUpdateParameters)2 ServiceResponse (com.microsoft.rest.ServiceResponse)2 ResponseBody (okhttp3.ResponseBody)2 Response (retrofit2.Response)2 Observable (rx.Observable)2 SecretAttributes (com.microsoft.azure.keyvault.models.SecretAttributes)1