com.amazonaws.ResponseMetadata Java Examples
The following examples show how to use
com.amazonaws.ResponseMetadata.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AmazonWebServicesClientProxy.java From cloudformation-cli-java-plugin with Apache License 2.0 | 6 votes |
public <RequestT extends AmazonWebServiceRequest, ResultT extends AmazonWebServiceResult<ResponseMetadata>> ResultT injectCredentialsAndInvoke(final RequestT request, final Function<RequestT, ResultT> requestFunction) { request.setRequestCredentialsProvider(v1CredentialsProvider); try { ResultT respose = requestFunction.apply(request); logRequestMetadata(request, respose); return respose; } catch (final Throwable e) { loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage())); throw e; } finally { request.setRequestCredentialsProvider(null); } }
Example #2
Source File: TracingRequestHandler.java From zipkin-aws with Apache License 2.0 | 6 votes |
static void tagSpanWithRequestId(Span span, Response response) { String requestId = null; if (response != null) { if (response.getAwsResponse() instanceof AmazonWebServiceResult<?>) { ResponseMetadata metadata = ((AmazonWebServiceResult<?>) response.getAwsResponse()).getSdkResponseMetadata(); if (null != metadata) { requestId = metadata.getRequestId(); } } else if (response.getHttpResponse() != null) { if (response.getHttpResponse().getHeader("x-amz-request-id") != null) { requestId = response.getHttpResponse().getHeader("x-amz-request-id"); } } } if (requestId != null) { span.tag("aws.request_id", requestId); } }
Example #3
Source File: AmazonWebServicesClientProxy.java From cloudformation-cli-java-plugin with Apache License 2.0 | 5 votes |
private <RequestT extends AmazonWebServiceRequest, ResultT extends AmazonWebServiceResult<ResponseMetadata>> void logRequestMetadata(final RequestT request, final ResultT response) { try { String requestName = request.getClass().getSimpleName(); String requestId = (response == null || response.getSdkResponseMetadata() == null) ? "" : response.getSdkResponseMetadata().getRequestId(); loggerProxy .log(String.format("{\"apiRequest\": {\"requestId\": \"%s\", \"requestName\": \"%s\"}}", requestId, requestName)); } catch (final Exception e) { loggerProxy.log(e.getMessage()); } }
Example #4
Source File: TracingHandler.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
private void populateAndEndSubsegment(Subsegment currentSubsegment, Request<?> request, Response<?> response) { if (null != response) { String requestId = null; if (response.getAwsResponse() instanceof AmazonWebServiceResult<?>) { // Not all services return responses extending AmazonWebServiceResult (e.g. S3) ResponseMetadata metadata = ((AmazonWebServiceResult<?>) response.getAwsResponse()).getSdkResponseMetadata(); if (null != metadata) { requestId = metadata.getRequestId(); if (null != requestId) { currentSubsegment.putAws(REQUEST_ID_SUBSEGMENT_KEY, requestId); } } } else if (null != response.getHttpResponse()) { // S3 does not follow request id header convention if (null != response.getHttpResponse().getHeader(S3_REQUEST_ID_HEADER_KEY)) { currentSubsegment.putAws(REQUEST_ID_SUBSEGMENT_KEY, response.getHttpResponse().getHeader(S3_REQUEST_ID_HEADER_KEY)); } if (null != response.getHttpResponse().getHeader(EntityHeaderKeys.AWS.EXTENDED_REQUEST_ID_HEADER)) { currentSubsegment.putAws(EntityDataKeys.AWS.EXTENDED_REQUEST_ID_KEY, response.getHttpResponse().getHeader( EntityHeaderKeys.AWS.EXTENDED_REQUEST_ID_HEADER)); } } currentSubsegment.putAllAws(extractResponseParameters(request, response.getAwsResponse())); currentSubsegment.putAllHttp(extractHttpResponseInformation(response.getHttpResponse())); } finalizeSubsegment(request); }
Example #5
Source File: AmazonDynamoDBStub.java From aws-java-sdk-stubs with Apache License 2.0 | 5 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { Map<String, String> metadata = new HashMap<String, String>(); ResponseMetadata responseMetadata = new ResponseMetadata(metadata); return responseMetadata; }
Example #6
Source File: PublishResultCodersTest.java From beam with Apache License 2.0 | 5 votes |
private PublishResult buildFullPublishResult() { PublishResult publishResult = new PublishResult().withMessageId(UUID.randomUUID().toString()); publishResult.setSdkResponseMetadata( new ResponseMetadata( ImmutableMap.of(ResponseMetadata.AWS_REQUEST_ID, UUID.randomUUID().toString()))); HttpResponse httpResponse = new HttpResponse(null, null); httpResponse.setStatusCode(200); httpResponse.addHeader("Content-Type", "application/json"); publishResult.setSdkHttpMetadata(SdkHttpMetadata.from(httpResponse)); return publishResult; }
Example #7
Source File: AmazonDynamoDBStubTest.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Test public void test_getCachedResponseMetadata() throws Exception { ResponseMetadata result = dynamoDb.getCachedResponseMetadata(null); assertThat(result, notNullValue()); }
Example #8
Source File: AmazonEC2Stub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #9
Source File: AmazonElasticMapReduceStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #10
Source File: AmazonElasticLoadBalancingStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #11
Source File: AmazonSQSStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #12
Source File: AmazonSNSStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #13
Source File: AmazonAutoScalingStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #14
Source File: AmazonIdentityManagementStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #15
Source File: AmazonSimpleWorkflowStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #16
Source File: MockKinesisClient.java From presto-kinesis with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest amazonWebServiceRequest) { return null; }
Example #17
Source File: EucaEc2Client.java From primecloud-controller with GNU General Public License v2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return null; }
Example #18
Source File: IvonaSpeechCloudClient.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return client.getResponseMetadataForRequest(request); }
Example #19
Source File: TransactionManagerDynamoDBFacade.java From dynamodb-transactions with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata( AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException("Use the underlying client instance instead"); }
Example #20
Source File: ThreadLocalDynamoDBFacade.java From dynamodb-transactions with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return getBackend().getCachedResponseMetadata(request); }
Example #21
Source File: TransactionDynamoDBFacade.java From dynamodb-transactions with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata( AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException("Use the underlying client instance instead"); }
Example #22
Source File: AmazonCloudWatchStub.java From aws-java-sdk-stubs with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(final AmazonWebServiceRequest arg0) { throw new UnsupportedOperationException(); }
Example #23
Source File: NoopCloudWatch.java From dynamodb-cross-region-library with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest amazonWebServiceRequest) { return null; }
Example #24
Source File: MockKinesisClient.java From presto with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest amazonWebServiceRequest) { return null; }
Example #25
Source File: MockKMSClient.java From aws-encryption-sdk-java with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest arg0) { throw new java.lang.UnsupportedOperationException(); }
Example #26
Source File: AwsCodersTest.java From beam with Apache License 2.0 | 4 votes |
private ResponseMetadata buildResponseMetadata() { return new ResponseMetadata( ImmutableMap.of(ResponseMetadata.AWS_REQUEST_ID, UUID.randomUUID().toString())); }
Example #27
Source File: AwsCodersTest.java From beam with Apache License 2.0 | 4 votes |
@Test public void testResponseMetadataDecodeEncodeEquals() throws Exception { ResponseMetadata value = buildResponseMetadata(); ResponseMetadata clone = CoderUtils.clone(AwsCoders.responseMetadata(), value); assertThat(clone.getRequestId(), equalTo(value.getRequestId())); }
Example #28
Source File: AwsCoders.java From beam with Apache License 2.0 | 4 votes |
@Override public ResponseMetadata decode(InputStream inStream) throws CoderException, IOException { return new ResponseMetadata(METADATA_ENCODER.decode(inStream)); }
Example #29
Source File: AwsCoders.java From beam with Apache License 2.0 | 4 votes |
@Override public void encode(ResponseMetadata value, OutputStream outStream) throws CoderException, IOException { METADATA_ENCODER.encode( ImmutableMap.of(ResponseMetadata.AWS_REQUEST_ID, value.getRequestId()), outStream); }
Example #30
Source File: PublishResultCoders.java From beam with Apache License 2.0 | 4 votes |
private PublishResultCoder( Coder<ResponseMetadata> responseMetadataEncoder, Coder<SdkHttpMetadata> sdkHttpMetadataCoder) { this.responseMetadataEncoder = responseMetadataEncoder; this.sdkHttpMetadataCoder = sdkHttpMetadataCoder; }