You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ru...@apache.org on 2025/05/29 17:51:19 UTC
(iceberg) branch main updated: AWS: Configure Default s3Async credentials the same as s3 (#13132)
This is an automated email from the ASF dual-hosted git repository.
russellspitzer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new a8b42450d1 AWS: Configure Default s3Async credentials the same as s3 (#13132)
a8b42450d1 is described below
commit a8b42450d17df355c05554b38e4821f2de1d8eab
Author: Devin Smith <de...@deephaven.io>
AuthorDate: Thu May 29 10:51:14 2025 -0700
AWS: Configure Default s3Async credentials the same as s3 (#13132)
---
.../org/apache/iceberg/aws/AwsClientFactories.java | 6 ++++--
.../apache/iceberg/aws/s3/S3FileIOProperties.java | 20 +++++++++++++++-----
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/aws/src/main/java/org/apache/iceberg/aws/AwsClientFactories.java b/aws/src/main/java/org/apache/iceberg/aws/AwsClientFactories.java
index 90ccd522fd..9dab7b6df6 100644
--- a/aws/src/main/java/org/apache/iceberg/aws/AwsClientFactories.java
+++ b/aws/src/main/java/org/apache/iceberg/aws/AwsClientFactories.java
@@ -124,14 +124,16 @@ public class AwsClientFactories {
if (s3FileIOProperties.isS3CRTEnabled()) {
return S3AsyncClient.crtBuilder()
.applyMutation(awsClientProperties::applyClientRegionConfiguration)
- .applyMutation(awsClientProperties::applyClientCredentialConfigurations)
+ .applyMutation(
+ b -> s3FileIOProperties.applyCredentialConfigurations(awsClientProperties, b))
.applyMutation(s3FileIOProperties::applyEndpointConfigurations)
.applyMutation(s3FileIOProperties::applyS3CrtConfigurations)
.build();
}
return S3AsyncClient.builder()
.applyMutation(awsClientProperties::applyClientRegionConfiguration)
- .applyMutation(awsClientProperties::applyClientCredentialConfigurations)
+ .applyMutation(
+ b -> s3FileIOProperties.applyCredentialConfigurations(awsClientProperties, b))
.applyMutation(s3FileIOProperties::applyEndpointConfigurations)
.build();
}
diff --git a/aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java b/aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java
index 928118346f..3024ff5bcb 100644
--- a/aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java
+++ b/aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java
@@ -38,6 +38,7 @@ import org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.apache.iceberg.util.PropertyUtil;
import org.apache.iceberg.util.SerializableMap;
import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkAdvancedClientOption;
import software.amazon.awssdk.core.exception.SdkServiceException;
@@ -49,6 +50,7 @@ import software.amazon.awssdk.core.retry.conditions.RetryCondition;
import software.amazon.awssdk.core.retry.conditions.RetryOnExceptionsCondition;
import software.amazon.awssdk.core.retry.conditions.TokenBucketRetryCondition;
import software.amazon.awssdk.services.s3.S3AsyncClientBuilder;
+import software.amazon.awssdk.services.s3.S3BaseClientBuilder;
import software.amazon.awssdk.services.s3.S3ClientBuilder;
import software.amazon.awssdk.services.s3.S3Configuration;
import software.amazon.awssdk.services.s3.S3CrtAsyncClientBuilder;
@@ -958,12 +960,20 @@ public class S3FileIOProperties implements Serializable {
return (accessKeyId == null) == (secretAccessKey == null);
}
- public <T extends S3ClientBuilder> void applyCredentialConfigurations(
+ public <T extends S3BaseClientBuilder<T, ?>> void applyCredentialConfigurations(
AwsClientProperties awsClientProperties, T builder) {
- builder.credentialsProvider(
- isRemoteSigningEnabled
- ? AnonymousCredentialsProvider.create()
- : awsClientProperties.credentialsProvider(accessKeyId, secretAccessKey, sessionToken));
+ builder.credentialsProvider(getCredentialsProvider(awsClientProperties));
+ }
+
+ public <T extends S3CrtAsyncClientBuilder> void applyCredentialConfigurations(
+ AwsClientProperties awsClientProperties, T builder) {
+ builder.credentialsProvider(getCredentialsProvider(awsClientProperties));
+ }
+
+ private AwsCredentialsProvider getCredentialsProvider(AwsClientProperties awsClientProperties) {
+ return isRemoteSigningEnabled
+ ? AnonymousCredentialsProvider.create()
+ : awsClientProperties.credentialsProvider(accessKeyId, secretAccessKey, sessionToken);
}
/**