You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/03/30 07:20:51 UTC

[camel] branch master updated (f47fb69 -> 0f98350)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from f47fb69  Fixed CS
     new e79a455  Camel-AWS2-Lambda: Producer operations refactoring - deleteFunction
     new 0f98350  Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../component/aws2/lambda/Lambda2Producer.java     | 37 +++++++++-------------
 1 file changed, 15 insertions(+), 22 deletions(-)

[camel] 01/02: Camel-AWS2-Lambda: Producer operations refactoring - deleteFunction

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e79a455f9dcc1467908b33f87dbfafc0a9913729
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:17:04 2021 +0200

    Camel-AWS2-Lambda: Producer operations refactoring - deleteFunction
---
 .../component/aws2/lambda/Lambda2Producer.java     | 23 ++++++++--------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 8f42fad..2b28ef5 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -173,31 +173,24 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void deleteFunction(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
+    	DeleteFunctionRequest request = null;
+    	DeleteFunctionResponse result;
         if (getConfiguration().isPojoRequest()) {
-            Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof DeleteFunctionRequest) {
-                DeleteFunctionResponse result;
-                try {
-                    result = lambdaClient.deleteFunction((DeleteFunctionRequest) payload);
-                } catch (AwsServiceException ase) {
-                    LOG.trace("deleteFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
-                    throw ase;
-                }
-                Message message = getMessageForResponse(exchange);
-                message.setBody(result);
-            }
+            request = exchange.getIn().getMandatoryBody(DeleteFunctionRequest.class);
         } else {
-            DeleteFunctionResponse result;
+        	DeleteFunctionRequest.Builder builder = DeleteFunctionRequest.builder();
+        	builder.functionName(getEndpoint().getFunction());
+        	request = builder.build();
+        }
             try {
                 result = lambdaClient
-                        .deleteFunction(DeleteFunctionRequest.builder().functionName(getEndpoint().getFunction()).build());
+                        .deleteFunction(request);
             } catch (AwsServiceException ase) {
                 LOG.trace("deleteFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
                 throw ase;
             }
             Message message = getMessageForResponse(exchange);
             message.setBody(result);
-        }
     }
 
     private void listFunctions(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {

[camel] 02/02: Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0f98350706ddfd72b5f989fa927fc2b67e3a6f32
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:20:18 2021 +0200

    Fixed CS
---
 .../component/aws2/lambda/Lambda2Producer.java     | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 2b28ef5..1c56c32 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -173,24 +173,24 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void deleteFunction(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
-    	DeleteFunctionRequest request = null;
-    	DeleteFunctionResponse result;
+        DeleteFunctionRequest request = null;
+        DeleteFunctionResponse result;
         if (getConfiguration().isPojoRequest()) {
             request = exchange.getIn().getMandatoryBody(DeleteFunctionRequest.class);
         } else {
-        	DeleteFunctionRequest.Builder builder = DeleteFunctionRequest.builder();
-        	builder.functionName(getEndpoint().getFunction());
-        	request = builder.build();
+            DeleteFunctionRequest.Builder builder = DeleteFunctionRequest.builder();
+            builder.functionName(getEndpoint().getFunction());
+            request = builder.build();
         }
-            try {
-                result = lambdaClient
-                        .deleteFunction(request);
-            } catch (AwsServiceException ase) {
-                LOG.trace("deleteFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
-                throw ase;
-            }
-            Message message = getMessageForResponse(exchange);
-            message.setBody(result);
+        try {
+            result = lambdaClient
+                    .deleteFunction(request);
+        } catch (AwsServiceException ase) {
+            LOG.trace("deleteFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
+            throw ase;
+        }
+        Message message = getMessageForResponse(exchange);
+        message.setBody(result);
     }
 
     private void listFunctions(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {