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 00e591af50679defd96e59bc903a2499a25e5984 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Wed Nov 4 09:19:24 2020 +0100 CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - AWS2-SQS Regen --- .../camel/catalog/docs/aws2-sqs-component.adoc | 6 +- .../aws2/sqs/Sqs2ComponentConfigurer.java | 5 ++ .../component/aws2/sqs/Sqs2EndpointConfigurer.java | 5 ++ .../component/aws2/sqs/Sqs2EndpointUriFactory.java | 3 +- .../apache/camel/component/aws2/sqs/aws2-sqs.json | 2 + .../src/main/docs/aws2-sqs-component.adoc | 6 +- .../component/aws2/sqs/Sqs2Configuration.java | 21 +++--- .../camel/component/aws2/sqs/Sqs2Endpoint.java | 1 - .../aws2/sqs/client/Sqs2InternalClient.java | 4 +- .../sqs/client/impl/Sqs2ClientIAMOptimized.java | 7 +- .../sqs/client/impl/Sqs2ClientStandardImpl.java | 6 +- .../dsl/Aws2SqsComponentBuilderFactory.java | 15 ++++ .../endpoint/dsl/Sqs2EndpointBuilderFactory.java | 82 ++++++++++++++++++++++ .../modules/ROOT/pages/aws2-sqs-component.adoc | 6 +- 14 files changed, 141 insertions(+), 28 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc index affd4c1..b79bc60 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc @@ -43,7 +43,7 @@ The queue will be created if they don't already exists. + // component options: START -The AWS 2 Simple Queue Service (SQS) component supports 40 options, which are listed below. +The AWS 2 Simple Queue Service (SQS) component supports 41 options, which are listed below. @@ -60,6 +60,7 @@ The AWS 2 Simple Queue Service (SQS) component supports 40 options, which are li | *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String | *region* (common) | The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String | *trustAllCertificates* (common) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *useIAMCredentials* (common) | Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to be passed in. | false | boolean | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int @@ -119,7 +120,7 @@ with the following path and query parameters: |=== -=== Query Parameters (60 parameters): +=== Query Parameters (61 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -135,6 +136,7 @@ with the following path and query parameters: | *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String | *region* (common) | The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String | *trustAllCertificates* (common) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *useIAMCredentials* (common) | Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to be passed in. | false | boolean | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int diff --git a/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2ComponentConfigurer.java b/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2ComponentConfigurer.java index f090774..be95943 100644 --- a/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2ComponentConfigurer.java +++ b/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2ComponentConfigurer.java @@ -29,6 +29,7 @@ public class Sqs2ComponentConfigurer extends PropertyConfigurerSupport implement map.put("queueOwnerAWSAccountId", java.lang.String.class); map.put("region", java.lang.String.class); map.put("trustAllCertificates", boolean.class); + map.put("useIAMCredentials", boolean.class); map.put("attributeNames", java.lang.String.class); map.put("bridgeErrorHandler", boolean.class); map.put("concurrentConsumers", int.class); @@ -145,6 +146,8 @@ public class Sqs2ComponentConfigurer extends PropertyConfigurerSupport implement case "serverSideEncryptionEnabled": getOrCreateConfiguration(target).setServerSideEncryptionEnabled(property(camelContext, boolean.class, value)); return true; case "trustallcertificates": case "trustAllCertificates": getOrCreateConfiguration(target).setTrustAllCertificates(property(camelContext, boolean.class, value)); return true; + case "useiamcredentials": + case "useIAMCredentials": getOrCreateConfiguration(target).setUseIAMCredentials(property(camelContext, boolean.class, value)); return true; case "visibilitytimeout": case "visibilityTimeout": getOrCreateConfiguration(target).setVisibilityTimeout(property(camelContext, java.lang.Integer.class, value)); return true; case "waittimeseconds": @@ -240,6 +243,8 @@ public class Sqs2ComponentConfigurer extends PropertyConfigurerSupport implement case "serverSideEncryptionEnabled": return getOrCreateConfiguration(target).isServerSideEncryptionEnabled(); case "trustallcertificates": case "trustAllCertificates": return getOrCreateConfiguration(target).isTrustAllCertificates(); + case "useiamcredentials": + case "useIAMCredentials": return getOrCreateConfiguration(target).isUseIAMCredentials(); case "visibilitytimeout": case "visibilityTimeout": return getOrCreateConfiguration(target).getVisibilityTimeout(); case "waittimeseconds": diff --git a/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointConfigurer.java b/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointConfigurer.java index 5314c25..a6b602d 100644 --- a/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointConfigurer.java +++ b/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointConfigurer.java @@ -30,6 +30,7 @@ public class Sqs2EndpointConfigurer extends PropertyConfigurerSupport implements map.put("queueOwnerAWSAccountId", java.lang.String.class); map.put("region", java.lang.String.class); map.put("trustAllCertificates", boolean.class); + map.put("useIAMCredentials", boolean.class); map.put("attributeNames", java.lang.String.class); map.put("bridgeErrorHandler", boolean.class); map.put("concurrentConsumers", int.class); @@ -196,6 +197,8 @@ public class Sqs2EndpointConfigurer extends PropertyConfigurerSupport implements case "trustAllCertificates": target.getConfiguration().setTrustAllCertificates(property(camelContext, boolean.class, value)); return true; case "usefixeddelay": case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true; + case "useiamcredentials": + case "useIAMCredentials": target.getConfiguration().setUseIAMCredentials(property(camelContext, boolean.class, value)); return true; case "visibilitytimeout": case "visibilityTimeout": target.getConfiguration().setVisibilityTimeout(property(camelContext, java.lang.Integer.class, value)); return true; case "waittimeseconds": @@ -328,6 +331,8 @@ public class Sqs2EndpointConfigurer extends PropertyConfigurerSupport implements case "trustAllCertificates": return target.getConfiguration().isTrustAllCertificates(); case "usefixeddelay": case "useFixedDelay": return target.isUseFixedDelay(); + case "useiamcredentials": + case "useIAMCredentials": return target.getConfiguration().isUseIAMCredentials(); case "visibilitytimeout": case "visibilityTimeout": return target.getConfiguration().getVisibilityTimeout(); case "waittimeseconds": diff --git a/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointUriFactory.java b/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointUriFactory.java index a18280f..5fe5473 100644 --- a/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointUriFactory.java +++ b/components/camel-aws2-sqs/src/generated/java/org/apache/camel/component/aws2/sqs/Sqs2EndpointUriFactory.java @@ -20,7 +20,8 @@ public class Sqs2EndpointUriFactory extends org.apache.camel.support.component.E private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { - Set<String> props = new HashSet<>(61); + Set<String> props = new HashSet<>(62); + props.add("useIAMCredentials"); props.add("synchronous"); props.add("queueUrl"); props.add("initialDelay"); diff --git a/components/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json b/components/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json index 465eef5..e396361 100644 --- a/components/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json +++ b/components/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json @@ -32,6 +32,7 @@ "queueOwnerAWSAccountId": { "kind": "property", "displayName": "Queue Owner AWSAccount Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Specify the queue owner aws account id when you need to connect the queue with different account owner." }, "region": { "kind": "property", "displayName": "Region", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1 [...] "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, + "useIAMCredentials": { "kind": "property", "displayName": "Use IAMCredentials", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to [...] "attributeNames": { "kind": "property", "displayName": "Attribute Names", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "A list of attribute names to receive when consuming. Multiple names can be separated by comma." }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by [...] "concurrentConsumers": { "kind": "property", "displayName": "Concurrent Consumers", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Allows you to use multiple threads to poll the sqs queue to increase throughput" }, @@ -75,6 +76,7 @@ "queueOwnerAWSAccountId": { "kind": "parameter", "displayName": "Queue Owner AWSAccount Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Specify the queue owner aws account id when you need to connect the queue with different account owner." }, "region": { "kind": "parameter", "displayName": "Region", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east- [...] "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, + "useIAMCredentials": { "kind": "parameter", "displayName": "Use IAMCredentials", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials t [...] "attributeNames": { "kind": "parameter", "displayName": "Attribute Names", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "A list of attribute names to receive when consuming. Multiple names can be separated by comma." }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled b [...] "concurrentConsumers": { "kind": "parameter", "displayName": "Concurrent Consumers", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Allows you to use multiple threads to poll the sqs queue to increase throughput" }, diff --git a/components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc b/components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc index affd4c1..b79bc60 100644 --- a/components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc +++ b/components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc @@ -43,7 +43,7 @@ The queue will be created if they don't already exists. + // component options: START -The AWS 2 Simple Queue Service (SQS) component supports 40 options, which are listed below. +The AWS 2 Simple Queue Service (SQS) component supports 41 options, which are listed below. @@ -60,6 +60,7 @@ The AWS 2 Simple Queue Service (SQS) component supports 40 options, which are li | *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String | *region* (common) | The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String | *trustAllCertificates* (common) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *useIAMCredentials* (common) | Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to be passed in. | false | boolean | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int @@ -119,7 +120,7 @@ with the following path and query parameters: |=== -=== Query Parameters (60 parameters): +=== Query Parameters (61 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -135,6 +136,7 @@ with the following path and query parameters: | *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String | *region* (common) | The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String | *trustAllCertificates* (common) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *useIAMCredentials* (common) | Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to be passed in. | false | boolean | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java index 3d56e14..3f8b7fa 100644 --- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java +++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java @@ -111,7 +111,7 @@ public class Sqs2Configuration implements Cloneable { // Likely used only for testing @UriParam(defaultValue = "https") private String protocol = "https"; - + @UriParam(defaultValue = "false") private boolean useIAMCredentials; @@ -570,25 +570,24 @@ public class Sqs2Configuration implements Cloneable { public void setAutoDiscoverClient(boolean autoDiscoverClient) { this.autoDiscoverClient = autoDiscoverClient; } - + public boolean isUseIAMCredentials() { - return useIAMCredentials; - } + return useIAMCredentials; + } /** - * Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to - * be passed in. + * Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static + * credentials to be passed in. */ - public void setUseIAMCredentials(boolean useIAMCredentials) { - this.useIAMCredentials = useIAMCredentials; - } + public void setUseIAMCredentials(boolean useIAMCredentials) { + this.useIAMCredentials = useIAMCredentials; + } - // ************************************************* // // ************************************************* - public Sqs2Configuration copy() { + public Sqs2Configuration copy() { try { return (Sqs2Configuration) super.clone(); } catch (CloneNotSupportedException e) { diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java index 1ec1b67..5bba1b5 100644 --- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java +++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java @@ -28,7 +28,6 @@ import org.apache.camel.ExchangePattern; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.component.aws2.s3.client.AWS2S3ClientFactory; import org.apache.camel.component.aws2.sqs.client.Sqs2ClientFactory; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/Sqs2InternalClient.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/Sqs2InternalClient.java index d76ea53..c09a736 100644 --- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/Sqs2InternalClient.java +++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/Sqs2InternalClient.java @@ -19,12 +19,12 @@ package org.apache.camel.component.aws2.sqs.client; import software.amazon.awssdk.services.sqs.SqsClient; public interface Sqs2InternalClient { - + /** * Returns an sqs client after a factory method determines which one to return. * * @return SqsClient sqsClient */ - SqsClient getSQSClient(); + SqsClient getSQSClient(); } diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientIAMOptimized.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientIAMOptimized.java index 1170f18..78384e9 100644 --- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientIAMOptimized.java +++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientIAMOptimized.java @@ -23,7 +23,6 @@ import org.apache.camel.component.aws2.sqs.client.Sqs2InternalClient; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; import software.amazon.awssdk.http.SdkHttpClient; import software.amazon.awssdk.http.SdkHttpConfigurationOption; @@ -35,8 +34,8 @@ import software.amazon.awssdk.services.sqs.SqsClientBuilder; import software.amazon.awssdk.utils.AttributeMap; /** - * Manage an AWS SQS client for all users to use. This implementation is for remote instances - * to manage the credentials on their own (eliminating credential rotations) + * Manage an AWS SQS client for all users to use. This implementation is for remote instances to manage the credentials + * on their own (eliminating credential rotations) */ public class Sqs2ClientIAMOptimized implements Sqs2InternalClient { private static final Logger LOG = LoggerFactory.getLogger(Sqs2ClientIAMOptimized.class); @@ -71,7 +70,7 @@ public class Sqs2ClientIAMOptimized implements Sqs2InternalClient { isClientConfigFound = true; } if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) { - DefaultCredentialsProvider cred = DefaultCredentialsProvider.create(); + DefaultCredentialsProvider cred = DefaultCredentialsProvider.create(); if (isClientConfigFound) { clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder) .credentialsProvider(cred); diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientStandardImpl.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientStandardImpl.java index 73bfaa8..8aded83 100644 --- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientStandardImpl.java +++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientStandardImpl.java @@ -105,11 +105,11 @@ public class Sqs2ClientStandardImpl implements Sqs2InternalClient { client = clientBuilder.build(); return client; } - + private boolean isDefaultAwsHost() { return configuration.getAmazonAWSHost().equals("amazonaws.com"); } - + /* * Gets the base endpoint for AWS (ie.: http(s)://host:port. * @@ -120,7 +120,7 @@ public class Sqs2ClientStandardImpl implements Sqs2InternalClient { private String getAwsEndpointUri() { return configuration.getProtocol() + "://" + getFullyQualifiedAWSHost(); } - + /* * If using a different AWS host, do not assume specific parts of the AWS * host and, instead, just return whatever is provided as the host. diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java index 48b7a17..3b2c1a5 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java @@ -183,6 +183,20 @@ public interface Aws2SqsComponentBuilderFactory { return this; } /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Aws2SqsComponentBuilder useIAMCredentials( + boolean useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** * A list of attribute names to receive when consuming. Multiple names * can be separated by comma. * @@ -630,6 +644,7 @@ public interface Aws2SqsComponentBuilderFactory { case "queueOwnerAWSAccountId": getOrCreateConfiguration((Sqs2Component) component).setQueueOwnerAWSAccountId((java.lang.String) value); return true; case "region": getOrCreateConfiguration((Sqs2Component) component).setRegion((java.lang.String) value); return true; case "trustAllCertificates": getOrCreateConfiguration((Sqs2Component) component).setTrustAllCertificates((boolean) value); return true; + case "useIAMCredentials": getOrCreateConfiguration((Sqs2Component) component).setUseIAMCredentials((boolean) value); return true; case "attributeNames": getOrCreateConfiguration((Sqs2Component) component).setAttributeNames((java.lang.String) value); return true; case "bridgeErrorHandler": ((Sqs2Component) component).setBridgeErrorHandler((boolean) value); return true; case "concurrentConsumers": getOrCreateConfiguration((Sqs2Component) component).setConcurrentConsumers((int) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java index 4245668..b6056d5 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java @@ -263,6 +263,34 @@ public interface Sqs2EndpointBuilderFactory { return this; } /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Sqs2EndpointConsumerBuilder useIAMCredentials( + boolean useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Sqs2EndpointConsumerBuilder useIAMCredentials( + String useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** * A list of attribute names to receive when consuming. Multiple names * can be separated by comma. * @@ -1624,6 +1652,34 @@ public interface Sqs2EndpointBuilderFactory { return this; } /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Sqs2EndpointProducerBuilder useIAMCredentials( + boolean useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Sqs2EndpointProducerBuilder useIAMCredentials( + String useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** * Delay sending messages for a number of seconds. * * The option is a: <code>java.lang.Integer</code> type. @@ -2272,6 +2328,32 @@ public interface Sqs2EndpointBuilderFactory { return this; } /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Sqs2EndpointBuilder useIAMCredentials(boolean useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** + * Set whether the SQS client should expect to load credentials on an + * AWS infra instance or to expect static credentials to be passed in. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: common + */ + default Sqs2EndpointBuilder useIAMCredentials(String useIAMCredentials) { + doSetProperty("useIAMCredentials", useIAMCredentials); + return this; + } + /** * To define a proxy host when instantiating the SQS client. * * The option is a: <code>java.lang.String</code> type. diff --git a/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc b/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc index b1e5c40..6e661fc 100644 --- a/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc @@ -45,7 +45,7 @@ The queue will be created if they don't already exists. + // component options: START -The AWS 2 Simple Queue Service (SQS) component supports 40 options, which are listed below. +The AWS 2 Simple Queue Service (SQS) component supports 41 options, which are listed below. @@ -62,6 +62,7 @@ The AWS 2 Simple Queue Service (SQS) component supports 40 options, which are li | *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String | *region* (common) | The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String | *trustAllCertificates* (common) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *useIAMCredentials* (common) | Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to be passed in. | false | boolean | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int @@ -121,7 +122,7 @@ with the following path and query parameters: |=== -=== Query Parameters (60 parameters): +=== Query Parameters (61 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -137,6 +138,7 @@ with the following path and query parameters: | *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String | *region* (common) | The region in which SQS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String | *trustAllCertificates* (common) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *useIAMCredentials* (common) | Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials to be passed in. | false | boolean | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int