[nifi] branch support/nifi-1.x updated: NIFI-12028 - Add s3.region attribute to ListS3 generated flow files
This is an automated email from the ASF dual-hosted git repository. mthomsen pushed a commit to branch support/nifi-1.x in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/support/nifi-1.x by this push: new 5be76cddde NIFI-12028 - Add s3.region attribute to ListS3 generated flow files 5be76cddde is described below commit 5be76cdddef928744ee2c41f90955d4c372961f6 Author: Pierre Villard AuthorDate: Fri Sep 8 13:01:33 2023 +0200 NIFI-12028 - Add s3.region attribute to ListS3 generated flow files This closes #7672 Signed-off-by: Mike Thomsen --- .../org/apache/nifi/processors/aws/s3/ListS3.java | 21 + .../apache/nifi/processors/aws/s3/TestListS3.java | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java index 954bfa0856..b90ad3babf 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java @@ -116,6 +116,7 @@ import java.util.stream.Collectors; + "Node is selected, the new node can pick up where the previous node left off, without duplicating the data.") @WritesAttributes({ @WritesAttribute(attribute = "s3.bucket", description = "The name of the S3 bucket"), +@WritesAttribute(attribute = "s3.region", description = "The region of the S3 bucket"), @WritesAttribute(attribute = "filename", description = "The name of the file"), @WritesAttribute(attribute = "s3.etag", description = "The ETag that can be used to see if the file has changed"), @WritesAttribute(attribute = "s3.isLatest", description = "A boolean indicating if this is the latest version of the object"), @@ -499,7 +500,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { if (writerFactory == null) { writer = new AttributeObjectWriter(session); } else { -writer = new RecordObjectWriter(session, writerFactory, getLogger()); +writer = new RecordObjectWriter(session, writerFactory, getLogger(), context.getProperty(S3_REGION).getValue()); } try { @@ -523,7 +524,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { ObjectMetadata objectMetadata = getObjectMetadata(context, client, versionSummary); // Write the entity to the listing -writer.addToListing(versionSummary, taggingResult, objectMetadata); +writer.addToListing(versionSummary, taggingResult, objectMetadata, context.getProperty(S3_REGION).getValue()); // Track the latest lastModified timestamp and keys having that timestamp. // NOTE: Amazon S3 lists objects in UTF-8 character encoding in lexicographical order. Not ordered by timestamps. @@ -633,7 +634,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { if (writerFactory == null) { writer = new AttributeObjectWriter(session); } else { -writer = new RecordObjectWriter(session, writerFactory, getLogger()); +writer = new RecordObjectWriter(session, writerFactory, getLogger(), context.getProperty(S3_REGION).getValue()); } try { @@ -648,7 +649,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { GetObjectTaggingResult taggingResult = getTaggingResult(context, s3Client, s3VersionSummary); ObjectMetadata objectMetadata = getObjectMetadata(context, s3Client, s3VersionSummary); -writer.addToListing(s3VersionSummary, taggingResult, objectMetadata); +writer.addToListing(s3VersionSummary, taggingResult, objectMetadata, context.getProperty(S3_REGION).getValue()); listCount++; @@ -910,7 +911,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { interface S3ObjectWriter { void beginListing() throws IOException, SchemaNotFoundException; -void addToListing(S3VersionSummary summary, GetObjectTaggingResult taggingResult, ObjectMetadata objectMetadata) throws IOException; +void addToListing(S3VersionSummary summary, GetObjectTaggingResult taggingResult, ObjectMetadata objectMetadata, String region) throws IOException; void finishListing() throws IOException; @@ -957,11 +958,13 @@ public class ListS3 extends AbstractS3Processor implements
[nifi] branch main updated: NIFI-12028 - Add s3.region attribute to ListS3 generated flow files
This is an automated email from the ASF dual-hosted git repository. mthomsen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/main by this push: new 47f4c8ce2e NIFI-12028 - Add s3.region attribute to ListS3 generated flow files 47f4c8ce2e is described below commit 47f4c8ce2e0b1ec5fa176cb44a94e64dce354fa0 Author: Pierre Villard AuthorDate: Fri Sep 8 13:01:33 2023 +0200 NIFI-12028 - Add s3.region attribute to ListS3 generated flow files This closes #7672 Signed-off-by: Mike Thomsen --- .../org/apache/nifi/processors/aws/s3/ListS3.java | 21 + .../apache/nifi/processors/aws/s3/TestListS3.java | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java index 0f51b73317..5a1649814e 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java @@ -116,6 +116,7 @@ import java.util.stream.Collectors; + "Node is selected, the new node can pick up where the previous node left off, without duplicating the data.") @WritesAttributes({ @WritesAttribute(attribute = "s3.bucket", description = "The name of the S3 bucket"), +@WritesAttribute(attribute = "s3.region", description = "The region of the S3 bucket"), @WritesAttribute(attribute = "filename", description = "The name of the file"), @WritesAttribute(attribute = "s3.etag", description = "The ETag that can be used to see if the file has changed"), @WritesAttribute(attribute = "s3.isLatest", description = "A boolean indicating if this is the latest version of the object"), @@ -499,7 +500,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { if (writerFactory == null) { writer = new AttributeObjectWriter(session); } else { -writer = new RecordObjectWriter(session, writerFactory, getLogger()); +writer = new RecordObjectWriter(session, writerFactory, getLogger(), context.getProperty(S3_REGION).getValue()); } try { @@ -523,7 +524,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { ObjectMetadata objectMetadata = getObjectMetadata(context, client, versionSummary); // Write the entity to the listing -writer.addToListing(versionSummary, taggingResult, objectMetadata); +writer.addToListing(versionSummary, taggingResult, objectMetadata, context.getProperty(S3_REGION).getValue()); // Track the latest lastModified timestamp and keys having that timestamp. // NOTE: Amazon S3 lists objects in UTF-8 character encoding in lexicographical order. Not ordered by timestamps. @@ -633,7 +634,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { if (writerFactory == null) { writer = new AttributeObjectWriter(session); } else { -writer = new RecordObjectWriter(session, writerFactory, getLogger()); +writer = new RecordObjectWriter(session, writerFactory, getLogger(), context.getProperty(S3_REGION).getValue()); } try { @@ -648,7 +649,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { GetObjectTaggingResult taggingResult = getTaggingResult(context, s3Client, s3VersionSummary); ObjectMetadata objectMetadata = getObjectMetadata(context, s3Client, s3VersionSummary); -writer.addToListing(s3VersionSummary, taggingResult, objectMetadata); +writer.addToListing(s3VersionSummary, taggingResult, objectMetadata, context.getProperty(S3_REGION).getValue()); listCount++; @@ -910,7 +911,7 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor { interface S3ObjectWriter { void beginListing() throws IOException, SchemaNotFoundException; -void addToListing(S3VersionSummary summary, GetObjectTaggingResult taggingResult, ObjectMetadata objectMetadata) throws IOException; +void addToListing(S3VersionSummary summary, GetObjectTaggingResult taggingResult, ObjectMetadata objectMetadata, String region) throws IOException; void finishListing() throws IOException; @@ -957,11 +958,13 @@ public class ListS3 extends AbstractS3Processor implements VerifiableProcessor {