jackye1995 commented on code in PR #7562:
URL: https://github.com/apache/iceberg/pull/7562#discussion_r1189103004


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java:
##########
@@ -650,4 +663,71 @@ private Set<Tag> toS3Tags(Map<String, String> properties, 
String prefix) {
   private boolean keyIdAccessKeyBothConfigured() {
     return (accessKeyId == null) == (secretAccessKey == null);
   }
+
+  public <T extends S3ClientBuilder> void applyCredentialConfigurations(
+      AwsClientProperties awsClientProperties, T builder) {
+    builder.credentialsProvider(
+        isRemoteSigningEnabled
+            ? AnonymousCredentialsProvider.create()
+            : awsClientProperties.credentialsProvider(accessKeyId, 
secretAccessKey, sessionToken));
+  }
+
+  /**
+   * Configure services settings for an S3 client. The settings include: 
s3DualStack,
+   * s3UseArnRegion, s3PathStyleAccess, and s3Acceleration
+   *
+   * <p>Sample usage:
+   *
+   * <pre>
+   *     
S3Client.builder().applyMutation(s3FileIOProperties::applyS3ServiceConfigurations)
+   * </pre>
+   */
+  public <T extends S3ClientBuilder> void applyServiceConfigurations(T 
builder) {
+    builder
+        .dualstackEnabled(isDualStackEnabled)
+        .serviceConfiguration(
+            S3Configuration.builder()
+                .pathStyleAccessEnabled(isPathStyleAccess)
+                .useArnRegionEnabled(isUseArnRegionEnabled)
+                .accelerateModeEnabled(isAccelerationEnabled)
+                .build());
+  }
+
+  /**
+   * Configure a signer for an S3 client.
+   *
+   * <p>Sample usage:
+   *
+   * <pre>
+   *     
S3Client.builder().applyMutation(s3FileIOProperties::applyS3SignerConfiguration)
+   * </pre>
+   */
+  public <T extends S3ClientBuilder> void applySignerConfiguration(T builder) {
+    if (isRemoteSigningEnabled) {
+      builder.overrideConfiguration(
+          c ->
+              c.putAdvancedOption(
+                  SdkAdvancedClientOption.SIGNER, 
S3V4RestSignerClient.create(allProperties)));
+    }
+  }
+
+  /**
+   * Override the endpoint for an S3 client.
+   *
+   * <p>Sample usage:
+   *
+   * <pre>
+   *     
S3Client.builder().applyMutation(awsProperties::applyS3EndpointConfigurations)
+   * </pre>
+   */
+  public <T extends S3ClientBuilder> void applyEndpointConfigurations(T 
builder) {
+    configureEndpoint(builder, endpoint);
+  }
+
+  @SuppressWarnings("checkstyle:HiddenField")
+  private <T extends SdkClientBuilder> void configureEndpoint(T builder, 
String endpoint) {

Review Comment:
   can we just merge this method to `applyEndpointConfigurations`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to