[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-06 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r763171291



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/wag/InvokeAWSGatewayApi.java
##
@@ -380,4 +355,87 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
 }
 }
 }
+
+@Override
+public List verify(final ProcessContext context, 
final ComponentLog verificationLogger, final Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
+
+final String method = context.getProperty(PROP_METHOD).getValue();
+final String endpoint = 
context.getProperty(PROP_AWS_GATEWAY_API_ENDPOINT).getValue();
+final String resource = 
context.getProperty(PROP_RESOURCE_NAME).getValue();
+try {
+final GenericApiGatewayClient client = 
getConfiguration(context).getClient();
+
+final GatewayResponse gatewayResponse = invokeGateway(client, 
context, null, null, attributes, verificationLogger);

Review comment:
   Happy that this isn't an issue any longer (see 
https://github.com/apache/nifi/pull/5504#discussion_r763169549) - the change to 
have the Idempotent methods list was definitely worthwhile I think and I'm 
happy that the triggering of this check will be at the behest of the user 
that's configuring the processor (and so they should know whether their service 
can be "pinged" in this manner)




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-06 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r763169549



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java
##
@@ -100,42 +104,75 @@
 }
 
 @Override
-public void onTrigger(final ProcessContext context, final ProcessSession 
session) {
-List flowFiles = 
session.get(context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger());
-if (flowFiles == null || flowFiles.size() == 0) {
-return;
-}
+public List verify(final ProcessContext context, 
final ComponentLog verificationLogger, final Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
 
-Map keysToFlowFileMap = new HashMap<>();
+final TableKeysAndAttributes tableKeysAndAttributes = 
getTableKeysAndAttributes(context, attributes);
 
 final String table = 
context.getProperty(TABLE).evaluateAttributeExpressions().getValue();
-TableKeysAndAttributes tableKeysAndAttributes = new 
TableKeysAndAttributes(table);
-
-final String hashKeyName = 
context.getProperty(HASH_KEY_NAME).evaluateAttributeExpressions().getValue();
-final String rangeKeyName = 
context.getProperty(RANGE_KEY_NAME).evaluateAttributeExpressions().getValue();
 final String jsonDocument = 
context.getProperty(JSON_DOCUMENT).evaluateAttributeExpressions().getValue();
 
-for (FlowFile flowFile : flowFiles) {
-final Object hashKeyValue = getValue(context, HASH_KEY_VALUE_TYPE, 
HASH_KEY_VALUE, flowFile);
-final Object rangeKeyValue = getValue(context, 
RANGE_KEY_VALUE_TYPE, RANGE_KEY_VALUE, flowFile);
+if (tableKeysAndAttributes.getPrimaryKeys().isEmpty()) {
 
-if ( ! isHashKeyValueConsistent(hashKeyName, hashKeyValue, 
session, flowFile)) {
-continue;
-}
+results.add(new ConfigVerificationResult.Builder()
+.outcome(Outcome.SKIPPED)
+.verificationStepName("Get DynamoDB Items")
+.explanation(String.format("Skipped getting DynamoDB items 
because no primary keys would be included in retrieval"))
+.build());
+} else {
+try {
+final DynamoDB dynamoDB = 
getDynamoDB(getConfiguration(context).getClient());
+int totalCount = 0;
+int jsonDocumentCount = 0;
 
-if ( ! isRangeKeyValueConsistent(rangeKeyName, rangeKeyValue, 
session, flowFile) ) {
-continue;
-}
+BatchGetItemOutcome result = 
dynamoDB.batchGetItem(tableKeysAndAttributes);

Review comment:
   I understand Verification better now thanks to a [Slack 
discussion](https://apachenifi.slack.com/archives/C0L9S92JY/p1638744006088000), 
so this is less of a concern as you're right that the user has the control over 
when this happens and against specific bits of data... so this check seems fine 
now, thanks for explaining!




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-06 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762795882



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/wag/InvokeAWSGatewayApi.java
##
@@ -380,4 +355,87 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
 }
 }
 }
+
+@Override
+public List verify(final ProcessContext context, 
final ComponentLog verificationLogger, final Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
+
+final String method = context.getProperty(PROP_METHOD).getValue();
+final String endpoint = 
context.getProperty(PROP_AWS_GATEWAY_API_ENDPOINT).getValue();
+final String resource = 
context.getProperty(PROP_RESOURCE_NAME).getValue();
+try {
+final GenericApiGatewayClient client = 
getConfiguration(context).getClient();
+
+final GatewayResponse gatewayResponse = invokeGateway(client, 
context, null, null, attributes, verificationLogger);

Review comment:
   My concern here is still that a `GET` may not be idempotent - can the 
verification step be turned off?
   
   If my API Gateway (being a GET) results in other things happening downstream 
that may impact my system, I might not want this being executed until my NiFi 
Flow has first done other stuff upstream (e.g. inersted data into a datastore 
that the API Gateway then does something with ... without that data being 
present then it could cause my system problems)




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-06 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762794563



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java
##
@@ -100,42 +104,75 @@
 }
 
 @Override
-public void onTrigger(final ProcessContext context, final ProcessSession 
session) {
-List flowFiles = 
session.get(context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger());
-if (flowFiles == null || flowFiles.size() == 0) {
-return;
-}
+public List verify(final ProcessContext context, 
final ComponentLog verificationLogger, final Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
 
-Map keysToFlowFileMap = new HashMap<>();
+final TableKeysAndAttributes tableKeysAndAttributes = 
getTableKeysAndAttributes(context, attributes);
 
 final String table = 
context.getProperty(TABLE).evaluateAttributeExpressions().getValue();
-TableKeysAndAttributes tableKeysAndAttributes = new 
TableKeysAndAttributes(table);
-
-final String hashKeyName = 
context.getProperty(HASH_KEY_NAME).evaluateAttributeExpressions().getValue();
-final String rangeKeyName = 
context.getProperty(RANGE_KEY_NAME).evaluateAttributeExpressions().getValue();
 final String jsonDocument = 
context.getProperty(JSON_DOCUMENT).evaluateAttributeExpressions().getValue();
 
-for (FlowFile flowFile : flowFiles) {
-final Object hashKeyValue = getValue(context, HASH_KEY_VALUE_TYPE, 
HASH_KEY_VALUE, flowFile);
-final Object rangeKeyValue = getValue(context, 
RANGE_KEY_VALUE_TYPE, RANGE_KEY_VALUE, flowFile);
+if (tableKeysAndAttributes.getPrimaryKeys().isEmpty()) {
 
-if ( ! isHashKeyValueConsistent(hashKeyName, hashKeyValue, 
session, flowFile)) {
-continue;
-}
+results.add(new ConfigVerificationResult.Builder()
+.outcome(Outcome.SKIPPED)
+.verificationStepName("Get DynamoDB Items")
+.explanation(String.format("Skipped getting DynamoDB items 
because no primary keys would be included in retrieval"))
+.build());
+} else {
+try {
+final DynamoDB dynamoDB = 
getDynamoDB(getConfiguration(context).getClient());
+int totalCount = 0;
+int jsonDocumentCount = 0;
 
-if ( ! isRangeKeyValueConsistent(rangeKeyName, rangeKeyValue, 
session, flowFile) ) {
-continue;
-}
+BatchGetItemOutcome result = 
dynamoDB.batchGetItem(tableKeysAndAttributes);

Review comment:
   Shame that `GetTable` does that, but oh well
   
   Could we instead limit the pull of data to a single item then maybe, i.e. if 
we have to try fetching something, then fetch as little as possible in order to 
reduce both cost and time taken for the verification steps




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-06 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762793801



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
##
@@ -148,6 +153,37 @@
 return problems;
 }
 
+@Override
+public List verify(ProcessContext context, 
ComponentLog verificationLogger, Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
+
+final String bucket = 
context.getProperty(BUCKET).evaluateAttributeExpressions(attributes).getValue();
+final String key = 
context.getProperty(KEY).evaluateAttributeExpressions(attributes).getValue();
+
+final AmazonS3 client = getConfiguration(context).getClient();
+final GetObjectRequest request = createGetObjectRequest(context, 
attributes);
+
+try (final S3Object s3Object = client.getObject(request)) {

Review comment:
   A quick look at the [AWS 
docs](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html) 
suggests that if one can `GetObject` then they will be able to `HeadObject`
   
   Particularly as the user may need to specify a large object to be retrieved 
from S3 by the processor, doing this more times than is necessary seems like a 
waste and unnecessary extra cost. I know that my use of this Processor often 
results in pulling many objects that range from very small to much larger, I'd 
be wanting to turn this step off if it meant doubling up on pulling some of the 
larger files over the internet!




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762613901



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java
##
@@ -100,42 +104,75 @@
 }
 
 @Override
-public void onTrigger(final ProcessContext context, final ProcessSession 
session) {
-List flowFiles = 
session.get(context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger());
-if (flowFiles == null || flowFiles.size() == 0) {
-return;
-}
+public List verify(final ProcessContext context, 
final ComponentLog verificationLogger, final Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
 
-Map keysToFlowFileMap = new HashMap<>();
+final TableKeysAndAttributes tableKeysAndAttributes = 
getTableKeysAndAttributes(context, attributes);
 
 final String table = 
context.getProperty(TABLE).evaluateAttributeExpressions().getValue();
-TableKeysAndAttributes tableKeysAndAttributes = new 
TableKeysAndAttributes(table);
-
-final String hashKeyName = 
context.getProperty(HASH_KEY_NAME).evaluateAttributeExpressions().getValue();
-final String rangeKeyName = 
context.getProperty(RANGE_KEY_NAME).evaluateAttributeExpressions().getValue();
 final String jsonDocument = 
context.getProperty(JSON_DOCUMENT).evaluateAttributeExpressions().getValue();
 
-for (FlowFile flowFile : flowFiles) {
-final Object hashKeyValue = getValue(context, HASH_KEY_VALUE_TYPE, 
HASH_KEY_VALUE, flowFile);
-final Object rangeKeyValue = getValue(context, 
RANGE_KEY_VALUE_TYPE, RANGE_KEY_VALUE, flowFile);
+if (tableKeysAndAttributes.getPrimaryKeys().isEmpty()) {
 
-if ( ! isHashKeyValueConsistent(hashKeyName, hashKeyValue, 
session, flowFile)) {
-continue;
-}
+results.add(new ConfigVerificationResult.Builder()
+.outcome(Outcome.SKIPPED)
+.verificationStepName("Get DynamoDB Items")
+.explanation(String.format("Skipped getting DynamoDB items 
because no primary keys would be included in retrieval"))
+.build());
+} else {
+try {
+final DynamoDB dynamoDB = 
getDynamoDB(getConfiguration(context).getClient());
+int totalCount = 0;
+int jsonDocumentCount = 0;
 
-if ( ! isRangeKeyValueConsistent(rangeKeyName, rangeKeyValue, 
session, flowFile) ) {
-continue;
-}
+BatchGetItemOutcome result = 
dynamoDB.batchGetItem(tableKeysAndAttributes);

Review comment:
   Would it be better to do some sort of "DynamoDB Table Exists" rather 
than fetching data - this could potentially be costly if a lot of data is 
pulled back over the internet?




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762613490



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/wag/InvokeAWSGatewayApi.java
##
@@ -380,4 +355,87 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
 }
 }
 }
+
+@Override
+public List verify(final ProcessContext context, 
final ComponentLog verificationLogger, final Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
+
+final String method = context.getProperty(PROP_METHOD).getValue();
+final String endpoint = 
context.getProperty(PROP_AWS_GATEWAY_API_ENDPOINT).getValue();
+final String resource = 
context.getProperty(PROP_RESOURCE_NAME).getValue();
+try {
+final GenericApiGatewayClient client = 
getConfiguration(context).getClient();
+
+final GatewayResponse gatewayResponse = invokeGateway(client, 
context, null, null, attributes, verificationLogger);

Review comment:
   An (unexpected) invoke of the gateway seems like it could be problematic 
for some use cases (e.g. if calling a non-idempotent API) - would it be 
better/possible to do some sort of "gateway exists" check instead?




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762613284



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/wag/InvokeAWSGatewayApi.java
##
@@ -179,41 +182,20 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
 
 final GenericApiGatewayClient client = getClient();
 
-final GenericApiGatewayRequest request = configureRequest(context, 
session,
-  
resourceName,
-  
requestFlowFile);
-
-logRequest(logger, client.getEndpoint(), request);
 final long startNanos = System.nanoTime();
-GenericApiGatewayResponse response = null;
-GenericApiGatewayException exception = null;
-try {
-response = client.execute(request);
-logResponse(logger, response);
-} catch (GenericApiGatewayException gag) {
-// ERROR response codes may come back as exceptions, 404 for 
example
-exception = gag;
-}
+final Map attributes = requestFlowFile == null ? 
Collections.emptyMap() : requestFlowFile.getAttributes();
+final GatewayResponse gatewayResponse = invokeGateway(client, 
context, session, requestFlowFile, attributes, logger);
 
-final int statusCode;
-if (exception != null) {
-statusCode = exception.getStatusCode();
-} else {
-statusCode = response.getHttpResponse().getStatusCode();
-}
+GenericApiGatewayResponse response = gatewayResponse.response;

Review comment:
   Looks like missing a few `final`s here (booleans below too)




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762612941



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
##
@@ -148,6 +153,37 @@
 return problems;
 }
 
+@Override
+public List verify(ProcessContext context, 
ComponentLog verificationLogger, Map attributes) {
+final List results = new 
ArrayList<>(super.verify(context, verificationLogger, attributes));
+
+final String bucket = 
context.getProperty(BUCKET).evaluateAttributeExpressions(attributes).getValue();
+final String key = 
context.getProperty(KEY).evaluateAttributeExpressions(attributes).getValue();
+
+final AmazonS3 client = getConfiguration(context).getClient();
+final GetObjectRequest request = createGetObjectRequest(context, 
attributes);
+
+try (final S3Object s3Object = client.getObject(request)) {

Review comment:
   Doing a full `GET` just to verify the processor seems a bit heavy handed 
(if it's a large Object then it might also take a while and be costly for the 
consumer both in terms of network bandwidth and the transfer fees from S3) - 
could we use a `HEAD` instead to check whether the Object exists?
   
   Would that add to the S3 policies needed for a user to run this Processor 
though?




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762612478



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java
##
@@ -161,38 +198,90 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 }
 
 // Handle unprocessed keys
-Map unprocessedKeys = 
result.getUnprocessedKeys();
+final Map unprocessedKeys = 
result.getUnprocessedKeys();
 if ( unprocessedKeys != null && unprocessedKeys.size() > 0) {
-KeysAndAttributes keysAndAttributes = 
unprocessedKeys.get(table);
-List> keys = 
keysAndAttributes.getKeys();
+final KeysAndAttributes keysAndAttributes = 
unprocessedKeys.get(table);
+final List> keys = 
keysAndAttributes.getKeys();
 
-for (Map unprocessedKey : keys) {
-Object hashKeyValue = getAttributeValue(context, 
HASH_KEY_VALUE_TYPE, unprocessedKey.get(hashKeyName));
-Object rangeKeyValue = getAttributeValue(context, 
RANGE_KEY_VALUE_TYPE, unprocessedKey.get(rangeKeyName));
+for (final Map unprocessedKey : keys) {
+final Object hashKeyValue = getAttributeValue(context, 
HASH_KEY_VALUE_TYPE, unprocessedKey.get(hashKeyName));
+final Object rangeKeyValue = getAttributeValue(context, 
RANGE_KEY_VALUE_TYPE, unprocessedKey.get(rangeKeyName));
 sendUnprocessedToUnprocessedRelationship(session, 
keysToFlowFileMap, hashKeyValue, rangeKeyValue);
 }
 }
 
 // Handle any remaining items
-for (ItemKeys key : keysToFlowFileMap.keySet()) {
+for (final ItemKeys key : keysToFlowFileMap.keySet()) {
 FlowFile flowFile = keysToFlowFileMap.get(key);
 flowFile = session.putAttribute(flowFile, 
DYNAMODB_KEY_ERROR_NOT_FOUND, DYNAMODB_KEY_ERROR_NOT_FOUND_MESSAGE + 
key.toString() );
 session.transfer(flowFile,REL_NOT_FOUND);
 keysToFlowFileMap.remove(key);
 }
 
-} catch(AmazonServiceException exception) {
+} catch(final AmazonServiceException exception) {
 getLogger().error("Could not process flowFiles due to service 
exception : " + exception.getMessage());
 List failedFlowFiles = processServiceException(session, 
flowFiles, exception);
 session.transfer(failedFlowFiles, REL_FAILURE);
-} catch(AmazonClientException exception) {
+} catch(final AmazonClientException exception) {
 getLogger().error("Could not process flowFiles due to client 
exception : " + exception.getMessage());
 List failedFlowFiles = processClientException(session, 
flowFiles, exception);
 session.transfer(failedFlowFiles, REL_FAILURE);
-} catch(Exception exception) {
+} catch(final Exception exception) {
 getLogger().error("Could not process flowFiles due to exception : 
" + exception.getMessage());
 List failedFlowFiles = processException(session, 
flowFiles, exception);
 session.transfer(failedFlowFiles, REL_FAILURE);
 }
 }
+
+private Map getKeysToFlowFileMap(final ProcessContext 
context, final ProcessSession session, final List flowFiles) {
+Map keysToFlowFileMap = new HashMap<>();

Review comment:
   `final`




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762612066



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/wag/AbstractAWSGatewayApiProcessor.java
##
@@ -467,23 +469,22 @@ protected InputStream getRequestBodyToSend(final 
ProcessSession session,
 
 protected GenericApiGatewayRequestBuilder setHeaderProperties(final 
ProcessContext context,
   
GenericApiGatewayRequestBuilder requestBuilder,
-  
HttpMethodName methodName,
-  final 
FlowFile requestFlowFile) {
+  final 
HttpMethodName methodName,
+  final 
Map requestAttributes) {
 
-Map headers = new HashMap<>();
-for (String headerKey : dynamicPropertyNames) {
+final Map headers = new HashMap<>();
+for (final String headerKey : dynamicPropertyNames) {
 String headerValue = context.getProperty(headerKey)

Review comment:
   But then maybe we don't want to go through and make everything `final` 
in all of these classes at this point?




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




[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5504: NIFI-9353: Adding Config Verification to AWS Processors

2021-12-05 Thread GitBox


ChrisSamo632 commented on a change in pull request #5504:
URL: https://github.com/apache/nifi/pull/5504#discussion_r762611993



##
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/wag/AbstractAWSGatewayApiProcessor.java
##
@@ -467,23 +469,22 @@ protected InputStream getRequestBodyToSend(final 
ProcessSession session,
 
 protected GenericApiGatewayRequestBuilder setHeaderProperties(final 
ProcessContext context,
   
GenericApiGatewayRequestBuilder requestBuilder,
-  
HttpMethodName methodName,
-  final 
FlowFile requestFlowFile) {
+  final 
HttpMethodName methodName,
+  final 
Map requestAttributes) {
 
-Map headers = new HashMap<>();
-for (String headerKey : dynamicPropertyNames) {
+final Map headers = new HashMap<>();
+for (final String headerKey : dynamicPropertyNames) {
 String headerValue = context.getProperty(headerKey)

Review comment:
   Could be `final`




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