All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreamsClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon DynamoDB module holds the client classes that are used for communicating with Amazon DynamoDB Service

The newest version!
/*
 * Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.dynamodbv2;

import org.w3c.dom.*;

import java.net.*;
import java.util.*;

import javax.annotation.Generated;

import org.apache.commons.logging.*;

import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;

import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;

import com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreamsClientBuilder;

import com.amazonaws.AmazonServiceException;

import com.amazonaws.services.dynamodbv2.model.*;

import com.amazonaws.services.dynamodbv2.model.transform.*;

/**
 * Client for accessing Amazon DynamoDB Streams. All service calls made using this client are blocking, and will not
 * return until the service call completes.
 * 

* Amazon DynamoDB *

* Amazon DynamoDB Streams provides API actions for accessing streams and processing stream records. To learn more about * application development with Streams, see Capturing Table Activity with * DynamoDB Streams in the Amazon DynamoDB Developer Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonDynamoDBStreamsClient extends AmazonWebServiceClient implements AmazonDynamoDBStreams { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AmazonDynamoDBStreams.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "dynamodb"; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.0") .withSupportsCbor(false) .withSupportsIon(false) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("TrimmedDataAccessException").withExceptionUnmarshaller( com.amazonaws.services.dynamodbv2.model.transform.TrimmedDataAccessExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.dynamodbv2.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ExpiredIteratorException").withExceptionUnmarshaller( com.amazonaws.services.dynamodbv2.model.transform.ExpiredIteratorExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InternalServerError").withExceptionUnmarshaller( com.amazonaws.services.dynamodbv2.model.transform.InternalServerErrorExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("LimitExceededException").withExceptionUnmarshaller( com.amazonaws.services.dynamodbv2.model.transform.LimitExceededExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException.class)); /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams. A credentials provider chain will * be used that searches for credentials in this order: *
    *
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • *
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • *
  • Instance profile credentials delivered through the Amazon EC2 metadata service
  • *
* *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @see DefaultAWSCredentialsProviderChain * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#defaultClient()} */ @Deprecated public AmazonDynamoDBStreamsClient() { this(DefaultAWSCredentialsProviderChain.getInstance(), configFactory.getConfig()); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams. A credentials provider chain will * be used that searches for credentials in this order: *

    *
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • *
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • *
  • Instance profile credentials delivered through the Amazon EC2 metadata service
  • *
* *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon DynamoDB Streams (ex: * proxy settings, retry counts, etc.). * * @see DefaultAWSCredentialsProviderChain * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonDynamoDBStreamsClient(ClientConfiguration clientConfiguration) { this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified AWS account * credentials. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#withCredentials(AWSCredentialsProvider)} for example: * {@code AmazonDynamoDBStreamsClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();} */ @Deprecated public AmazonDynamoDBStreamsClient(AWSCredentials awsCredentials) { this(awsCredentials, configFactory.getConfig()); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified AWS account * credentials and client configuration options. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon DynamoDB Streams (ex: * proxy settings, retry counts, etc.). * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBStreamsClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonDynamoDBStreamsClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) { super(clientConfiguration); this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials); this.advancedConfig = AdvancedConfig.EMPTY; init(); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified AWS account * credentials provider. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonDynamoDBStreamsClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, configFactory.getConfig()); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified AWS account * credentials provider and client configuration options. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon DynamoDB Streams (ex: * proxy settings, retry counts, etc.). * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBStreamsClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonDynamoDBStreamsClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, null); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified AWS account * credentials provider, client configuration options, and request metric collector. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon DynamoDB Streams (ex: * proxy settings, retry counts, etc.). * @param requestMetricCollector * optional request metric collector * @deprecated use {@link AmazonDynamoDBStreamsClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBStreamsClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonDynamoDBStreamsClientBuilder#withMetricsCollector(RequestMetricCollector)} */ @Deprecated public AmazonDynamoDBStreamsClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) { super(clientConfiguration, requestMetricCollector); this.awsCredentialsProvider = awsCredentialsProvider; this.advancedConfig = AdvancedConfig.EMPTY; init(); } public static AmazonDynamoDBStreamsClientBuilder builder() { return AmazonDynamoDBStreamsClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified parameters. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AmazonDynamoDBStreamsClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on Amazon DynamoDB Streams using the specified parameters. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AmazonDynamoDBStreamsClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("https://streams.dynamodb.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/dynamodbv2/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/dynamodbv2/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *

* Returns information about a stream, including the current status of the stream, its Amazon Resource Name (ARN), * the composition of its shards, and its corresponding DynamoDB table. *

* *

* You can call DescribeStream at a maximum rate of 10 times per second. *

*
*

* Each shard in the stream has a SequenceNumberRange associated with it. If the * SequenceNumberRange has a StartingSequenceNumber but no * EndingSequenceNumber, then the shard is still open (able to receive more stream records). If both * StartingSequenceNumber and EndingSequenceNumber are present, then that shard is closed * and can no longer receive more data. *

* * @param describeStreamRequest * Represents the input of a DescribeStream operation. * @return Result of the DescribeStream operation returned by the service. * @throws ResourceNotFoundException * The operation tried to access a nonexistent table or index. The resource might not be specified * correctly, or its status might not be ACTIVE. * @throws InternalServerErrorException * An error occurred on the server side. * @sample AmazonDynamoDBStreams.DescribeStream * @see AWS API Documentation */ @Override public DescribeStreamResult describeStream(DescribeStreamRequest request) { request = beforeClientExecution(request); return executeDescribeStream(request); } @SdkInternalApi final DescribeStreamResult executeDescribeStream(DescribeStreamRequest describeStreamRequest) { ExecutionContext executionContext = createExecutionContext(describeStreamRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new DescribeStreamRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeStreamRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DynamoDB Streams"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeStream"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeStreamResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Retrieves the stream records from a given shard. *

*

* Specify a shard iterator using the ShardIterator parameter. The shard iterator specifies the * position in the shard from which you want to start reading stream records sequentially. If there are no stream * records available in the portion of the shard that the iterator points to, GetRecords returns an * empty list. Note that it might take multiple calls to get to a portion of the shard that contains stream records. *

* *

* GetRecords can retrieve a maximum of 1 MB of data or 1000 stream records, whichever comes first. *

*
* * @param getRecordsRequest * Represents the input of a GetRecords operation. * @return Result of the GetRecords operation returned by the service. * @throws ResourceNotFoundException * The operation tried to access a nonexistent table or index. The resource might not be specified * correctly, or its status might not be ACTIVE. * @throws LimitExceededException * There is no limit to the number of daily on-demand backups that can be taken.

*

* For most purposes, up to 500 simultaneous table operations are allowed per account. These operations * include CreateTable, UpdateTable, DeleteTable, * UpdateTimeToLive, RestoreTableFromBackup, and * RestoreTableToPointInTime. *

*

* When you are creating a table with one or more secondary indexes, you can have up to 250 such requests * running at a time. However, if the table or index specifications are complex, then DynamoDB might * temporarily reduce the number of concurrent operations. *

*

* When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account. *

*

* There is a soft account quota of 2,500 tables. *

*

* GetRecords was called with a value of more than 1000 for the limit request parameter. *

*

* More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may * result in request throttling. * @throws InternalServerErrorException * An error occurred on the server side. * @throws ExpiredIteratorException * The shard iterator has expired and can no longer be used to retrieve stream records. A shard iterator * expires 15 minutes after it is retrieved using the GetShardIterator action. * @throws TrimmedDataAccessException * The operation attempted to read past the oldest stream record in a shard. *

*

* In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this * limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException * if: *

*
    *
  • *

    * You request a shard iterator with a sequence number older than the trim point (24 hours). *

    *
  • *
  • *

    * You obtain a shard iterator, but before you use the iterator in a GetRecords request, a * stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access * a record that no longer exists. *

    *
  • * @sample AmazonDynamoDBStreams.GetRecords * @see AWS * API Documentation */ @Override public GetRecordsResult getRecords(GetRecordsRequest request) { request = beforeClientExecution(request); return executeGetRecords(request); } @SdkInternalApi final GetRecordsResult executeGetRecords(GetRecordsRequest getRecordsRequest) { ExecutionContext executionContext = createExecutionContext(getRecordsRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetRecordsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getRecordsRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DynamoDB Streams"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRecords"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata() .withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetRecordsResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

    * Returns a shard iterator. A shard iterator provides information about how to retrieve the stream records from * within a shard. Use the shard iterator in a subsequent GetRecords request to read the stream records * from the shard. *

    * *

    * A shard iterator expires 15 minutes after it is returned to the requester. *

    *
    * * @param getShardIteratorRequest * Represents the input of a GetShardIterator operation. * @return Result of the GetShardIterator operation returned by the service. * @throws ResourceNotFoundException * The operation tried to access a nonexistent table or index. The resource might not be specified * correctly, or its status might not be ACTIVE. * @throws InternalServerErrorException * An error occurred on the server side. * @throws TrimmedDataAccessException * The operation attempted to read past the oldest stream record in a shard.

    *

    * In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this * limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException * if: *

    *
      *
    • *

      * You request a shard iterator with a sequence number older than the trim point (24 hours). *

      *
    • *
    • *

      * You obtain a shard iterator, but before you use the iterator in a GetRecords request, a * stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access * a record that no longer exists. *

      *
    • * @sample AmazonDynamoDBStreams.GetShardIterator * @see AWS API Documentation */ @Override public GetShardIteratorResult getShardIterator(GetShardIteratorRequest request) { request = beforeClientExecution(request); return executeGetShardIterator(request); } @SdkInternalApi final GetShardIteratorResult executeGetShardIterator(GetShardIteratorRequest getShardIteratorRequest) { ExecutionContext executionContext = createExecutionContext(getShardIteratorRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetShardIteratorRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getShardIteratorRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DynamoDB Streams"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetShardIterator"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetShardIteratorResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

      * Returns an array of stream ARNs associated with the current account and endpoint. If the TableName * parameter is present, then ListStreams will return only the streams ARNs for that table. *

      * *

      * You can call ListStreams at a maximum rate of 5 times per second. *

      *
      * * @param listStreamsRequest * Represents the input of a ListStreams operation. * @return Result of the ListStreams operation returned by the service. * @throws ResourceNotFoundException * The operation tried to access a nonexistent table or index. The resource might not be specified * correctly, or its status might not be ACTIVE. * @throws InternalServerErrorException * An error occurred on the server side. * @sample AmazonDynamoDBStreams.ListStreams * @see AWS * API Documentation */ @Override public ListStreamsResult listStreams(ListStreamsRequest request) { request = beforeClientExecution(request); return executeListStreams(request); } @SdkInternalApi final ListStreamsResult executeListStreams(ListStreamsRequest listStreamsRequest) { ExecutionContext executionContext = createExecutionContext(listStreamsRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new ListStreamsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listStreamsRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DynamoDB Streams"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListStreams"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListStreamsResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * Returns additional metadata for a previously executed successful, request, typically used for debugging issues * where a service isn't acting as expected. This data isn't considered part of the result data returned by an * operation, so it's available through this separate, diagnostic interface. *

      * Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic * information for an executed request, you should use this method to retrieve it as soon as possible after * executing the request. * * @param request * The originally executed request * * @return The response metadata for the specified request, or null if none is available. */ public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return client.getResponseMetadataForRequest(request); } /** * Normal invoke with authentication. Credentials are required and may be overriden at the request level. **/ private Response invoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext) { return invoke(request, responseHandler, executionContext, null, null); } /** * Normal invoke with authentication. Credentials are required and may be overriden at the request level. **/ private Response invoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) { executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider)); return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait); } /** * Invoke with no authentication. Credentials are not required and any credentials set on the client or request will * be ignored for this operation. **/ private Response anonymousInvoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext) { return doInvoke(request, responseHandler, executionContext, null, null); } /** * Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the * ExecutionContext beforehand. **/ private Response doInvoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) { if (discoveredEndpoint != null) { request.setEndpoint(discoveredEndpoint); request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery"); } else if (uriFromEndpointTrait != null) { request.setEndpoint(uriFromEndpointTrait); } else { request.setEndpoint(endpoint); } request.setTimeOffset(timeOffset); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata()); return client.execute(request, responseHandler, errorResponseHandler, executionContext); } @com.amazonaws.annotation.SdkInternalApi static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() { return protocolFactory; } @Override public void shutdown() { super.shutdown(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy