ivandika3 commented on code in PR #10408:
URL: https://github.com/apache/ozone/pull/10408#discussion_r3355332181


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/RootEndpoint.java:
##########
@@ -48,6 +58,101 @@ public class RootEndpoint extends EndpointBase {
   @GET
   public Response get()
       throws OS3Exception, IOException {
+    if (isListDirectoryBucketsRequest()) {
+      return listDirectoryBuckets();
+    }
+    return listAllBuckets();
+  }
+
+  private boolean isListDirectoryBucketsRequest() {
+    return queryParams().get(QueryParams.MAX_DIRECTORY_BUCKETS) != null
+        || queryParams().get(QueryParams.CONTINUATION_TOKEN) != null

Review Comment:
   CONTINUATION_TOKEN exists for both normal listBuckets and 
listDirectoryBuckets, so it should not be used identify a 
listDirectoryBucketsREquest.



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/RootEndpoint.java:
##########
@@ -48,6 +58,101 @@ public class RootEndpoint extends EndpointBase {
   @GET
   public Response get()
       throws OS3Exception, IOException {
+    if (isListDirectoryBucketsRequest()) {
+      return listDirectoryBuckets();
+    }
+    return listAllBuckets();
+  }
+
+  private boolean isListDirectoryBucketsRequest() {
+    return queryParams().get(QueryParams.MAX_DIRECTORY_BUCKETS) != null
+        || queryParams().get(QueryParams.CONTINUATION_TOKEN) != null
+        || isS3ExpressSignedRequest();
+  }
+
+  private boolean isS3ExpressSignedRequest() {
+    if (signatureInfo == null) {
+      return false;
+    }
+    String credentialScope = signatureInfo.getCredentialScope();
+    if (credentialScope == null || credentialScope.isEmpty()) {
+      return false;
+    }
+    String[] parts = credentialScope.split("/");
+    return parts.length >= 3 && S3_EXPRESS_SERVICE.equals(parts[2]);
+  }

Review Comment:
   Is this specified in the AWS S3 API docs?



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