steveloughran commented on a change in pull request #3848: NIFI-6762: Submit 
new List Processor - ListMultipleS3Buckets
URL: https://github.com/apache/nifi/pull/3848#discussion_r374670895
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/S3ObjectBucketLister.java
 ##########
 @@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.aws.s3;
+
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.model.ListObjectsRequest;
+import com.amazonaws.services.s3.model.ObjectListing;
+import com.amazonaws.services.s3.model.S3ObjectSummary;
+import com.amazonaws.services.s3.model.S3VersionSummary;
+import com.amazonaws.services.s3.model.VersionListing;
+
+public class S3ObjectBucketLister implements S3BucketLister {
+    private AmazonS3 client;
+    private ListObjectsRequest listObjectsRequest;
+    private ObjectListing objectListing;
+
+    public S3ObjectBucketLister(AmazonS3 client) {
+        this.client = client;
+    }
+
+    @Override
+    public void setBucketName(String bucketName) {
+        listObjectsRequest = new 
ListObjectsRequest().withBucketName(bucketName);
+    }
+
+    @Override
+    public void setPrefix(String prefix) {
+        listObjectsRequest.setPrefix(prefix);
+    }
+
+    @Override
+    public void setDelimiter(String delimiter) {
+        listObjectsRequest.setDelimiter(delimiter);
+    }
+
+    @Override
+    public void setRequesterPays(boolean requesterPays) {
+        listObjectsRequest.setRequesterPays(requesterPays);
+    }
+
+    @Override
+    public VersionListing listVersions() {
+        VersionListing versionListing = new VersionListing();
+        this.objectListing = client.listObjects(listObjectsRequest);
 
 Review comment:
   v2 should be used if possible; more efficient and handles versioned buckets 
with many tombstones better

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to