Search in sources :

Example 11 with CertificateOperation

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

the class KeyVaultClientImpl method createCertificateWithServiceResponseAsync.

/**
     * Creates a new certificate. If this is the first version, the certificate resource is created.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param certificateName The name of the certificate.
     * @return the observable to the CertificateOperation object
     */
public Observable<ServiceResponse<CertificateOperation>> createCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName) {
    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.");
    }
    final CertificatePolicy certificatePolicy = null;
    final CertificateAttributes certificateAttributes = null;
    final Map<String, String> tags = null;
    CertificateCreateParameters parameters = new CertificateCreateParameters();
    parameters.withCertificatePolicy(null);
    parameters.withCertificateAttributes(null);
    parameters.withTags(null);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.createCertificate(certificateName, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateOperation>>>() {

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

Aggregations

CertificateOperation (com.microsoft.azure.keyvault.models.CertificateOperation)11 CertificatePolicy (com.microsoft.azure.keyvault.models.CertificatePolicy)8 IssuerParameters (com.microsoft.azure.keyvault.models.IssuerParameters)7 KeyVaultErrorException (com.microsoft.azure.keyvault.models.KeyVaultErrorException)7 SecretProperties (com.microsoft.azure.keyvault.models.SecretProperties)7 X509CertificateProperties (com.microsoft.azure.keyvault.models.X509CertificateProperties)7 CreateCertificateRequest (com.microsoft.azure.keyvault.requests.CreateCertificateRequest)7 Test (org.junit.Test)7 CertificateBundle (com.microsoft.azure.keyvault.models.CertificateBundle)6 ServiceResponse (com.microsoft.rest.ServiceResponse)3 ResponseBody (okhttp3.ResponseBody)3 Response (retrofit2.Response)3 Observable (rx.Observable)3 SecretIdentifier (com.microsoft.azure.keyvault.SecretIdentifier)2 AdministratorDetails (com.microsoft.azure.keyvault.models.AdministratorDetails)2 CertificateAttributes (com.microsoft.azure.keyvault.models.CertificateAttributes)2 CertificateCreateParameters (com.microsoft.azure.keyvault.models.CertificateCreateParameters)2 IssuerBundle (com.microsoft.azure.keyvault.models.IssuerBundle)2 IssuerCredentials (com.microsoft.azure.keyvault.models.IssuerCredentials)2 OrganizationDetails (com.microsoft.azure.keyvault.models.OrganizationDetails)2