Search in sources :

Example 61 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateCertificateOperationWithServiceResponseAsync.

/**
     * Updates a certificate operation.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param certificateName The name of the certificate.
     * @param cancellationRequested Indicates if cancellation was requested on the certificate operation.
     * @return the observable to the CertificateOperation object
     */
public Observable<ServiceResponse<CertificateOperation>> updateCertificateOperationWithServiceResponseAsync(String vaultBaseUrl, String certificateName, boolean cancellationRequested) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (certificateName == null) {
        throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    CertificateOperationUpdateParameter certificateOperation = new CertificateOperationUpdateParameter();
    certificateOperation.withCancellationRequested(cancellationRequested);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateCertificateOperation(certificateName, this.apiVersion(), this.acceptLanguage(), certificateOperation, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateOperation>>>() {

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

Example 62 with Observable

use of rx.Observable 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)

Example 63 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method verifyWithServiceResponseAsync.

/**
     * Verifies a signature using a specified key.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param keyName The name of the key.
     * @param keyVersion The version of the key.
     * @param algorithm The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'RS256', 'RS384', 'RS512', 'RSNULL'
     * @param digest The digest used for signing.
     * @param signature The signature to be verified.
     * @return the observable to the KeyVerifyResult object
     */
public Observable<ServiceResponse<KeyVerifyResult>> verifyWithServiceResponseAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeySignatureAlgorithm algorithm, byte[] digest, byte[] signature) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (keyName == null) {
        throw new IllegalArgumentException("Parameter keyName is required and cannot be null.");
    }
    if (keyVersion == null) {
        throw new IllegalArgumentException("Parameter keyVersion is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    if (algorithm == null) {
        throw new IllegalArgumentException("Parameter algorithm is required and cannot be null.");
    }
    if (digest == null) {
        throw new IllegalArgumentException("Parameter digest is required and cannot be null.");
    }
    if (signature == null) {
        throw new IllegalArgumentException("Parameter signature is required and cannot be null.");
    }
    KeyVerifyParameters parameters = new KeyVerifyParameters();
    parameters.withAlgorithm(algorithm);
    parameters.withDigest(digest);
    parameters.withSignature(signature);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.verify(keyName, keyVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<KeyVerifyResult>>>() {

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

Example 64 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateCertificateIssuerWithServiceResponseAsync.

/**
     * Updates the specified certificate issuer.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param issuerName The name of the issuer.
     * @param provider The issuer provider.
     * @param credentials The credentials to be used for the issuer.
     * @param organizationDetails Details of the organization as provided to the issuer.
     * @param attributes Attributes of the issuer object.
     * @return the observable to the IssuerBundle object
     */
public Observable<ServiceResponse<IssuerBundle>> updateCertificateIssuerWithServiceResponseAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (issuerName == null) {
        throw new IllegalArgumentException("Parameter issuerName is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    Validator.validate(credentials);
    Validator.validate(organizationDetails);
    Validator.validate(attributes);
    CertificateIssuerUpdateParameters parameter = new CertificateIssuerUpdateParameters();
    parameter.withProvider(provider);
    parameter.withCredentials(credentials);
    parameter.withOrganizationDetails(organizationDetails);
    parameter.withAttributes(attributes);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateCertificateIssuer(issuerName, this.apiVersion(), this.acceptLanguage(), parameter, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<IssuerBundle>>>() {

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

Example 65 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateCertificateIssuerWithServiceResponseAsync.

/**
     * Updates the specified certificate issuer.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param issuerName The name of the issuer.
     * @return the observable to the IssuerBundle object
     */
public Observable<ServiceResponse<IssuerBundle>> updateCertificateIssuerWithServiceResponseAsync(String vaultBaseUrl, String issuerName) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (issuerName == null) {
        throw new IllegalArgumentException("Parameter issuerName is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    final String provider = null;
    final IssuerCredentials credentials = null;
    final OrganizationDetails organizationDetails = null;
    final IssuerAttributes attributes = null;
    CertificateIssuerUpdateParameters parameter = new CertificateIssuerUpdateParameters();
    parameter.withProvider(null);
    parameter.withCredentials(null);
    parameter.withOrganizationDetails(null);
    parameter.withAttributes(null);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateCertificateIssuer(issuerName, this.apiVersion(), this.acceptLanguage(), parameter, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<IssuerBundle>>>() {

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

Aggregations

Observable (rx.Observable)205 ResponseBody (okhttp3.ResponseBody)97 Response (retrofit2.Response)93 ServiceResponse (com.microsoft.rest.ServiceResponse)92 ArrayList (java.util.ArrayList)35 List (java.util.List)33 Test (org.junit.Test)29 Func1 (rx.functions.Func1)26 IOException (java.io.IOException)15 Subscription (rx.Subscription)15 Context (android.content.Context)14 Schedulers (rx.schedulers.Schedulers)13 ByteBuf (io.netty.buffer.ByteBuf)10 Intent (android.content.Intent)9 NonNull (android.support.annotation.NonNull)9 Collections (java.util.Collections)9 AndroidSchedulers (rx.android.schedulers.AndroidSchedulers)9 Action1 (rx.functions.Action1)9 SharedPreferences (android.content.SharedPreferences)8 Nullable (android.support.annotation.Nullable)8