use of com.microsoft.azure.keyvault.models.CertificateImportParameters in project azure-sdk-for-java by Azure.
the class KeyVaultClientImpl method importCertificateWithServiceResponseAsync.
/**
* Imports a certificate into a specified key vault.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param certificateName The name of the certificate.
* @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key.
* @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption.
* @param certificatePolicy The management policy for the certificate.
* @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>> importCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, 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 (base64EncodedCertificate == null) {
throw new IllegalArgumentException("Parameter base64EncodedCertificate is required and cannot be null.");
}
Validator.validate(certificatePolicy);
Validator.validate(certificateAttributes);
Validator.validate(tags);
CertificateImportParameters parameters = new CertificateImportParameters();
parameters.withBase64EncodedCertificate(base64EncodedCertificate);
parameters.withPassword(password);
parameters.withCertificatePolicy(certificatePolicy);
parameters.withCertificateAttributes(certificateAttributes);
parameters.withTags(tags);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.importCertificate(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 = importCertificateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of com.microsoft.azure.keyvault.models.CertificateImportParameters in project azure-sdk-for-java by Azure.
the class KeyVaultClientImpl method importCertificateWithServiceResponseAsync.
/**
* Imports a certificate into a specified key vault.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param certificateName The name of the certificate.
* @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key.
* @return the observable to the CertificateBundle object
*/
public Observable<ServiceResponse<CertificateBundle>> importCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate) {
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 (base64EncodedCertificate == null) {
throw new IllegalArgumentException("Parameter base64EncodedCertificate is required and cannot be null.");
}
final String password = null;
final CertificatePolicy certificatePolicy = null;
final CertificateAttributes certificateAttributes = null;
final Map<String, String> tags = null;
CertificateImportParameters parameters = new CertificateImportParameters();
parameters.withBase64EncodedCertificate(base64EncodedCertificate);
parameters.withPassword(null);
parameters.withCertificatePolicy(null);
parameters.withCertificateAttributes(null);
parameters.withTags(null);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.importCertificate(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 = importCertificateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
Aggregations