Class S3ClientFactory
java.lang.Object
com.kingsrook.qqq.backend.module.filesystem.s3.utils.S3ClientFactory
Builds (and caches) AWS SDK v2 S3 clients from S3BackendMetaData.
One client is kept per distinct set of connection settings, because SDK v2
clients own an HTTP connection pool and are meant to be long-lived and shared.
The cache key is a SHA-256 hash of the settings, so no secret is held in a
map key or a log line.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic software.amazon.awssdk.services.s3.S3ClientbuildClient(S3BackendMetaData backendMetaData) Build a new (uncached) client.static voidClose and forget every cached client (e.g., after credentials rotate, or between tests).static software.amazon.awssdk.services.s3.S3ClientgetClient(S3BackendMetaData backendMetaData) Get the shared client for a backend's connection settings, building it on first use.static S3ChecksumModegetEffectiveChecksumMode(S3BackendMetaData backendMetaData) The checksum mode a backend actually uses: its explicit setting, else WHEN_REQUIRED for a custom endpoint (S3-compatible stores), else the SDK default, WHEN_SUPPORTED (AWS).static IntegergetEffectiveMaxListedObjects(S3BackendMetaData backendMetaData) The listing cap a backend actually uses: null means the default; zero or negative means no cap (returned as null).
-
Field Details
-
DEFAULT_MAX_LISTED_OBJECTS
public static final int DEFAULT_MAX_LISTED_OBJECTS- See Also:
-
DEFAULT_CONNECT_TIMEOUT
-
DEFAULT_SOCKET_TIMEOUT
-
-
Method Details
-
getClient
public static software.amazon.awssdk.services.s3.S3Client getClient(S3BackendMetaData backendMetaData) Get the shared client for a backend's connection settings, building it on first use. The client is shared: callers must not close it (use clearCache() to close all cached clients). -
buildClient
public static software.amazon.awssdk.services.s3.S3Client buildClient(S3BackendMetaData backendMetaData) Build a new (uncached) client. Callers own it, and should close it. -
getEffectiveChecksumMode
The checksum mode a backend actually uses: its explicit setting, else WHEN_REQUIRED for a custom endpoint (S3-compatible stores), else the SDK default, WHEN_SUPPORTED (AWS). -
getEffectiveMaxListedObjects
The listing cap a backend actually uses: null means the default; zero or negative means no cap (returned as null). -
clearCache
public static void clearCache()Close and forget every cached client (e.g., after credentials rotate, or between tests).
-