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 d110e70e92a96994f478d28f6bd2e792d1ff79c2 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon Apr 20 12:24:04 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 update function --- .../camel/component/aws2/lambda/Lambda2Producer.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 edd063c..0a15c31 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 @@ -405,6 +405,21 @@ public class Lambda2Producer extends DefaultProducer { } private void updateFunction(LambdaClient lambdaClient, Exchange exchange) throws Exception { + if (getConfiguration().isPojoRequest()) { + Object payload = exchange.getIn().getMandatoryBody(); + if (payload instanceof UpdateFunctionCodeRequest) { + UpdateFunctionCodeResponse result; + try { + result = lambdaClient.updateFunctionCode((UpdateFunctionCodeRequest) payload); + } catch (AwsServiceException ase) { + LOG.trace("updateFunction command returned the error code {}", ase.awsErrorDetails().errorCode()); + throw ase; + } + + Message message = getMessageForResponse(exchange); + message.setBody(result); + } + } else { UpdateFunctionCodeResponse result; try { @@ -429,6 +444,7 @@ public class Lambda2Producer extends DefaultProducer { Message message = getMessageForResponse(exchange); message.setBody(result); + } } private void createEventSourceMapping(LambdaClient lambdaClient, Exchange exchange) {