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 782dfdf37adc4829c31bc9881e41dd20086038f6 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Apr 10 13:02:28 2020 +0200 CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-eks delete cluster --- .../apache/camel/component/aws2/eks/EKS2Producer.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/components/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java b/components/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java index 69c3358..9c4396c 100644 --- a/components/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java +++ b/components/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java @@ -201,7 +201,21 @@ public class EKS2Producer extends DefaultProducer { } } - private void deleteCluster(EksClient eksClient, Exchange exchange) { + private void deleteCluster(EksClient eksClient, Exchange exchange) throws InvalidPayloadException { + if (getConfiguration().isPojoRequest()) { + Object payload = exchange.getIn().getMandatoryBody(); + if (payload instanceof DeleteClusterRequest) { + DeleteClusterResponse result; + try { + result = eksClient.deleteCluster((DeleteClusterRequest) payload); + } catch (AwsServiceException ase) { + LOG.trace("Delete Cluster command returned the error code {}", ase.awsErrorDetails().errorCode()); + throw ase; + } + Message message = getMessageForResponse(exchange); + message.setBody(result); + } + } else { DeleteClusterRequest.Builder builder = DeleteClusterRequest.builder(); if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EKS2Constants.CLUSTER_NAME))) { String name = exchange.getIn().getHeader(EKS2Constants.CLUSTER_NAME, String.class); @@ -218,6 +232,7 @@ public class EKS2Producer extends DefaultProducer { } Message message = getMessageForResponse(exchange); message.setBody(result); + } } public static Message getMessageForResponse(final Exchange exchange) {