gnodet-bot commented on code in PR #31262:
URL: https://github.com/apache/camel/pull/31262#discussion_r4770614916


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Constants.java:
##########
@@ -218,6 +218,22 @@ The canned ACL to apply to the uploaded object, and the 
one that the putObjectAc
                             + " contain it after the prefix are grouped into 
common prefixes and not listed as objects.",
               javaType = "String")
     String DELIMITER = "CamelAwsS3Delimiter";
+    @Metadata(label = "producer",
+              description = "The continuation token of the listObjects and 
listBuckets operations. Set it to list the page"
+                            + " that follows the one a previous call returned. 
The producer sets it after the operation to"
+                            + " the token of the next page, and removes it 
when the page is the last one.",
+              javaType = "String")
+    String CONTINUATION_TOKEN = "CamelAwsS3ContinuationToken";
+    @Metadata(label = "producer",
+              description = "The maximum number of objects that one 
listObjects call returns, or of buckets that one"
+                            + " listBuckets call returns. Amazon S3 caps it at 
1000, which is also the default.",
+              javaType = "Integer")
+    String MAX_KEYS = "CamelAwsS3MaxKeys";

Review Comment:
   ⚠️ **Incorrect cap in the `MAX_KEYS` description.**
   
   The description says `Amazon S3 caps it at 1000, which is also the default` 
— but that's only true for `listObjects`. For `listBuckets` the AWS API 
(`max-buckets`) allows up to **10,000** and defaults to 10,000 when pagination 
parameters are used.
   
   ```suggestion
                 description = "The maximum number of objects that one 
listObjects call returns, or of buckets that one"
                               + " listBuckets call returns. For listObjects, 
Amazon S3 caps it at 1,000 (also the default);"
                               + " for listBuckets, Amazon S3 caps it at 10,000 
(also the default).",
   ```



##########
components/camel-aws/camel-aws2-s3/src/main/docs/aws2-s3-producer-operations.adoc:
##########
@@ -186,6 +187,29 @@ and the key from the `keyName` option, unless the 
`CamelAwsS3Key` header is set.
 
 This section covers operations that require special configuration beyond the 
common pattern.
 
+[[listPaging]]
+=== Paging listObjects and listBuckets
+
+Amazon S3 answers `listObjects` and `listBuckets` one page at a time, at most 
1000 entries per page. Set
+`CamelAwsS3MaxKeys` to ask for a smaller page. When more entries follow, the 
producer sets
+`CamelAwsS3IsTruncated` to `true` and `CamelAwsS3ContinuationToken` to the 
token of the next page; send that token
+back in `CamelAwsS3ContinuationToken` to read on. On the last page the 
producer sets `CamelAwsS3IsTruncated` to
+`false` and **removes** `CamelAwsS3ContinuationToken`, so a route that loops 
while the header is present stops by
+itself.
+
+[source,java]
+----
+from("direct:listAll")
+    
.loopDoWhile(header(AWS2S3Constants.CONTINUATION_TOKEN).isNotNull().or(exchangeProperty("firstPass").isNull()))
+        .setProperty("firstPass", constant(false))
+        .to("aws2-s3://mybucket?operation=listObjects")
+        .log("got ${body.size()} objects, more: 
${header.CamelAwsS3IsTruncated}")
+    .end();
+----
+
+In POJO mode the token is read from the `ListObjectsV2Request` body, and the 
producer still sets the two headers on
+the answer.
+
 [[uploadObject]]

Review Comment:
   ⚠️ **Inaccurate cap for `listBuckets`.**
   
   The sentence `at most 1000 entries per page` applies to `listObjects` (AWS 
S3 `ListObjectsV2` hard-caps at 1,000), but **not** to `listBuckets`: the AWS 
S3 `ListBuckets` API accepts `max-buckets` in the range 1–10,000 and defaults 
to 10,000.
   
   Consider splitting the note or correcting the cap:
   
   ```suggestion
   Amazon S3 answers `listObjects` one page at a time, at most 1,000 entries 
per page, and `listBuckets` at most 10,000 buckets per page. Set
   ```



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

Reply via email to