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 81a00a2318bd436c80adecaaa36e3ea783ca26c7 Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Apr 7 13:24:59 2021 +0200 CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - Kinesis component --- .../camel/catalog/docs/aws2-kinesis-component.adoc | 6 +- .../aws2/kinesis/Kinesis2ComponentConfigurer.java | 6 ++ .../aws2/kinesis/Kinesis2EndpointConfigurer.java | 6 ++ .../aws2/kinesis/Kinesis2EndpointUriFactory.java | 3 +- .../camel/component/aws2/kinesis/aws2-kinesis.json | 2 + .../src/main/docs/aws2-kinesis-component.adoc | 6 +- .../aws2/kinesis/Kinesis2Configuration.java | 6 +- .../component/aws2/kinesis/Kinesis2Endpoint.java | 5 +- .../client/impl/KinesisClientIAMOptimizedImpl.java | 12 +-- .../client/impl/KinesisClientStandardImpl.java | 10 +- .../dsl/Aws2KinesisComponentBuilderFactory.java | 19 ++++ .../dsl/Kinesis2EndpointBuilderFactory.java | 111 +++++++++++++++++++++ .../modules/ROOT/pages/aws2-kinesis-component.adoc | 6 +- 13 files changed, 175 insertions(+), 23 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-kinesis-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-kinesis-component.adoc index 4d8d356..cd19d35a 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-kinesis-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-kinesis-component.adoc @@ -43,7 +43,7 @@ The stream needs to be created prior to it being used. + // component options: START -The AWS 2 Kinesis component supports 20 options, which are listed below. +The AWS 2 Kinesis component supports 21 options, which are listed below. @@ -60,6 +60,7 @@ The AWS 2 Kinesis component supports 20 options, which are listed below. | *region* (common) | The region in which Kinesis Firehose 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 | *uriEndpointOverride* (common) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (common) | Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *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 | *iteratorType* (consumer) | Defines where in the Kinesis stream to start getting records. There are 6 enums and the value can be one of: AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, TRIM_HORIZON, LATEST, AT_TIMESTAMP, null | TRIM_HORIZON | ShardIteratorType | *maxResultsPerRequest* (consumer) | Maximum number of records that will be fetched in each poll | 1 | int @@ -98,7 +99,7 @@ with the following path and query parameters: |=== -=== Query Parameters (36 parameters): +=== Query Parameters (37 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -113,6 +114,7 @@ with the following path and query parameters: | *region* (common) | The region in which Kinesis Firehose 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 | *uriEndpointOverride* (common) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (common) | Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *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 | *iteratorType* (consumer) | Defines where in the Kinesis stream to start getting records. There are 6 enums and the value can be one of: AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, TRIM_HORIZON, LATEST, AT_TIMESTAMP, null | TRIM_HORIZON | ShardIteratorType | *maxResultsPerRequest* (consumer) | Maximum number of records that will be fetched in each poll | 1 | int diff --git a/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2ComponentConfigurer.java b/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2ComponentConfigurer.java index 80f3a1a..1a15fdc 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2ComponentConfigurer.java +++ b/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2ComponentConfigurer.java @@ -66,6 +66,8 @@ public class Kinesis2ComponentConfigurer extends PropertyConfigurerSupport imple case "trustAllCertificates": getOrCreateConfiguration(target).setTrustAllCertificates(property(camelContext, boolean.class, value)); return true; case "uriendpointoverride": case "uriEndpointOverride": getOrCreateConfiguration(target).setUriEndpointOverride(property(camelContext, java.lang.String.class, value)); return true; + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": getOrCreateConfiguration(target).setUseDefaultCredentialsProvider(property(camelContext, boolean.class, value)); return true; default: return false; } } @@ -116,6 +118,8 @@ public class Kinesis2ComponentConfigurer extends PropertyConfigurerSupport imple case "trustAllCertificates": return boolean.class; case "uriendpointoverride": case "uriEndpointOverride": return java.lang.String.class; + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return boolean.class; default: return null; } } @@ -162,6 +166,8 @@ public class Kinesis2ComponentConfigurer extends PropertyConfigurerSupport imple case "trustAllCertificates": return getOrCreateConfiguration(target).isTrustAllCertificates(); case "uriendpointoverride": case "uriEndpointOverride": return getOrCreateConfiguration(target).getUriEndpointOverride(); + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return getOrCreateConfiguration(target).isUseDefaultCredentialsProvider(); default: return null; } } diff --git a/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointConfigurer.java b/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointConfigurer.java index ff3e704..b165e71 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointConfigurer.java +++ b/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointConfigurer.java @@ -87,6 +87,8 @@ public class Kinesis2EndpointConfigurer extends PropertyConfigurerSupport implem case "trustAllCertificates": target.getConfiguration().setTrustAllCertificates(property(camelContext, boolean.class, value)); return true; case "uriendpointoverride": case "uriEndpointOverride": target.getConfiguration().setUriEndpointOverride(property(camelContext, java.lang.String.class, value)); return true; + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": target.getConfiguration().setUseDefaultCredentialsProvider(property(camelContext, boolean.class, value)); return true; case "usefixeddelay": case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true; default: return false; @@ -167,6 +169,8 @@ public class Kinesis2EndpointConfigurer extends PropertyConfigurerSupport implem case "trustAllCertificates": return boolean.class; case "uriendpointoverride": case "uriEndpointOverride": return java.lang.String.class; + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return boolean.class; case "usefixeddelay": case "useFixedDelay": return boolean.class; default: return null; @@ -243,6 +247,8 @@ public class Kinesis2EndpointConfigurer extends PropertyConfigurerSupport implem case "trustAllCertificates": return target.getConfiguration().isTrustAllCertificates(); case "uriendpointoverride": case "uriEndpointOverride": return target.getConfiguration().getUriEndpointOverride(); + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return target.getConfiguration().isUseDefaultCredentialsProvider(); case "usefixeddelay": case "useFixedDelay": return target.isUseFixedDelay(); default: return null; diff --git a/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointUriFactory.java b/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointUriFactory.java index 66c0ea7..1ba2211 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointUriFactory.java +++ b/components/camel-aws/camel-aws2-kinesis/src/generated/java/org/apache/camel/component/aws2/kinesis/Kinesis2EndpointUriFactory.java @@ -20,7 +20,7 @@ public class Kinesis2EndpointUriFactory extends org.apache.camel.support.compone private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { - Set<String> props = new HashSet<>(37); + Set<String> props = new HashSet<>(38); props.add("backoffMultiplier"); props.add("initialDelay"); props.add("scheduler"); @@ -45,6 +45,7 @@ public class Kinesis2EndpointUriFactory extends org.apache.camel.support.compone props.add("uriEndpointOverride"); props.add("exchangePattern"); props.add("shardId"); + props.add("useDefaultCredentialsProvider"); props.add("streamName"); props.add("proxyHost"); props.add("backoffIdleThreshold"); diff --git a/components/camel-aws/camel-aws2-kinesis/src/generated/resources/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json b/components/camel-aws/camel-aws2-kinesis/src/generated/resources/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json index 3c4fbb0..3582a17 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/generated/resources/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json +++ b/components/camel-aws/camel-aws2-kinesis/src/generated/resources/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json @@ -32,6 +32,7 @@ "region": { "kind": "property", "displayName": "Region", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The region in which Kinesis Firehose client needs to work. When using this parameter, the configuration will expect the lowercase [...] "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, "uriEndpointOverride": { "kind": "property", "displayName": "Uri Endpoint Override", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoi [...] + "useDefaultCredentialsProvider": { "kind": "property", "displayName": "Use Default Credentials Provider", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Set whether the Kinesis client should expect to load credent [...] "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 me [...] "iteratorType": { "kind": "property", "displayName": "Iterator Type", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.kinesis.model.ShardIteratorType", "enum": [ "AT_SEQUENCE_NUMBER", "AFTER_SEQUENCE_NUMBER", "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP", "null" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "TRIM_HORIZON", "configurationClass": "org.apache.camel.component.aws2.kinesi [...] "maxResultsPerRequest": { "kind": "property", "displayName": "Max Results Per Request", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Maximum number of records that will be fetched in each poll" }, @@ -54,6 +55,7 @@ "region": { "kind": "parameter", "displayName": "Region", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The region in which Kinesis Firehose client needs to work. When using this parameter, the configuration will expect the lowercase [...] "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, "uriEndpointOverride": { "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpo [...] + "useDefaultCredentialsProvider": { "kind": "parameter", "displayName": "Use Default Credentials Provider", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Set whether the Kinesis client should expect to load creden [...] "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 m [...] "iteratorType": { "kind": "parameter", "displayName": "Iterator Type", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.kinesis.model.ShardIteratorType", "enum": [ "AT_SEQUENCE_NUMBER", "AFTER_SEQUENCE_NUMBER", "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP", "null" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "TRIM_HORIZON", "configurationClass": "org.apache.camel.component.aws2.kines [...] "maxResultsPerRequest": { "kind": "parameter", "displayName": "Max Results Per Request", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Maximum number of records that will be fetched in each poll" }, diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/docs/aws2-kinesis-component.adoc b/components/camel-aws/camel-aws2-kinesis/src/main/docs/aws2-kinesis-component.adoc index 4d8d356..cd19d35a 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/docs/aws2-kinesis-component.adoc +++ b/components/camel-aws/camel-aws2-kinesis/src/main/docs/aws2-kinesis-component.adoc @@ -43,7 +43,7 @@ The stream needs to be created prior to it being used. + // component options: START -The AWS 2 Kinesis component supports 20 options, which are listed below. +The AWS 2 Kinesis component supports 21 options, which are listed below. @@ -60,6 +60,7 @@ The AWS 2 Kinesis component supports 20 options, which are listed below. | *region* (common) | The region in which Kinesis Firehose 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 | *uriEndpointOverride* (common) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (common) | Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *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 | *iteratorType* (consumer) | Defines where in the Kinesis stream to start getting records. There are 6 enums and the value can be one of: AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, TRIM_HORIZON, LATEST, AT_TIMESTAMP, null | TRIM_HORIZON | ShardIteratorType | *maxResultsPerRequest* (consumer) | Maximum number of records that will be fetched in each poll | 1 | int @@ -98,7 +99,7 @@ with the following path and query parameters: |=== -=== Query Parameters (36 parameters): +=== Query Parameters (37 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -113,6 +114,7 @@ with the following path and query parameters: | *region* (common) | The region in which Kinesis Firehose 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 | *uriEndpointOverride* (common) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (common) | Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *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 | *iteratorType* (consumer) | Defines where in the Kinesis stream to start getting records. There are 6 enums and the value can be one of: AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, TRIM_HORIZON, LATEST, AT_TIMESTAMP, null | TRIM_HORIZON | ShardIteratorType | *maxResultsPerRequest* (consumer) | Maximum number of records that will be fetched in each poll | 1 | int diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java index ec89c1e..db57da4 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java @@ -77,8 +77,10 @@ public class Kinesis2Configuration implements Cloneable { @UriParam(label = "common", description = "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option") private String uriEndpointOverride; - @UriParam(label = "common", defaultValue = "false", description = "Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect " + - "static credentials to be passed in.") + @UriParam(label = "common", defaultValue = "false", + description = "Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect " + + + "static credentials to be passed in.") private boolean useDefaultCredentialsProvider; public KinesisClient getAmazonKinesisClient() { diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java index d0f819c..1756ec6 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java @@ -65,8 +65,9 @@ public class Kinesis2Endpoint extends ScheduledPollEndpoint { System.setProperty(CBOR_ENABLED.property(), "false"); } kinesisClient = configuration.getAmazonKinesisClient() != null - ? configuration.getAmazonKinesisClient() : KinesisClientFactory.getKinesisClient(configuration).getKinesisClient(); - + ? configuration.getAmazonKinesisClient() + : KinesisClientFactory.getKinesisClient(configuration).getKinesisClient(); + if ((configuration.getIteratorType().equals(ShardIteratorType.AFTER_SEQUENCE_NUMBER) || configuration.getIteratorType().equals(ShardIteratorType.AT_SEQUENCE_NUMBER)) && configuration.getSequenceNumber().isEmpty()) { diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientIAMOptimizedImpl.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientIAMOptimizedImpl.java index 1ebde1f..94f290a 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientIAMOptimizedImpl.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientIAMOptimizedImpl.java @@ -16,14 +16,14 @@ */ package org.apache.camel.component.aws2.kinesis.client.impl; +import java.net.URI; + import org.apache.camel.component.aws2.kinesis.Kinesis2Configuration; import org.apache.camel.component.aws2.kinesis.client.KinesisInternalClient; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; import software.amazon.awssdk.http.SdkHttpClient; import software.amazon.awssdk.http.SdkHttpConfigurationOption; import software.amazon.awssdk.http.apache.ApacheHttpClient; @@ -33,11 +33,9 @@ import software.amazon.awssdk.services.kinesis.KinesisClient; import software.amazon.awssdk.services.kinesis.KinesisClientBuilder; import software.amazon.awssdk.utils.AttributeMap; -import java.net.URI; - /** - * Manage an AWS Kinesis client for all users to use (enabling temporary creds). This implementation is for remote instances - * to manage the credentials on their own (eliminating credential rotations) + * Manage an AWS Kinesis client for all users to use (enabling temporary creds). This implementation is for remote + * instances to manage the credentials on their own (eliminating credential rotations) */ public class KinesisClientIAMOptimizedImpl implements KinesisInternalClient { private static final Logger LOG = LoggerFactory.getLogger(KinesisClientIAMOptimizedImpl.class); @@ -66,7 +64,7 @@ public class KinesisClientIAMOptimizedImpl implements KinesisInternalClient { if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { proxyConfig = ProxyConfiguration.builder(); URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":" - + configuration.getProxyPort()); + + configuration.getProxyPort()); proxyConfig.endpoint(proxyEndpoint); httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build()); isClientConfigFound = true; diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientStandardImpl.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientStandardImpl.java index 3d1b055..cc1221d 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientStandardImpl.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/client/impl/KinesisClientStandardImpl.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.aws2.kinesis.client.impl; +import java.net.URI; + import org.apache.camel.component.aws2.kinesis.Kinesis2Configuration; import org.apache.camel.component.aws2.kinesis.client.KinesisInternalClient; import org.apache.camel.util.ObjectHelper; @@ -32,11 +34,9 @@ import software.amazon.awssdk.services.kinesis.KinesisClient; import software.amazon.awssdk.services.kinesis.KinesisClientBuilder; import software.amazon.awssdk.utils.AttributeMap; -import java.net.URI; - /** - * Manage an AWS Kinesis client for all users to use. This implementation is for local instances to use a static and solid - * credential set. + * Manage an AWS Kinesis client for all users to use. This implementation is for local instances to use a static and + * solid credential set. */ public class KinesisClientStandardImpl implements KinesisInternalClient { private static final Logger LOG = LoggerFactory.getLogger(KinesisClientStandardImpl.class); @@ -65,7 +65,7 @@ public class KinesisClientStandardImpl implements KinesisInternalClient { if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { proxyConfig = ProxyConfiguration.builder(); URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":" - + configuration.getProxyPort()); + + configuration.getProxyPort()); proxyConfig.endpoint(proxyEndpoint); httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build()); isClientConfigFound = true; diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java index 16c8d78..e5223c4 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java @@ -213,6 +213,24 @@ public interface Aws2KinesisComponentBuilderFactory { return this; } /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Aws2KinesisComponentBuilder useDefaultCredentialsProvider( + boolean useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** * 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 @@ -426,6 +444,7 @@ public interface Aws2KinesisComponentBuilderFactory { case "region": getOrCreateConfiguration((Kinesis2Component) component).setRegion((java.lang.String) value); return true; case "trustAllCertificates": getOrCreateConfiguration((Kinesis2Component) component).setTrustAllCertificates((boolean) value); return true; case "uriEndpointOverride": getOrCreateConfiguration((Kinesis2Component) component).setUriEndpointOverride((java.lang.String) value); return true; + case "useDefaultCredentialsProvider": getOrCreateConfiguration((Kinesis2Component) component).setUseDefaultCredentialsProvider((boolean) value); return true; case "bridgeErrorHandler": ((Kinesis2Component) component).setBridgeErrorHandler((boolean) value); return true; case "iteratorType": getOrCreateConfiguration((Kinesis2Component) component).setIteratorType((software.amazon.awssdk.services.kinesis.model.ShardIteratorType) value); return true; case "maxResultsPerRequest": getOrCreateConfiguration((Kinesis2Component) component).setMaxResultsPerRequest((int) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java index c80433d..c41a2a5 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java @@ -291,6 +291,43 @@ public interface Kinesis2EndpointBuilderFactory { return this; } /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Kinesis2EndpointConsumerBuilder useDefaultCredentialsProvider( + boolean useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Kinesis2EndpointConsumerBuilder useDefaultCredentialsProvider( + String useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** * 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 @@ -1387,6 +1424,43 @@ public interface Kinesis2EndpointBuilderFactory { return this; } /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Kinesis2EndpointProducerBuilder useDefaultCredentialsProvider( + boolean useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Kinesis2EndpointProducerBuilder useDefaultCredentialsProvider( + String useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** * Whether the producer should be started lazy (on the first message). * By starting lazy you can use this to allow CamelContext and routes to * startup in situations where a producer may otherwise fail during @@ -1727,6 +1801,43 @@ public interface Kinesis2EndpointBuilderFactory { return this; } /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Kinesis2EndpointBuilder useDefaultCredentialsProvider( + boolean useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** + * Set whether the Kinesis client should expect to load credentials + * through a default credentials provider or to expect static + * credentials to be passed in. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: common + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Kinesis2EndpointBuilder useDefaultCredentialsProvider( + String useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** * Amazon AWS Access Key. * * The option is a: <code>java.lang.String</code> type. diff --git a/docs/components/modules/ROOT/pages/aws2-kinesis-component.adoc b/docs/components/modules/ROOT/pages/aws2-kinesis-component.adoc index 8ac0da8..ee44441f 100644 --- a/docs/components/modules/ROOT/pages/aws2-kinesis-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-kinesis-component.adoc @@ -45,7 +45,7 @@ The stream needs to be created prior to it being used. + // component options: START -The AWS 2 Kinesis component supports 20 options, which are listed below. +The AWS 2 Kinesis component supports 21 options, which are listed below. @@ -62,6 +62,7 @@ The AWS 2 Kinesis component supports 20 options, which are listed below. | *region* (common) | The region in which Kinesis Firehose 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 | *uriEndpointOverride* (common) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (common) | Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *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 | *iteratorType* (consumer) | Defines where in the Kinesis stream to start getting records. There are 6 enums and the value can be one of: AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, TRIM_HORIZON, LATEST, AT_TIMESTAMP, null | TRIM_HORIZON | ShardIteratorType | *maxResultsPerRequest* (consumer) | Maximum number of records that will be fetched in each poll | 1 | int @@ -100,7 +101,7 @@ with the following path and query parameters: |=== -=== Query Parameters (36 parameters): +=== Query Parameters (37 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -115,6 +116,7 @@ with the following path and query parameters: | *region* (common) | The region in which Kinesis Firehose 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 | *uriEndpointOverride* (common) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (common) | Set whether the Kinesis client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *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 | *iteratorType* (consumer) | Defines where in the Kinesis stream to start getting records. There are 6 enums and the value can be one of: AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, TRIM_HORIZON, LATEST, AT_TIMESTAMP, null | TRIM_HORIZON | ShardIteratorType | *maxResultsPerRequest* (consumer) | Maximum number of records that will be fetched in each poll | 1 | int
