use of com.microsoft.rest.ServiceResponse 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.
* @return the observable to the CertificateBundle object
*/
public Observable<ServiceResponse<CertificateBundle>> mergeCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates) {
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);
final CertificateAttributes certificateAttributes = null;
final Map<String, String> tags = null;
CertificateMergeParameters parameters = new CertificateMergeParameters();
parameters.withX509Certificates(x509Certificates);
parameters.withCertificateAttributes(null);
parameters.withTags(null);
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);
}
}
});
}
use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.
the class KeyVaultClientImpl method updateCertificateWithServiceResponseAsync.
/**
* Updates the specified attributes associated with the given certificate.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param certificateName The name of the certificate in the given key vault.
* @param certificateVersion The version of the certificate.
* @return the observable to the CertificateBundle object
*/
public Observable<ServiceResponse<CertificateBundle>> updateCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, String certificateVersion) {
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 (certificateVersion == null) {
throw new IllegalArgumentException("Parameter certificateVersion 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;
CertificateUpdateParameters parameters = new CertificateUpdateParameters();
parameters.withCertificatePolicy(null);
parameters.withCertificateAttributes(null);
parameters.withTags(null);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.updateCertificate(certificateName, certificateVersion, 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 = updateCertificateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of com.microsoft.rest.ServiceResponse 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);
}
}
});
}
use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.
the class KeyVaultClientImpl method restoreKeyWithServiceResponseAsync.
/**
* Restores a backed up key to a vault.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param keyBundleBackup The backup blob associated with a key bundle.
* @return the observable to the KeyBundle object
*/
public Observable<ServiceResponse<KeyBundle>> restoreKeyWithServiceResponseAsync(String vaultBaseUrl, byte[] keyBundleBackup) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
if (keyBundleBackup == null) {
throw new IllegalArgumentException("Parameter keyBundleBackup is required and cannot be null.");
}
KeyRestoreParameters parameters = new KeyRestoreParameters();
parameters.withKeyBundleBackup(keyBundleBackup);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.restoreKey(this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<KeyBundle>>>() {
@Override
public Observable<ServiceResponse<KeyBundle>> call(Response<ResponseBody> response) {
try {
ServiceResponse<KeyBundle> clientResponse = restoreKeyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.
the class KeyVaultClientImpl method unwrapKeyWithServiceResponseAsync.
/**
* Unwraps a symmetric key using the specified key that was initially used for wrapping that 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 algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA1_5'
* @param value the Base64Url value
* @return the observable to the KeyOperationResult object
*/
public Observable<ServiceResponse<KeyOperationResult>> unwrapKeyWithServiceResponseAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) {
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 (value == null) {
throw new IllegalArgumentException("Parameter value is required and cannot be null.");
}
KeyOperationsParameters parameters = new KeyOperationsParameters();
parameters.withAlgorithm(algorithm);
parameters.withValue(value);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.unwrapKey(keyName, keyVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<KeyOperationResult>>>() {
@Override
public Observable<ServiceResponse<KeyOperationResult>> call(Response<ResponseBody> response) {
try {
ServiceResponse<KeyOperationResult> clientResponse = unwrapKeyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
Aggregations