adnanhemani commented on code in PR #6544:
URL: https://github.com/apache/hadoop/pull/6544#discussion_r1484848907


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/DefaultS3ClientFactory.java:
##########
@@ -401,4 +411,19 @@ private static Region getS3RegionFromEndpoint(final String 
endpoint,
     return Region.of(AWS_S3_DEFAULT_REGION);
   }
 
+  private static <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, 
ClientT> void
+      applyS3AccessGrantsConfigurations(BuilderT builder, Configuration conf) {
+    if (!conf.getBoolean(AWS_S3_ACCESS_GRANTS_ENABLED, false)){
+      LOG_S3AG_ENABLED.debug("S3 Access Grants plugin is not enabled.");
+      return;
+    }
+
+    LOG_S3AG_ENABLED.info("S3 Access Grants plugin is enabled.");
+    boolean isFallbackEnabled = 
conf.getBoolean(AWS_S3_ACCESS_GRANTS_FALLBACK_TO_IAM_ENABLED, false);
+    S3AccessGrantsPlugin accessGrantsPlugin =
+            
S3AccessGrantsPlugin.builder().enableFallback(isFallbackEnabled).build();
+    builder.addPlugin(accessGrantsPlugin);
+    LOG_S3AG_ENABLED.info("S3 Access Grants plugin is added to S3 client with 
fallback: {}", isFallbackEnabled);

Review Comment:
   Good catch, change.



##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/DefaultS3ClientFactory.java:
##########
@@ -401,4 +411,19 @@ private static Region getS3RegionFromEndpoint(final String 
endpoint,
     return Region.of(AWS_S3_DEFAULT_REGION);
   }
 
+  private static <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, 
ClientT> void
+      applyS3AccessGrantsConfigurations(BuilderT builder, Configuration conf) {
+    if (!conf.getBoolean(AWS_S3_ACCESS_GRANTS_ENABLED, false)){
+      LOG_S3AG_ENABLED.debug("S3 Access Grants plugin is not enabled.");
+      return;
+    }
+
+    LOG_S3AG_ENABLED.info("S3 Access Grants plugin is enabled.");
+    boolean isFallbackEnabled = 
conf.getBoolean(AWS_S3_ACCESS_GRANTS_FALLBACK_TO_IAM_ENABLED, false);
+    S3AccessGrantsPlugin accessGrantsPlugin =
+            
S3AccessGrantsPlugin.builder().enableFallback(isFallbackEnabled).build();
+    builder.addPlugin(accessGrantsPlugin);
+    LOG_S3AG_ENABLED.info("S3 Access Grants plugin is added to S3 client with 
fallback: {}", isFallbackEnabled);

Review Comment:
   Good catch, changed.



-- 
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