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 2020/04/20 11:05:26 UTC
[camel] 12/24: CAMEL-14868 - Camel-AWS2-*: Where possible,
give the possiblity to the end user to pass an AWS Request pojo as
body, aws2-lambda tag resources operation
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 b0633c2bc4de14377037dcced625d4a538cd22d2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 20 12:31:39 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 tag resources operation
---
.../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 6906c98..43db187 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
@@ -580,7 +580,21 @@ public class Lambda2Producer extends DefaultProducer {
}
@SuppressWarnings("unchecked")
- private void tagResource(LambdaClient lambdaClient, Exchange exchange) {
+ private void tagResource(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
+ if (getConfiguration().isPojoRequest()) {
+ Object payload = exchange.getIn().getMandatoryBody();
+ if (payload instanceof TagResourceRequest) {
+ TagResourceResponse result;
+ try {
+ result = lambdaClient.tagResource((TagResourceRequest) payload);
+ } catch (AwsServiceException ase) {
+ LOG.trace("listTags command returned the error code {}", ase.awsErrorDetails().errorCode());
+ throw ase;
+ }
+ Message message = getMessageForResponse(exchange);
+ message.setBody(result);
+ }
+ } else {
TagResourceResponse result;
try {
TagResourceRequest.Builder request = TagResourceRequest.builder();
@@ -603,6 +617,7 @@ public class Lambda2Producer extends DefaultProducer {
}
Message message = getMessageForResponse(exchange);
message.setBody(result);
+ }
}
@SuppressWarnings("unchecked")