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 eb89f2b29658e69272602f3b76204eb550fe111e
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Apr 20 12:43:03 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 get Alias
---
 .../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 c6efccf..7d318ff 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
@@ -797,7 +797,21 @@ public class Lambda2Producer extends DefaultProducer {
         }
     }
 
-    private void getAlias(LambdaClient lambdaClient, Exchange exchange) {
+    private void getAlias(LambdaClient lambdaClient, Exchange exchange) throws 
InvalidPayloadException {
+        if (getConfiguration().isPojoRequest()) {
+            Object payload = exchange.getIn().getMandatoryBody();
+            if (payload instanceof GetAliasRequest) {
+                GetAliasResponse result;
+                try {
+                    result = lambdaClient.getAlias((GetAliasRequest) payload);
+                } catch (AwsServiceException ase) {
+                    LOG.trace("getAlias command returned the error code {}", 
ase.awsErrorDetails().errorCode());
+                    throw ase;
+                }
+                Message message = getMessageForResponse(exchange);
+                message.setBody(result);
+            }
+        } else {
         GetAliasResponse result;
         try {
             GetAliasRequest.Builder request = 
GetAliasRequest.builder().functionName(getEndpoint().getFunction());
@@ -813,6 +827,7 @@ public class Lambda2Producer extends DefaultProducer {
         }
         Message message = getMessageForResponse(exchange);
         message.setBody(result);
+        }
     }
 
     private void listAliases(LambdaClient lambdaClient, Exchange exchange) {

Reply via email to