private BuilderImpl(AwsErrorDetails awsErrorDetails) { this.errorMessage = awsErrorDetails.errorMessage(); this.errorCode = awsErrorDetails.errorCode(); this.serviceName = awsErrorDetails.serviceName(); this.sdkHttpResponse = awsErrorDetails.sdkHttpResponse(); this.rawResponse = awsErrorDetails.rawResponse(); }
public FeatureState retrieveFeatureStateFromS3(final Feature feature) { final GetObjectRequest getRequest = GetObjectRequest.builder() .bucket(togglzProperties.getS3().getBucketName()) .key(keyForFeature(feature)) .build(); try (final ResponseInputStream<GetObjectResponse> responseStream = s3Client.getObject(getRequest)) { if (responseStream != null) { final FeatureStateStorageWrapper wrapper = objectMapper.reader() .forType(FeatureStateStorageWrapper.class) .readValue(responseStream); return FeatureStateStorageWrapper.featureStateForWrapper(feature, wrapper); } } catch (final S3Exception ae) { if (ERR_NO_SUCH_KEY.equals(ae.awsErrorDetails().errorCode()) || ae.awsErrorDetails().sdkHttpResponse().statusCode() == 404) { return null; } throw ae; } catch (final IOException e) { throw new RuntimeException("Failed to get the feature state", e); } return null; }
} catch (AwsServiceException awsServiceException) { if (holdLockOnServiceUnavailable && awsServiceException.awsErrorDetails().sdkHttpResponse().statusCode() == HttpStatusCode.SERVICE_UNAVAILABLE) {
.sdkHttpResponse() .firstMatchingHeader("x-amz-request-id") .orElse(null);