Class S3ClientCache
java.lang.Object
com.amazonaws.services.dynamodbv2.datamodeling.S3ClientCache
A smart Map for
AmazonS3 objects. S3ClientCache keeps the
clients organized by region, and if provided AWSCredentials will
create clients on the fly. Otherwise it just return clients given to it with
useClient(AmazonS3).-
Method Summary
Modifier and TypeMethodDescriptionReturns a client for the requested region, or throws an exception when unable.getTransferManager(Region region) Returns aTransferManagerfor the given region, or throws an exception when unable.voidForce the client cache to provide a certain client for the region which that client is configured.
-
Method Details
-
useClient
Force the client cache to provide a certain client for the region which that client is configured. This can be useful to provide clients with differentS3ClientOptionsor use aAmazonS3EncryptionClientin place of a regular client. Using a new client will also forcibly shut down anyTransferManagerthat has been instantiated with that client, with theTransferManager.shutdownNow()method.- Parameters:
client- AnAmazonS3to use in the cache. Its region will be detected automatically.
-
getClient
Returns a client for the requested region, or throws an exception when unable.- Parameters:
s3region- The region the returnedAmazonS3will be configured to use.- Returns:
- A client for the given region from the cache, either instantiated
automatically from the provided
AWSCredentialsor provided withuseClient(AmazonS3). - Throws:
IllegalArgumentException- When a region is requested that has not been provided to the cache withuseClient(AmazonS3), and the cache has noAWSCredentialswith which a client may be instantiated.
-
getTransferManager
Returns aTransferManagerfor the given region, or throws an exception when unable. The returnedTransferManagerwill always be instantiated from whateverAmazonS3is in the cache, whether provided withuseClient(AmazonS3)or instantiated automatically fromAWSCredentials. AnyTransferManagerreturned could be shut down if a new underlyingAmazonS3is provided withuseClient(AmazonS3).- Parameters:
region- The region the returnedTransferManagerwill be configured to use.- Returns:
- A transfer manager for the given region from the cache, or one
instantiated automatically from any existing
AmazonS3,
-