use of com.microsoft.azure.keyvault.models.KeyRestoreParameters 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);
}
}
});
}
Aggregations