use of org.apache.parquet.crypto.KeyAccessDeniedException in project parquet-mr by apache.
the class VaultClient method executeAndGetResponse.
private String executeAndGetResponse(String endPoint, Request request) {
Response response = null;
try {
response = httpClient.newCall(request).execute();
final String responseBody = response.body().string();
if (response.isSuccessful()) {
return responseBody;
} else {
if ((401 == response.code()) || (403 == response.code())) {
throw new KeyAccessDeniedException(responseBody);
}
throw new IOException("Vault call [" + endPoint + "] didn't succeed: " + responseBody);
}
} catch (IOException e) {
throw new ParquetCryptoRuntimeException("Vault call [" + request.url().toString() + endPoint + "] didn't succeed", e);
} finally {
if (null != response) {
response.close();
}
}
}
Aggregations