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 fd3ac5a37152a5eddea844d93fb0926d4bc7c72b
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Apr 20 12:37:47 2020 +0200

    CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end 
user to pass an AWS Request pojo as body, aws2-lambda list version
---
 .../camel/component/aws2/lambda/Lambda2Producer.java    | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
 
b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 2320d99..58305b8 100644
--- 
a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ 
b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -697,7 +697,21 @@ public class Lambda2Producer extends DefaultProducer {
         }
     }
 
-    private void listVersions(LambdaClient lambdaClient, Exchange exchange) {
+    private void listVersions(LambdaClient lambdaClient, Exchange exchange) 
throws InvalidPayloadException {
+        if (getConfiguration().isPojoRequest()) {
+            Object payload = exchange.getIn().getMandatoryBody();
+            if (payload instanceof ListVersionsByFunctionRequest) {
+                ListVersionsByFunctionResponse result;
+                try {
+                    result = 
lambdaClient.listVersionsByFunction((ListVersionsByFunctionRequest) payload);
+                } catch (AwsServiceException ase) {
+                    LOG.trace("publishVersion command returned the error code 
{}", ase.awsErrorDetails().errorCode());
+                    throw ase;
+                }
+                Message message = getMessageForResponse(exchange);
+                message.setBody(result);
+            }
+        } else {
         ListVersionsByFunctionResponse result;
         try {
             ListVersionsByFunctionRequest request = 
ListVersionsByFunctionRequest.builder().functionName(getEndpoint().getFunction()).build();
@@ -708,6 +722,7 @@ public class Lambda2Producer extends DefaultProducer {
         }
         Message message = getMessageForResponse(exchange);
         message.setBody(result);
+        }
     }
 
     private void createAlias(LambdaClient lambdaClient, Exchange exchange) {

Reply via email to