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 09:32:09 UTC
[camel] 02/09: Camel-AWS2-Lambda: Producer operations refactoring -
publishVersion
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 b053f0e1c760e4567fbcb33d3a9bfb746aa74ee9
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 31 11:07:50 2021 +0200
Camel-AWS2-Lambda: Producer operations refactoring - publishVersion
---
.../component/aws2/lambda/Lambda2Producer.java | 40 +++++++++++-----------
1 file changed, 20 insertions(+), 20 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 755aebc..4e57f7e 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
@@ -567,31 +567,31 @@ public class Lambda2Producer extends DefaultProducer {
}
private void publishVersion(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
- PublishVersionRequest request = null;
- PublishVersionResponse result;
+ PublishVersionRequest request = null;
+ PublishVersionResponse result;
if (getConfiguration().isPojoRequest()) {
request = exchange.getIn().getMandatoryBody(PublishVersionRequest.class);
} else {
- PublishVersionRequest.Builder builder = PublishVersionRequest.builder();
- builder.functionName(getEndpoint().getFunction());
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.VERSION_DESCRIPTION))) {
- String description = exchange.getIn().getHeader(Lambda2Constants.VERSION_DESCRIPTION, String.class);
- builder.description(description);
- }
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.VERSION_REVISION_ID))) {
- String revisionId = exchange.getIn().getHeader(Lambda2Constants.VERSION_REVISION_ID, String.class);
- builder.revisionId(revisionId);
- }
- request = builder.build();
+ PublishVersionRequest.Builder builder = PublishVersionRequest.builder();
+ builder.functionName(getEndpoint().getFunction());
+ if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.VERSION_DESCRIPTION))) {
+ String description = exchange.getIn().getHeader(Lambda2Constants.VERSION_DESCRIPTION, String.class);
+ builder.description(description);
+ }
+ if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.VERSION_REVISION_ID))) {
+ String revisionId = exchange.getIn().getHeader(Lambda2Constants.VERSION_REVISION_ID, String.class);
+ builder.revisionId(revisionId);
+ }
+ request = builder.build();
}
try {
- result = lambdaClient.publishVersion(request);
- } catch (AwsServiceException ase) {
- LOG.trace("publishVersion command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
+ result = lambdaClient.publishVersion(request);
+ } catch (AwsServiceException ase) {
+ LOG.trace("publishVersion command returned the error code {}", ase.awsErrorDetails().errorCode());
+ throw ase;
+ }
+ Message message = getMessageForResponse(exchange);
+ message.setBody(result);
}
private void listVersions(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {