use of com.microsoft.azure.keyvault.models.CertificateBundle in project azure-sdk-for-java by Azure.
the class KeyVaultClientImpl method mergeCertificateWithServiceResponseAsync.
/**
* Merges a certificate or a certificate chain with a key pair existing on the server.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param certificateName The name of the certificate.
* @param x509Certificates The certificate or the certificate chain to merge.
* @param certificateAttributes The attributes of the certificate (optional).
* @param tags Application specific metadata in the form of key-value pairs.
* @return the observable to the CertificateBundle object
*/
public Observable<ServiceResponse<CertificateBundle>> mergeCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, CertificateAttributes certificateAttributes, Map<String, String> tags) {
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.");
}
if (x509Certificates == null) {
throw new IllegalArgumentException("Parameter x509Certificates is required and cannot be null.");
}
Validator.validate(x509Certificates);
Validator.validate(certificateAttributes);
Validator.validate(tags);
CertificateMergeParameters parameters = new CertificateMergeParameters();
parameters.withX509Certificates(x509Certificates);
parameters.withCertificateAttributes(certificateAttributes);
parameters.withTags(tags);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.mergeCertificate(certificateName, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateBundle>>>() {
@Override
public Observable<ServiceResponse<CertificateBundle>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CertificateBundle> clientResponse = mergeCertificateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
Aggregations