Re: [PR] NIFI-12643 Added support for FileResourceService in PutGCSObject [nifi]

2024-01-26 Thread via GitHub


asfgit closed pull request #8281: NIFI-12643 Added support for 
FileResourceService in PutGCSObject
URL: https://github.com/apache/nifi/pull/8281


-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12643 Added support for FileResourceService in PutGCSObject [nifi]

2024-01-25 Thread via GitHub


turcsanyip commented on code in PR #8281:
URL: https://github.com/apache/nifi/pull/8281#discussion_r1466618437


##
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java:
##
@@ -322,199 +328,196 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
 return;
 }
 
-final long startNanos = System.nanoTime();
+try {
+final long startNanos = System.nanoTime();
+
+final String bucket = context.getProperty(BUCKET)
+.evaluateAttributeExpressions(flowFile)
+.getValue();
+final String key = context.getProperty(KEY)
+.evaluateAttributeExpressions(flowFile)
+.getValue();
+final boolean overwrite = 
context.getProperty(OVERWRITE).asBoolean();
+
+final FlowFile ff = flowFile;
+final String ffFilename = 
ff.getAttributes().get(CoreAttributes.FILENAME.key());
+final Map attributes = new HashMap<>();
+final ResourceTransferSource resourceTransferSource = 
ResourceTransferSource.valueOf(context.getProperty(RESOURCE_TRANSFER_SOURCE).getValue());

Review Comment:
   Please use the recently added `PropertyValue.asAllowableValue()` method:
   ```suggestion
   final ResourceTransferSource resourceTransferSource = 
context.getProperty(RESOURCE_TRANSFER_SOURCE).asAllowableValue(ResourceTransferSource.class);
   ```



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12643 Added support for FileResourceService in PutGCSObject [nifi]

2024-01-25 Thread via GitHub


balazsgerner commented on code in PR #8281:
URL: https://github.com/apache/nifi/pull/8281#discussion_r1466548160


##
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java:
##
@@ -291,6 +295,8 @@ public List 
getSupportedPropertyDescriptors() {
 descriptors.add(BUCKET);
 descriptors.add(KEY);
 descriptors.add(CONTENT_TYPE);
+descriptors.add(RESOURCE_TRANSFER_SOURCE);
+descriptors.add(FILE_RESOURCE_SERVICE);
 descriptors.add(CRC32C);
 descriptors.add(ACL);

Review Comment:
   thanks, committed the suggestion.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12643 Added support for FileResourceService in PutGCSObject [nifi]

2024-01-25 Thread via GitHub


turcsanyip commented on code in PR #8281:
URL: https://github.com/apache/nifi/pull/8281#discussion_r1466456472


##
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java:
##
@@ -291,6 +295,8 @@ public List 
getSupportedPropertyDescriptors() {
 descriptors.add(BUCKET);
 descriptors.add(KEY);
 descriptors.add(CONTENT_TYPE);
+descriptors.add(RESOURCE_TRANSFER_SOURCE);
+descriptors.add(FILE_RESOURCE_SERVICE);
 descriptors.add(CRC32C);
 descriptors.add(ACL);

Review Comment:
   I would move the new properties up, before `CONTENT_TYPE`. In that way, the 
properties would be "grouped" like:
   - target (Bucket, Key)
   - source
   - metadata (Content Type, CRC, etc)
   ```suggestion
   descriptors.add(BUCKET);
   descriptors.add(KEY);
   descriptors.add(RESOURCE_TRANSFER_SOURCE);
   descriptors.add(FILE_RESOURCE_SERVICE);
   descriptors.add(CONTENT_TYPE);
   descriptors.add(CRC32C);
   descriptors.add(ACL);
   ```



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] NIFI-12643 Added support for FileResourceService in PutGCSObject [nifi]

2024-01-22 Thread via GitHub


balazsgerner opened a new pull request, #8281:
URL: https://github.com/apache/nifi/pull/8281

   
   
   
   
   
   
   
   
   
   
   
   
   
   # Summary
   
   Added support to upload content directly from local file's inputstream 
(by-passing the content repository) inside the PutGCSObject processor. The 
default behaviour is upload from flowfile content to be backward compatible. 
This can be overridden if the `RESOURCE_TRANSFER_SOURCE` property value is set 
to `FILE_RESOURCE_SERVICE`, and a `FileResourceService` controller service is 
registered.
   
   [NIFI-12643](https://issues.apache.org/jira/browse/NIFI-12643)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [x] Build completed using `mvn clean install -P contrib-check`
 - [x] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org