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 2026/01/12 11:30:24 UTC
(camel) branch main updated (cd8ff1e2b2fa -> b0be6013ef47)
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from cd8ff1e2b2fa Bump to version 4.18.0-SNAPSHOT (#20779)
new e487543a03ed CAMEL-22836 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS EC2
new df8fc9d5f571 CAMEL-22837 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS ECS
new b0be6013ef47 CAMEL-22838 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS EKS
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/camel/catalog/components/aws2-ec2.json | 5 +-
.../apache/camel/catalog/components/aws2-ecs.json | 5 +-
.../apache/camel/catalog/components/aws2-eks.json | 5 +-
.../apache/camel/component/aws2/ec2/aws2-ec2.json | 5 +-
.../camel/component/aws2/ec2/AWS2EC2Constants.java | 11 +
.../camel/component/aws2/ec2/AWS2EC2Producer.java | 192 ++++++++++-----
.../apache/camel/component/aws2/ecs/aws2-ecs.json | 5 +-
.../camel/component/aws2/ecs/ECS2Constants.java | 13 +
.../camel/component/aws2/ecs/ECS2Producer.java | 255 +++++++++++---------
.../apache/camel/component/aws2/eks/aws2-eks.json | 5 +-
.../camel/component/aws2/eks/EKS2Constants.java | 13 +
.../camel/component/aws2/eks/EKS2Producer.java | 261 ++++++++++++---------
.../dsl/AWS2EC2EndpointBuilderFactory.java | 36 +++
.../endpoint/dsl/ECS2EndpointBuilderFactory.java | 36 +++
.../endpoint/dsl/EKS2EndpointBuilderFactory.java | 36 +++
15 files changed, 583 insertions(+), 300 deletions(-)
(camel) 03/03: CAMEL-22838 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS EKS
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b0be6013ef47a5529e9233f1c3e985dfa7b403f2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jan 12 11:56:03 2026 +0100
CAMEL-22838 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS EKS
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../apache/camel/catalog/components/aws2-eks.json | 5 +-
.../apache/camel/component/aws2/eks/aws2-eks.json | 5 +-
.../camel/component/aws2/eks/EKS2Constants.java | 13 +
.../camel/component/aws2/eks/EKS2Producer.java | 261 ++++++++++++---------
.../endpoint/dsl/EKS2EndpointBuilderFactory.java | 36 +++
5 files changed, 201 insertions(+), 119 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eks.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eks.json
index 1d4bad0a84f3..d2ab412d8a16 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eks.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eks.json
@@ -53,7 +53,10 @@
"CamelAwsEKSDescription": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A key description to use while performing a createKey operation", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#DESCRIPTION" },
"CamelAwsEKSClusterName": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cluster name", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#CLUSTER_NAME" },
"CamelAwsEKSRoleARN": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The role ARN to use while creating the cluster", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#ROLE_ARN" },
- "CamelAwsEKSVPCConfig": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.eks.model.VpcConfigRequest", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The VPC config for the creations of an EKS cluster", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#VPC_CONFIG" }
+ "CamelAwsEKSVPCConfig": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.eks.model.VpcConfigRequest", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The VPC config for the creations of an EKS cluster", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#VPC_CONFIG" },
+ "CamelAwsEKSNextToken": { "index": 6, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The token for the next set of results.", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#NEXT_TOKEN" },
+ "CamelAwsEKSIsTruncated": { "index": 7, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#IS_TRUNCATED" },
+ "CamelAwsEKSClusterArn": { "index": 8, "kind": "header", "displayName": "", "group": "createCluster describeCluster deleteCluster", "label": "createCluster describeCluster deleteCluster", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of the cluster.", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#CLUSTER_ARN" }
},
"properties": {
"label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eks.EKS2Configuration", "configurationField": "configuration", "description": "Logical name" },
diff --git a/components/camel-aws/camel-aws2-eks/src/generated/resources/META-INF/org/apache/camel/component/aws2/eks/aws2-eks.json b/components/camel-aws/camel-aws2-eks/src/generated/resources/META-INF/org/apache/camel/component/aws2/eks/aws2-eks.json
index 1d4bad0a84f3..d2ab412d8a16 100644
--- a/components/camel-aws/camel-aws2-eks/src/generated/resources/META-INF/org/apache/camel/component/aws2/eks/aws2-eks.json
+++ b/components/camel-aws/camel-aws2-eks/src/generated/resources/META-INF/org/apache/camel/component/aws2/eks/aws2-eks.json
@@ -53,7 +53,10 @@
"CamelAwsEKSDescription": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A key description to use while performing a createKey operation", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#DESCRIPTION" },
"CamelAwsEKSClusterName": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cluster name", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#CLUSTER_NAME" },
"CamelAwsEKSRoleARN": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The role ARN to use while creating the cluster", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#ROLE_ARN" },
- "CamelAwsEKSVPCConfig": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.eks.model.VpcConfigRequest", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The VPC config for the creations of an EKS cluster", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#VPC_CONFIG" }
+ "CamelAwsEKSVPCConfig": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.eks.model.VpcConfigRequest", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The VPC config for the creations of an EKS cluster", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#VPC_CONFIG" },
+ "CamelAwsEKSNextToken": { "index": 6, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The token for the next set of results.", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#NEXT_TOKEN" },
+ "CamelAwsEKSIsTruncated": { "index": 7, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#IS_TRUNCATED" },
+ "CamelAwsEKSClusterArn": { "index": 8, "kind": "header", "displayName": "", "group": "createCluster describeCluster deleteCluster", "label": "createCluster describeCluster deleteCluster", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of the cluster.", "constantName": "org.apache.camel.component.aws2.eks.EKS2Constants#CLUSTER_ARN" }
},
"properties": {
"label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eks.EKS2Configuration", "configurationField": "configuration", "description": "Logical name" },
diff --git a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Constants.java b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Constants.java
index f673f41ee0f5..f1ffaea2059f 100644
--- a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Constants.java
+++ b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Constants.java
@@ -35,4 +35,17 @@ public interface EKS2Constants {
@Metadata(description = "The VPC config for the creations of an EKS cluster",
javaType = "software.amazon.awssdk.services.eks.model.VpcConfigRequest")
String VPC_CONFIG = "CamelAwsEKSVPCConfig";
+
+ // Pagination constants
+ @Metadata(label = "listClusters",
+ description = "The token for the next set of results.", javaType = "String")
+ String NEXT_TOKEN = "CamelAwsEKSNextToken";
+ @Metadata(label = "listClusters",
+ description = "Whether the response has more results (is truncated).", javaType = "Boolean")
+ String IS_TRUNCATED = "CamelAwsEKSIsTruncated";
+
+ // Response metadata
+ @Metadata(label = "createCluster describeCluster deleteCluster",
+ description = "The ARN of the cluster.", javaType = "String")
+ String CLUSTER_ARN = "CamelAwsEKSClusterArn";
}
diff --git a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java
index e2eeaa0fa82a..d3efc22ec543 100644
--- a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java
+++ b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Producer.java
@@ -16,6 +16,10 @@
*/
package org.apache.camel.component.aws2.eks;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
@@ -100,147 +104,170 @@ public class EKS2Producer extends DefaultProducer {
}
private void listClusters(EksClient eksClient, Exchange exchange) throws InvalidPayloadException {
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof ListClustersRequest) {
- ListClustersResponse result;
- try {
- result = eksClient.listClusters((ListClustersRequest) payload);
- } catch (AwsServiceException ase) {
- LOG.trace("List Clusters command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- ListClustersRequest.Builder builder = ListClustersRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EKS2Constants.MAX_RESULTS))) {
- int maxRes = exchange.getIn().getHeader(EKS2Constants.MAX_RESULTS, Integer.class);
- builder.maxResults(maxRes);
- }
- ListClustersResponse result;
- try {
- result = eksClient.listClusters(builder.build());
- } catch (AwsServiceException ase) {
- LOG.trace("List Clusters command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ ListClustersRequest.class,
+ eksClient::listClusters,
+ () -> {
+ ListClustersRequest.Builder builder = ListClustersRequest.builder();
+ Integer maxResults = getOptionalHeader(exchange, EKS2Constants.MAX_RESULTS, Integer.class);
+ if (maxResults != null) {
+ builder.maxResults(maxResults);
+ }
+ String nextToken = getOptionalHeader(exchange, EKS2Constants.NEXT_TOKEN, String.class);
+ if (nextToken != null) {
+ builder.nextToken(nextToken);
+ }
+ return eksClient.listClusters(builder.build());
+ },
+ "List Clusters",
+ (ListClustersResponse response, Message message) -> {
+ message.setHeader(EKS2Constants.NEXT_TOKEN, response.nextToken());
+ message.setHeader(EKS2Constants.IS_TRUNCATED, response.nextToken() != null);
+ });
}
private void createCluster(EksClient eksClient, Exchange exchange) throws InvalidPayloadException {
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof CreateClusterRequest) {
- CreateClusterResponse result;
- try {
- result = eksClient.createCluster((CreateClusterRequest) payload);
- } catch (AwsServiceException ase) {
- LOG.trace("Create Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- CreateClusterRequest.Builder builder = CreateClusterRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EKS2Constants.CLUSTER_NAME))) {
- String name = exchange.getIn().getHeader(EKS2Constants.CLUSTER_NAME, String.class);
- builder.name(name);
- }
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EKS2Constants.ROLE_ARN))) {
- String roleArn = exchange.getIn().getHeader(EKS2Constants.ROLE_ARN, String.class);
- builder.roleArn(roleArn);
- }
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EKS2Constants.VPC_CONFIG))) {
- VpcConfigRequest vpcConfig = exchange.getIn().getHeader(EKS2Constants.VPC_CONFIG, VpcConfigRequest.class);
- builder.resourcesVpcConfig(vpcConfig);
- }
- CreateClusterResponse result;
- try {
- result = eksClient.createCluster(builder.build());
- } catch (AwsServiceException ase) {
- LOG.trace("Create Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ CreateClusterRequest.class,
+ eksClient::createCluster,
+ () -> {
+ CreateClusterRequest.Builder builder = CreateClusterRequest.builder();
+ String clusterName = getOptionalHeader(exchange, EKS2Constants.CLUSTER_NAME, String.class);
+ if (clusterName != null) {
+ builder.name(clusterName);
+ }
+ String roleArn = getOptionalHeader(exchange, EKS2Constants.ROLE_ARN, String.class);
+ if (roleArn != null) {
+ builder.roleArn(roleArn);
+ }
+ VpcConfigRequest vpcConfig = getOptionalHeader(exchange, EKS2Constants.VPC_CONFIG, VpcConfigRequest.class);
+ if (vpcConfig != null) {
+ builder.resourcesVpcConfig(vpcConfig);
+ }
+ return eksClient.createCluster(builder.build());
+ },
+ "Create Cluster",
+ (CreateClusterResponse response, Message message) -> {
+ if (response.cluster() != null) {
+ message.setHeader(EKS2Constants.CLUSTER_ARN, response.cluster().arn());
+ }
+ });
}
private void describeCluster(EksClient eksClient, Exchange exchange) throws InvalidPayloadException {
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof DescribeClusterRequest) {
- DescribeClusterResponse result;
- try {
- result = eksClient.describeCluster((DescribeClusterRequest) payload);
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- DescribeClusterRequest.Builder builder = DescribeClusterRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EKS2Constants.CLUSTER_NAME))) {
- String name = exchange.getIn().getHeader(EKS2Constants.CLUSTER_NAME, String.class);
- builder.name(name);
- } else {
- throw new IllegalArgumentException("Cluster name must be specified");
- }
- DescribeClusterResponse result;
- try {
- result = eksClient.describeCluster(builder.build());
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ DescribeClusterRequest.class,
+ eksClient::describeCluster,
+ () -> {
+ String clusterName = getRequiredHeader(exchange, EKS2Constants.CLUSTER_NAME, String.class,
+ "Cluster name must be specified");
+ return eksClient.describeCluster(DescribeClusterRequest.builder().name(clusterName).build());
+ },
+ "Describe Cluster",
+ (DescribeClusterResponse response, Message message) -> {
+ if (response.cluster() != null) {
+ message.setHeader(EKS2Constants.CLUSTER_ARN, response.cluster().arn());
+ }
+ });
}
private void deleteCluster(EksClient eksClient, Exchange exchange) throws InvalidPayloadException {
+ executeOperation(
+ exchange,
+ DeleteClusterRequest.class,
+ eksClient::deleteCluster,
+ () -> {
+ String clusterName = getRequiredHeader(exchange, EKS2Constants.CLUSTER_NAME, String.class,
+ "Cluster name must be specified");
+ return eksClient.deleteCluster(DeleteClusterRequest.builder().name(clusterName).build());
+ },
+ "Delete Cluster",
+ (DeleteClusterResponse response, Message message) -> {
+ if (response.cluster() != null) {
+ message.setHeader(EKS2Constants.CLUSTER_ARN, response.cluster().arn());
+ }
+ });
+ }
+
+ public static Message getMessageForResponse(final Exchange exchange) {
+ return exchange.getMessage();
+ }
+
+ /**
+ * Executes an EKS operation with POJO request support.
+ */
+ private <REQ, RES> void executeOperation(
+ Exchange exchange,
+ Class<REQ> requestClass,
+ Function<REQ, RES> pojoExecutor,
+ Supplier<RES> headerExecutor,
+ String operationName)
+ throws InvalidPayloadException {
+ executeOperation(exchange, requestClass, pojoExecutor, headerExecutor, operationName, null);
+ }
+
+ /**
+ * Executes an EKS operation with POJO request support and optional response post-processing.
+ */
+ private <REQ, RES> void executeOperation(
+ Exchange exchange,
+ Class<REQ> requestClass,
+ Function<REQ, RES> pojoExecutor,
+ Supplier<RES> headerExecutor,
+ String operationName,
+ BiConsumer<RES, Message> responseProcessor)
+ throws InvalidPayloadException {
+
+ RES result;
if (getConfiguration().isPojoRequest()) {
Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof DeleteClusterRequest) {
- DeleteClusterResponse result;
+ if (requestClass.isInstance(payload)) {
try {
- result = eksClient.deleteCluster((DeleteClusterRequest) payload);
+ result = pojoExecutor.apply(requestClass.cast(payload));
} catch (AwsServiceException ase) {
- LOG.trace("Delete Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
+ LOG.trace("{} command returned the error code {}", operationName, 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);
- builder.name(name);
} else {
- throw new IllegalArgumentException("Cluster name must be specified");
+ throw new IllegalArgumentException(
+ String.format("Expected body of type %s but was %s",
+ requestClass.getName(),
+ payload != null ? payload.getClass().getName() : "null"));
}
- DeleteClusterResponse result;
+ } else {
try {
- result = eksClient.deleteCluster(builder.build());
+ result = headerExecutor.get();
} catch (AwsServiceException ase) {
- LOG.trace("Delete Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
+ LOG.trace("{} command returned the error code {}", operationName, ase.awsErrorDetails().errorCode());
throw ase;
}
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
+ }
+ Message message = getMessageForResponse(exchange);
+ message.setBody(result);
+ if (responseProcessor != null) {
+ responseProcessor.accept(result, message);
}
}
- public static Message getMessageForResponse(final Exchange exchange) {
- return exchange.getMessage();
+ /**
+ * Gets a required header value or throws an IllegalArgumentException.
+ */
+ private <T> T getRequiredHeader(Exchange exchange, String headerName, Class<T> headerType, String errorMessage) {
+ T value = exchange.getIn().getHeader(headerName, headerType);
+ if (ObjectHelper.isEmpty(value)) {
+ throw new IllegalArgumentException(errorMessage);
+ }
+ return value;
+ }
+
+ /**
+ * Gets an optional header value.
+ */
+ private <T> T getOptionalHeader(Exchange exchange, String headerName, Class<T> headerType) {
+ return exchange.getIn().getHeader(headerName, headerType);
}
@Override
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EKS2EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EKS2EndpointBuilderFactory.java
index 9fe35407aec7..883938e82614 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EKS2EndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EKS2EndpointBuilderFactory.java
@@ -665,6 +665,42 @@ public interface EKS2EndpointBuilderFactory {
public String awsEKSVPCConfig() {
return "CamelAwsEKSVPCConfig";
}
+ /**
+ * The token for the next set of results.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: listClusters
+ *
+ * @return the name of the header {@code AwsEKSNextToken}.
+ */
+ public String awsEKSNextToken() {
+ return "CamelAwsEKSNextToken";
+ }
+ /**
+ * Whether the response has more results (is truncated).
+ *
+ * The option is a: {@code Boolean} type.
+ *
+ * Group: listClusters
+ *
+ * @return the name of the header {@code AwsEKSIsTruncated}.
+ */
+ public String awsEKSIsTruncated() {
+ return "CamelAwsEKSIsTruncated";
+ }
+ /**
+ * The ARN of the cluster.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: createCluster describeCluster deleteCluster
+ *
+ * @return the name of the header {@code AwsEKSClusterArn}.
+ */
+ public String awsEKSClusterArn() {
+ return "CamelAwsEKSClusterArn";
+ }
}
static EKS2EndpointBuilder endpointBuilder(String componentName, String path) {
class EKS2EndpointBuilderImpl extends AbstractEndpointBuilder implements EKS2EndpointBuilder, AdvancedEKS2EndpointBuilder {
(camel) 01/03: CAMEL-22836 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS EC2
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit e487543a03ed634bb960d3a1215e72f7fd26df29
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jan 12 10:58:50 2026 +0100
CAMEL-22836 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS EC2
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../apache/camel/catalog/components/aws2-ec2.json | 5 +-
.../apache/camel/component/aws2/ec2/aws2-ec2.json | 5 +-
.../camel/component/aws2/ec2/AWS2EC2Constants.java | 11 ++
.../camel/component/aws2/ec2/AWS2EC2Producer.java | 192 ++++++++++++++-------
.../dsl/AWS2EC2EndpointBuilderFactory.java | 36 ++++
5 files changed, 186 insertions(+), 63 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json
index a6024e2af066..ebcade652c27 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json
@@ -62,7 +62,10 @@
"CamelAwsEC2InstancesClientToken": { "index": 11, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Unique, case-sensitive identifier you provide to ensure the idempotency of the request.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#INSTANCES_CLIENT_TOKEN" },
"CamelAwsEC2InstancesPlacement": { "index": 12, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.ec2.model.Placement", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The placement for the instance.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#INSTANCES_PLACEMENT" },
"CamelAwsEC2InstancesTags": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Collection<Tag>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A collection of tags to add or remove from EC2 resources", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#INSTANCES_TAGS" },
- "CamelAwsEC2SubnetId": { "index": 14, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of the subnet to launch the instance into.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#SUBNET_ID" }
+ "CamelAwsEC2SubnetId": { "index": 14, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of the subnet to launch the instance into.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#SUBNET_ID" },
+ "CamelAwsEC2NextToken": { "index": 15, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The token for the next set of results.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#NEXT_TOKEN" },
+ "CamelAwsEC2MaxResults": { "index": 16, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of results to return.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#MAX_RESULTS" },
+ "CamelAwsEC2IsTruncated": { "index": 17, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#IS_TRUNCATED" }
},
"properties": {
"label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ec2.AWS2EC2Configuration", "configurationField": "configuration", "description": "Logical name" },
diff --git a/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json b/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json
index a6024e2af066..ebcade652c27 100644
--- a/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json
+++ b/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json
@@ -62,7 +62,10 @@
"CamelAwsEC2InstancesClientToken": { "index": 11, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Unique, case-sensitive identifier you provide to ensure the idempotency of the request.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#INSTANCES_CLIENT_TOKEN" },
"CamelAwsEC2InstancesPlacement": { "index": 12, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.ec2.model.Placement", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The placement for the instance.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#INSTANCES_PLACEMENT" },
"CamelAwsEC2InstancesTags": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Collection<Tag>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A collection of tags to add or remove from EC2 resources", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#INSTANCES_TAGS" },
- "CamelAwsEC2SubnetId": { "index": 14, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of the subnet to launch the instance into.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#SUBNET_ID" }
+ "CamelAwsEC2SubnetId": { "index": 14, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of the subnet to launch the instance into.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#SUBNET_ID" },
+ "CamelAwsEC2NextToken": { "index": 15, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The token for the next set of results.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#NEXT_TOKEN" },
+ "CamelAwsEC2MaxResults": { "index": 16, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of results to return.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#MAX_RESULTS" },
+ "CamelAwsEC2IsTruncated": { "index": 17, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#IS_TRUNCATED" }
},
"properties": {
"label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ec2.AWS2EC2Configuration", "configurationField": "configuration", "description": "Logical name" },
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Constants.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Constants.java
index 263ac736ff79..fa4df10adecb 100644
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Constants.java
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Constants.java
@@ -57,4 +57,15 @@ public interface AWS2EC2Constants {
String INSTANCES_TAGS = "CamelAwsEC2InstancesTags";
@Metadata(description = "The ID of the subnet to launch the instance into.", javaType = "String")
String SUBNET_ID = "CamelAwsEC2SubnetId";
+
+ // Pagination constants
+ @Metadata(label = "describeInstances describeInstancesStatus",
+ description = "The token for the next set of results.", javaType = "String")
+ String NEXT_TOKEN = "CamelAwsEC2NextToken";
+ @Metadata(label = "describeInstances describeInstancesStatus",
+ description = "The maximum number of results to return.", javaType = "Integer")
+ String MAX_RESULTS = "CamelAwsEC2MaxResults";
+ @Metadata(label = "describeInstances describeInstancesStatus",
+ description = "Whether the response has more results (is truncated).", javaType = "Boolean")
+ String IS_TRUNCATED = "CamelAwsEC2IsTruncated";
}
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java
index b84f87b90d1b..7b39b752d3f0 100644
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java
@@ -18,6 +18,9 @@ package org.apache.camel.component.aws2.ec2;
import java.util.Arrays;
import java.util.Collection;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
@@ -360,71 +363,62 @@ public class AWS2EC2Producer extends DefaultProducer {
@SuppressWarnings("unchecked")
private void describeInstances(Ec2Client ec2Client, Exchange exchange) throws InvalidPayloadException {
- Collection<String> instanceIds;
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof DescribeInstancesRequest) {
- DescribeInstancesResponse result;
- try {
- result = ec2Client.describeInstances((DescribeInstancesRequest) payload);
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Instances command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- DescribeInstancesRequest.Builder builder = DescribeInstancesRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
- instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
- builder.instanceIds(instanceIds);
- }
- DescribeInstancesResponse result;
- try {
- result = ec2Client.describeInstances(builder.build());
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Instances command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ DescribeInstancesRequest.class,
+ ec2Client::describeInstances,
+ () -> {
+ DescribeInstancesRequest.Builder builder = DescribeInstancesRequest.builder();
+ Collection<String> instanceIds
+ = getOptionalHeader(exchange, AWS2EC2Constants.INSTANCES_IDS, Collection.class);
+ if (instanceIds != null) {
+ builder.instanceIds(instanceIds);
+ }
+ String nextToken = getOptionalHeader(exchange, AWS2EC2Constants.NEXT_TOKEN, String.class);
+ if (nextToken != null) {
+ builder.nextToken(nextToken);
+ }
+ Integer maxResults = getOptionalHeader(exchange, AWS2EC2Constants.MAX_RESULTS, Integer.class);
+ if (maxResults != null) {
+ builder.maxResults(maxResults);
+ }
+ return ec2Client.describeInstances(builder.build());
+ },
+ "Describe Instances",
+ (DescribeInstancesResponse response, Message message) -> {
+ message.setHeader(AWS2EC2Constants.NEXT_TOKEN, response.nextToken());
+ message.setHeader(AWS2EC2Constants.IS_TRUNCATED, response.nextToken() != null);
+ });
}
@SuppressWarnings("unchecked")
private void describeInstancesStatus(Ec2Client ec2Client, Exchange exchange) throws InvalidPayloadException {
- Collection<String> instanceIds;
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof DescribeInstanceStatusRequest) {
- DescribeInstanceStatusResponse result;
- try {
- result = ec2Client.describeInstanceStatus((DescribeInstanceStatusRequest) payload);
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Instances Status command returned the error code {}",
- ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- DescribeInstanceStatusRequest.Builder builder = DescribeInstanceStatusRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
- instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
- builder.instanceIds(instanceIds);
- }
- DescribeInstanceStatusResponse result;
- try {
- result = ec2Client.describeInstanceStatus(builder.build());
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Instances Status command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ DescribeInstanceStatusRequest.class,
+ ec2Client::describeInstanceStatus,
+ () -> {
+ DescribeInstanceStatusRequest.Builder builder = DescribeInstanceStatusRequest.builder();
+ Collection<String> instanceIds
+ = getOptionalHeader(exchange, AWS2EC2Constants.INSTANCES_IDS, Collection.class);
+ if (instanceIds != null) {
+ builder.instanceIds(instanceIds);
+ }
+ String nextToken = getOptionalHeader(exchange, AWS2EC2Constants.NEXT_TOKEN, String.class);
+ if (nextToken != null) {
+ builder.nextToken(nextToken);
+ }
+ Integer maxResults = getOptionalHeader(exchange, AWS2EC2Constants.MAX_RESULTS, Integer.class);
+ if (maxResults != null) {
+ builder.maxResults(maxResults);
+ }
+ return ec2Client.describeInstanceStatus(builder.build());
+ },
+ "Describe Instances Status",
+ (DescribeInstanceStatusResponse response, Message message) -> {
+ message.setHeader(AWS2EC2Constants.NEXT_TOKEN, response.nextToken());
+ message.setHeader(AWS2EC2Constants.IS_TRUNCATED, response.nextToken() != null);
+ });
}
@SuppressWarnings("unchecked")
@@ -648,6 +642,82 @@ public class AWS2EC2Producer extends DefaultProducer {
return exchange.getMessage();
}
+ /**
+ * Executes an EC2 operation with POJO request support.
+ */
+ private <REQ, RES> void executeOperation(
+ Exchange exchange,
+ Class<REQ> requestClass,
+ Function<REQ, RES> pojoExecutor,
+ Supplier<RES> headerExecutor,
+ String operationName)
+ throws InvalidPayloadException {
+ executeOperation(exchange, requestClass, pojoExecutor, headerExecutor, operationName, null);
+ }
+
+ /**
+ * Executes an EC2 operation with POJO request support and optional response post-processing.
+ */
+ private <REQ, RES> void executeOperation(
+ Exchange exchange,
+ Class<REQ> requestClass,
+ Function<REQ, RES> pojoExecutor,
+ Supplier<RES> headerExecutor,
+ String operationName,
+ BiConsumer<RES, Message> responseProcessor)
+ throws InvalidPayloadException {
+
+ RES result;
+ if (getConfiguration().isPojoRequest()) {
+ Object payload = exchange.getIn().getMandatoryBody();
+ if (requestClass.isInstance(payload)) {
+ try {
+ result = pojoExecutor.apply(requestClass.cast(payload));
+ } catch (AwsServiceException ase) {
+ LOG.trace("{} command returned the error code {}", operationName, ase.awsErrorDetails().errorCode());
+ throw ase;
+ }
+ LOG.trace("{} request performing", operationName);
+ } else {
+ throw new IllegalArgumentException(
+ String.format("Expected body of type %s but was %s",
+ requestClass.getName(),
+ payload != null ? payload.getClass().getName() : "null"));
+ }
+ } else {
+ try {
+ result = headerExecutor.get();
+ } catch (AwsServiceException ase) {
+ LOG.trace("{} command returned the error code {}", operationName, ase.awsErrorDetails().errorCode());
+ throw ase;
+ }
+ }
+ Message message = getMessageForResponse(exchange);
+ message.setBody(result);
+ if (responseProcessor != null) {
+ responseProcessor.accept(result, message);
+ }
+ }
+
+ /**
+ * Gets a required header value or throws an IllegalArgumentException.
+ */
+ @SuppressWarnings("unchecked")
+ private <T> T getRequiredHeader(Exchange exchange, String headerName, Class<T> headerType, String errorMessage) {
+ T value = exchange.getIn().getHeader(headerName, headerType);
+ if (ObjectHelper.isEmpty(value)) {
+ throw new IllegalArgumentException(errorMessage);
+ }
+ return value;
+ }
+
+ /**
+ * Gets an optional header value.
+ */
+ private <T> T getOptionalHeader(Exchange exchange, String headerName, Class<T> headerType) {
+ return exchange.getIn().getHeader(headerName, headerType);
+ }
+
@Override
protected void doStart() throws Exception {
// health-check is optional so discover and resolve
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2EC2EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2EC2EndpointBuilderFactory.java
index 606df57157c7..1513146f371e 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2EC2EndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2EC2EndpointBuilderFactory.java
@@ -783,6 +783,42 @@ public interface AWS2EC2EndpointBuilderFactory {
public String awsEC2SubnetId() {
return "CamelAwsEC2SubnetId";
}
+ /**
+ * The token for the next set of results.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: describeInstances describeInstancesStatus
+ *
+ * @return the name of the header {@code AwsEC2NextToken}.
+ */
+ public String awsEC2NextToken() {
+ return "CamelAwsEC2NextToken";
+ }
+ /**
+ * The maximum number of results to return.
+ *
+ * The option is a: {@code Integer} type.
+ *
+ * Group: describeInstances describeInstancesStatus
+ *
+ * @return the name of the header {@code AwsEC2MaxResults}.
+ */
+ public String awsEC2MaxResults() {
+ return "CamelAwsEC2MaxResults";
+ }
+ /**
+ * Whether the response has more results (is truncated).
+ *
+ * The option is a: {@code Boolean} type.
+ *
+ * Group: describeInstances describeInstancesStatus
+ *
+ * @return the name of the header {@code AwsEC2IsTruncated}.
+ */
+ public String awsEC2IsTruncated() {
+ return "CamelAwsEC2IsTruncated";
+ }
}
static AWS2EC2EndpointBuilder endpointBuilder(String componentName, String path) {
class AWS2EC2EndpointBuilderImpl extends AbstractEndpointBuilder implements AWS2EC2EndpointBuilder, AdvancedAWS2EC2EndpointBuilder {
(camel) 02/03: CAMEL-22837 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS ECS
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit df8fc9d5f57117f03f2b5455f4fec3370328ccf6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jan 12 11:21:50 2026 +0100
CAMEL-22837 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS ECS
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../apache/camel/catalog/components/aws2-ecs.json | 5 +-
.../apache/camel/component/aws2/ecs/aws2-ecs.json | 5 +-
.../camel/component/aws2/ecs/ECS2Constants.java | 13 ++
.../camel/component/aws2/ecs/ECS2Producer.java | 255 +++++++++++----------
.../endpoint/dsl/ECS2EndpointBuilderFactory.java | 36 +++
5 files changed, 196 insertions(+), 118 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ecs.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ecs.json
index 45e2e59b3002..0d6ff7b6f617 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ecs.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ecs.json
@@ -50,7 +50,10 @@
"headers": {
"CamelAwsECSOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation we want to perform", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#OPERATION" },
"CamelAwsECSMaxResults": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The limit number of results while listing clusters", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#MAX_RESULTS" },
- "CamelAwsECSClusterName": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cluster name", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#CLUSTER_NAME" }
+ "CamelAwsECSClusterName": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cluster name", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#CLUSTER_NAME" },
+ "CamelAwsECSNextToken": { "index": 3, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The token for the next set of results.", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#NEXT_TOKEN" },
+ "CamelAwsECSIsTruncated": { "index": 4, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#IS_TRUNCATED" },
+ "CamelAwsECSClusterArn": { "index": 5, "kind": "header", "displayName": "", "group": "createCluster describeCluster deleteCluster", "label": "createCluster describeCluster deleteCluster", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of the cluster.", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#CLUSTER_ARN" }
},
"properties": {
"label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ecs.ECS2Configuration", "configurationField": "configuration", "description": "Logical name" },
diff --git a/components/camel-aws/camel-aws2-ecs/src/generated/resources/META-INF/org/apache/camel/component/aws2/ecs/aws2-ecs.json b/components/camel-aws/camel-aws2-ecs/src/generated/resources/META-INF/org/apache/camel/component/aws2/ecs/aws2-ecs.json
index 45e2e59b3002..0d6ff7b6f617 100644
--- a/components/camel-aws/camel-aws2-ecs/src/generated/resources/META-INF/org/apache/camel/component/aws2/ecs/aws2-ecs.json
+++ b/components/camel-aws/camel-aws2-ecs/src/generated/resources/META-INF/org/apache/camel/component/aws2/ecs/aws2-ecs.json
@@ -50,7 +50,10 @@
"headers": {
"CamelAwsECSOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation we want to perform", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#OPERATION" },
"CamelAwsECSMaxResults": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The limit number of results while listing clusters", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#MAX_RESULTS" },
- "CamelAwsECSClusterName": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cluster name", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#CLUSTER_NAME" }
+ "CamelAwsECSClusterName": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cluster name", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#CLUSTER_NAME" },
+ "CamelAwsECSNextToken": { "index": 3, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The token for the next set of results.", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#NEXT_TOKEN" },
+ "CamelAwsECSIsTruncated": { "index": 4, "kind": "header", "displayName": "", "group": "listClusters", "label": "listClusters", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#IS_TRUNCATED" },
+ "CamelAwsECSClusterArn": { "index": 5, "kind": "header", "displayName": "", "group": "createCluster describeCluster deleteCluster", "label": "createCluster describeCluster deleteCluster", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of the cluster.", "constantName": "org.apache.camel.component.aws2.ecs.ECS2Constants#CLUSTER_ARN" }
},
"properties": {
"label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ecs.ECS2Configuration", "configurationField": "configuration", "description": "Logical name" },
diff --git a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Constants.java b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Constants.java
index bf228eb1d5fd..b3ba78c89ca8 100644
--- a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Constants.java
+++ b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Constants.java
@@ -28,4 +28,17 @@ public interface ECS2Constants {
String MAX_RESULTS = "CamelAwsECSMaxResults";
@Metadata(description = "The cluster name", javaType = "String")
String CLUSTER_NAME = "CamelAwsECSClusterName";
+
+ // Pagination constants
+ @Metadata(label = "listClusters",
+ description = "The token for the next set of results.", javaType = "String")
+ String NEXT_TOKEN = "CamelAwsECSNextToken";
+ @Metadata(label = "listClusters",
+ description = "Whether the response has more results (is truncated).", javaType = "Boolean")
+ String IS_TRUNCATED = "CamelAwsECSIsTruncated";
+
+ // Response metadata
+ @Metadata(label = "createCluster describeCluster deleteCluster",
+ description = "The ARN of the cluster.", javaType = "String")
+ String CLUSTER_ARN = "CamelAwsECSClusterArn";
}
diff --git a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Producer.java b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Producer.java
index 4b32ae30c226..49a40337e00b 100644
--- a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Producer.java
+++ b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Producer.java
@@ -16,6 +16,10 @@
*/
package org.apache.camel.component.aws2.ecs;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
@@ -37,7 +41,6 @@ import software.amazon.awssdk.services.ecs.model.DeleteClusterResponse;
import software.amazon.awssdk.services.ecs.model.DescribeClustersRequest;
import software.amazon.awssdk.services.ecs.model.DescribeClustersResponse;
import software.amazon.awssdk.services.ecs.model.ListClustersRequest;
-import software.amazon.awssdk.services.ecs.model.ListClustersRequest.Builder;
import software.amazon.awssdk.services.ecs.model.ListClustersResponse;
/**
@@ -101,145 +104,165 @@ public class ECS2Producer extends DefaultProducer {
}
private void listClusters(EcsClient ecsClient, Exchange exchange) throws InvalidPayloadException {
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof ListClustersRequest) {
- ListClustersResponse result;
- try {
- ListClustersRequest request = (ListClustersRequest) payload;
- result = ecsClient.listClusters(request);
- } catch (AwsServiceException ase) {
- LOG.trace("List Clusters command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- Builder builder = ListClustersRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(ECS2Constants.MAX_RESULTS))) {
- int maxRes = exchange.getIn().getHeader(ECS2Constants.MAX_RESULTS, Integer.class);
- builder.maxResults(maxRes);
- }
- ListClustersResponse result;
- try {
- ListClustersRequest request = builder.build();
- result = ecsClient.listClusters(request);
- } catch (AwsServiceException ase) {
- LOG.trace("List Clusters command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ ListClustersRequest.class,
+ ecsClient::listClusters,
+ () -> {
+ ListClustersRequest.Builder builder = ListClustersRequest.builder();
+ Integer maxResults = getOptionalHeader(exchange, ECS2Constants.MAX_RESULTS, Integer.class);
+ if (maxResults != null) {
+ builder.maxResults(maxResults);
+ }
+ String nextToken = getOptionalHeader(exchange, ECS2Constants.NEXT_TOKEN, String.class);
+ if (nextToken != null) {
+ builder.nextToken(nextToken);
+ }
+ return ecsClient.listClusters(builder.build());
+ },
+ "List Clusters",
+ (ListClustersResponse response, Message message) -> {
+ message.setHeader(ECS2Constants.NEXT_TOKEN, response.nextToken());
+ message.setHeader(ECS2Constants.IS_TRUNCATED, response.nextToken() != null);
+ });
}
private void createCluster(EcsClient ecsClient, Exchange exchange) throws InvalidPayloadException {
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof CreateClusterRequest) {
- CreateClusterResponse result;
- try {
- CreateClusterRequest request = (CreateClusterRequest) payload;
- result = ecsClient.createCluster(request);
- } catch (AwsServiceException ase) {
- LOG.trace("Create Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- CreateClusterRequest.Builder builder = CreateClusterRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(ECS2Constants.CLUSTER_NAME))) {
- String name = exchange.getIn().getHeader(ECS2Constants.CLUSTER_NAME, String.class);
- builder.clusterName(name);
- }
- CreateClusterResponse result;
- try {
- CreateClusterRequest request = builder.build();
- result = ecsClient.createCluster(request);
- } catch (AwsServiceException ase) {
- LOG.trace("Create Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ CreateClusterRequest.class,
+ ecsClient::createCluster,
+ () -> {
+ CreateClusterRequest.Builder builder = CreateClusterRequest.builder();
+ String clusterName = getOptionalHeader(exchange, ECS2Constants.CLUSTER_NAME, String.class);
+ if (clusterName != null) {
+ builder.clusterName(clusterName);
+ }
+ return ecsClient.createCluster(builder.build());
+ },
+ "Create Cluster",
+ (CreateClusterResponse response, Message message) -> {
+ if (response.cluster() != null) {
+ message.setHeader(ECS2Constants.CLUSTER_ARN, response.cluster().clusterArn());
+ }
+ });
}
private void describeCluster(EcsClient ecsClient, Exchange exchange) throws InvalidPayloadException {
- if (getConfiguration().isPojoRequest()) {
- Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof DescribeClustersRequest) {
- DescribeClustersResponse result;
- try {
- DescribeClustersRequest request = (DescribeClustersRequest) payload;
- result = ecsClient.describeClusters(request);
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Clusters command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- DescribeClustersRequest.Builder builder = DescribeClustersRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(ECS2Constants.CLUSTER_NAME))) {
- String clusterName = exchange.getIn().getHeader(ECS2Constants.CLUSTER_NAME, String.class);
- builder.clusters(clusterName);
- }
- DescribeClustersResponse result;
- try {
- DescribeClustersRequest request = builder.build();
- result = ecsClient.describeClusters(request);
- } catch (AwsServiceException ase) {
- LOG.trace("Describe Clusters command returned the error code {}", ase.awsErrorDetails().errorCode());
- throw ase;
- }
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
+ executeOperation(
+ exchange,
+ DescribeClustersRequest.class,
+ ecsClient::describeClusters,
+ () -> {
+ DescribeClustersRequest.Builder builder = DescribeClustersRequest.builder();
+ String clusterName = getOptionalHeader(exchange, ECS2Constants.CLUSTER_NAME, String.class);
+ if (clusterName != null) {
+ builder.clusters(clusterName);
+ }
+ return ecsClient.describeClusters(builder.build());
+ },
+ "Describe Clusters",
+ (DescribeClustersResponse response, Message message) -> {
+ if (response.hasClusters() && !response.clusters().isEmpty()) {
+ message.setHeader(ECS2Constants.CLUSTER_ARN, response.clusters().get(0).clusterArn());
+ }
+ });
}
private void deleteCluster(EcsClient ecsClient, Exchange exchange) throws InvalidPayloadException {
+ executeOperation(
+ exchange,
+ DeleteClusterRequest.class,
+ ecsClient::deleteCluster,
+ () -> {
+ String clusterName = getRequiredHeader(exchange, ECS2Constants.CLUSTER_NAME, String.class,
+ "Cluster name must be specified");
+ return ecsClient.deleteCluster(DeleteClusterRequest.builder().cluster(clusterName).build());
+ },
+ "Delete Cluster",
+ (DeleteClusterResponse response, Message message) -> {
+ if (response.cluster() != null) {
+ message.setHeader(ECS2Constants.CLUSTER_ARN, response.cluster().clusterArn());
+ }
+ });
+ }
+
+ public static Message getMessageForResponse(final Exchange exchange) {
+ return exchange.getMessage();
+ }
+
+ /**
+ * Executes an ECS operation with POJO request support.
+ */
+ private <REQ, RES> void executeOperation(
+ Exchange exchange,
+ Class<REQ> requestClass,
+ Function<REQ, RES> pojoExecutor,
+ Supplier<RES> headerExecutor,
+ String operationName)
+ throws InvalidPayloadException {
+ executeOperation(exchange, requestClass, pojoExecutor, headerExecutor, operationName, null);
+ }
+
+ /**
+ * Executes an ECS operation with POJO request support and optional response post-processing.
+ */
+ private <REQ, RES> void executeOperation(
+ Exchange exchange,
+ Class<REQ> requestClass,
+ Function<REQ, RES> pojoExecutor,
+ Supplier<RES> headerExecutor,
+ String operationName,
+ BiConsumer<RES, Message> responseProcessor)
+ throws InvalidPayloadException {
+
+ RES result;
if (getConfiguration().isPojoRequest()) {
Object payload = exchange.getIn().getMandatoryBody();
- if (payload instanceof DeleteClusterRequest) {
- DeleteClusterResponse result;
+ if (requestClass.isInstance(payload)) {
try {
- DeleteClusterRequest request = (DeleteClusterRequest) payload;
- result = ecsClient.deleteCluster(request);
+ result = pojoExecutor.apply(requestClass.cast(payload));
} catch (AwsServiceException ase) {
- LOG.trace("Delete Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
+ LOG.trace("{} command returned the error code {}", operationName, ase.awsErrorDetails().errorCode());
throw ase;
}
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
- }
- } else {
- DeleteClusterRequest.Builder builder = DeleteClusterRequest.builder();
- if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(ECS2Constants.CLUSTER_NAME))) {
- String name = exchange.getIn().getHeader(ECS2Constants.CLUSTER_NAME, String.class);
- builder.cluster(name);
} else {
- throw new IllegalArgumentException("Cluster name must be specified");
+ throw new IllegalArgumentException(
+ String.format("Expected body of type %s but was %s",
+ requestClass.getName(),
+ payload != null ? payload.getClass().getName() : "null"));
}
- DeleteClusterResponse result;
+ } else {
try {
- DeleteClusterRequest request = builder.build();
- result = ecsClient.deleteCluster(request);
+ result = headerExecutor.get();
} catch (AwsServiceException ase) {
- LOG.trace("Delete Cluster command returned the error code {}", ase.awsErrorDetails().errorCode());
+ LOG.trace("{} command returned the error code {}", operationName, ase.awsErrorDetails().errorCode());
throw ase;
}
- Message message = getMessageForResponse(exchange);
- message.setBody(result);
+ }
+ Message message = getMessageForResponse(exchange);
+ message.setBody(result);
+ if (responseProcessor != null) {
+ responseProcessor.accept(result, message);
}
}
- public static Message getMessageForResponse(final Exchange exchange) {
- return exchange.getMessage();
+ /**
+ * Gets a required header value or throws an IllegalArgumentException.
+ */
+ private <T> T getRequiredHeader(Exchange exchange, String headerName, Class<T> headerType, String errorMessage) {
+ T value = exchange.getIn().getHeader(headerName, headerType);
+ if (ObjectHelper.isEmpty(value)) {
+ throw new IllegalArgumentException(errorMessage);
+ }
+ return value;
+ }
+
+ /**
+ * Gets an optional header value.
+ */
+ private <T> T getOptionalHeader(Exchange exchange, String headerName, Class<T> headerType) {
+ return exchange.getIn().getHeader(headerName, headerType);
}
@Override
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ECS2EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ECS2EndpointBuilderFactory.java
index 89b2befe7871..c964a3c5de08 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ECS2EndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ECS2EndpointBuilderFactory.java
@@ -627,6 +627,42 @@ public interface ECS2EndpointBuilderFactory {
public String awsECSClusterName() {
return "CamelAwsECSClusterName";
}
+ /**
+ * The token for the next set of results.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: listClusters
+ *
+ * @return the name of the header {@code AwsECSNextToken}.
+ */
+ public String awsECSNextToken() {
+ return "CamelAwsECSNextToken";
+ }
+ /**
+ * Whether the response has more results (is truncated).
+ *
+ * The option is a: {@code Boolean} type.
+ *
+ * Group: listClusters
+ *
+ * @return the name of the header {@code AwsECSIsTruncated}.
+ */
+ public String awsECSIsTruncated() {
+ return "CamelAwsECSIsTruncated";
+ }
+ /**
+ * The ARN of the cluster.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: createCluster describeCluster deleteCluster
+ *
+ * @return the name of the header {@code AwsECSClusterArn}.
+ */
+ public String awsECSClusterArn() {
+ return "CamelAwsECSClusterArn";
+ }
}
static ECS2EndpointBuilder endpointBuilder(String componentName, String path) {
class ECS2EndpointBuilderImpl extends AbstractEndpointBuilder implements ECS2EndpointBuilder, AdvancedECS2EndpointBuilder {