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/31 06:25:07 UTC

[camel] branch master updated (5c4b7e8 -> c9649c9)

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 5c4b7e8  Polished
     new 0ffee7c  Camel-AWS2-Lambda: Producer operations refactoring - deleteEventSourceMapping
     new c9649c9  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     | 32 ++++++++--------------
 1 file changed, 12 insertions(+), 20 deletions(-)

[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 c9649c90d66b5c3dff66ab1a989ace2e746f28f9
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 31 08:22:22 2021 +0200

    Fixed CS
---
 .../camel/component/aws2/lambda/Lambda2Producer.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 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 506d6e4..5caae82 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
@@ -433,20 +433,20 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void deleteEventSourceMapping(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
-    	DeleteEventSourceMappingRequest request = null;
-    	DeleteEventSourceMappingResponse result;
+        DeleteEventSourceMappingRequest request = null;
+        DeleteEventSourceMappingResponse result;
         if (getConfiguration().isPojoRequest()) {
             request = exchange.getIn().getMandatoryBody(DeleteEventSourceMappingRequest.class);
         } else {
-                DeleteEventSourceMappingRequest.Builder builder = DeleteEventSourceMappingRequest.builder();
-                if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID))) {
-                	builder.uuid(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID, String.class));
-                } else {
-                    throw new IllegalArgumentException("Event Source Arn must be specified");
-                }
+            DeleteEventSourceMappingRequest.Builder builder = DeleteEventSourceMappingRequest.builder();
+            if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID))) {
+                builder.uuid(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID, String.class));
+            } else {
+                throw new IllegalArgumentException("Event Source Arn must be specified");
+            }
             request = builder.build();
-                
-            try {    
+
+            try {
                 result = lambdaClient.deleteEventSourceMapping(request);
             } catch (AwsServiceException ase) {
                 LOG.trace("deleteEventSourceMapping command returned the error code {}", ase.awsErrorDetails().errorCode());

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

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 0ffee7cf9af5029c6f68b3cafdf24202f9746633
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 31 08:19:02 2021 +0200

    Camel-AWS2-Lambda: Producer operations refactoring - deleteEventSourceMapping
---
 .../component/aws2/lambda/Lambda2Producer.java     | 26 ++++++++--------------
 1 file changed, 9 insertions(+), 17 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 58edc7d..506d6e4 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
@@ -433,29 +433,21 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void deleteEventSourceMapping(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
+    	DeleteEventSourceMappingRequest request = null;
+    	DeleteEventSourceMappingResponse result;
         if (getConfiguration().isPojoRequest()) {
-            Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof DeleteEventSourceMappingRequest) {
-                DeleteEventSourceMappingResponse result;
-                try {
-                    result = lambdaClient.deleteEventSourceMapping((DeleteEventSourceMappingRequest) payload);
-                } catch (AwsServiceException ase) {
-                    LOG.trace("deleteEventSourceMapping command returned the error code {}", ase.awsErrorDetails().errorCode());
-                    throw ase;
-                }
-                Message message = getMessageForResponse(exchange);
-                message.setBody(result);
-            }
+            request = exchange.getIn().getMandatoryBody(DeleteEventSourceMappingRequest.class);
         } else {
-            DeleteEventSourceMappingResponse result;
-            try {
-                DeleteEventSourceMappingRequest.Builder request = DeleteEventSourceMappingRequest.builder();
+                DeleteEventSourceMappingRequest.Builder builder = DeleteEventSourceMappingRequest.builder();
                 if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID))) {
-                    request.uuid(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID, String.class));
+                	builder.uuid(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_UUID, String.class));
                 } else {
                     throw new IllegalArgumentException("Event Source Arn must be specified");
                 }
-                result = lambdaClient.deleteEventSourceMapping(request.build());
+            request = builder.build();
+                
+            try {    
+                result = lambdaClient.deleteEventSourceMapping(request);
             } catch (AwsServiceException ase) {
                 LOG.trace("deleteEventSourceMapping command returned the error code {}", ase.awsErrorDetails().errorCode());
                 throw ase;