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 25ea4dee79686e468614ddbd8a0595355cebacf2 Author: Andrea Cosentino <[email protected]> AuthorDate: Fri May 14 11:58:50 2021 +0200 CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - Lambda Component --- .../camel/catalog/docs/aws2-lambda-component.adoc | 6 ++-- .../aws2/lambda/Lambda2ComponentConfigurer.java | 6 ++++ .../aws2/lambda/Lambda2EndpointConfigurer.java | 6 ++++ .../aws2/lambda/Lambda2EndpointUriFactory.java | 3 +- .../camel/component/aws2/lambda/aws2-lambda.json | 2 ++ .../src/main/docs/aws2-lambda-component.adoc | 6 ++-- .../component/aws2/lambda/Lambda2Component.java | 3 +- .../aws2/lambda/Lambda2Configuration.java | 4 +-- .../component/aws2/lambda/Lambda2Endpoint.java | 11 ------- .../client/impl/Lambda2ClientOptimizedImpl.java | 8 ++--- .../client/impl/Lambda2ClientStandardImpl.java | 8 ++--- .../dsl/Aws2LambdaComponentBuilderFactory.java | 19 +++++++++++ .../dsl/Lambda2EndpointBuilderFactory.java | 37 ++++++++++++++++++++++ .../modules/ROOT/pages/aws2-lambda-component.adoc | 6 ++-- 14 files changed, 96 insertions(+), 29 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-lambda-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-lambda-component.adoc index 2b03424..2cb3513 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-lambda-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-lambda-component.adoc @@ -44,7 +44,7 @@ You can append query options to the URI in the following format, // component options: START -The AWS 2 Lambda component supports 15 options, which are listed below. +The AWS 2 Lambda component supports 16 options, which are listed below. @@ -59,6 +59,7 @@ The AWS 2 Lambda component supports 15 options, which are listed below. | *region* (producer) | The region in which ECS 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* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (producer) | Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | *awsLambdaClient* (advanced) | *Autowired* To use a existing configured AwsLambdaClient as client | | LambdaClient | *proxyHost* (proxy) | To define a proxy host when instantiating the Lambda client | | String @@ -91,7 +92,7 @@ with the following path and query parameters: |=== -=== Query Parameters (13 parameters): +=== Query Parameters (14 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -104,6 +105,7 @@ with the following path and query parameters: | *region* (producer) | The region in which ECS 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* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (producer) | Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *awsLambdaClient* (advanced) | *Autowired* To use a existing configured AwsLambdaClient as client | | LambdaClient | *proxyHost* (proxy) | To define a proxy host when instantiating the Lambda client | | String | *proxyPort* (proxy) | To define a proxy port when instantiating the Lambda client | | Integer diff --git a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java index 1a0650f..7c20f18 100644 --- a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java +++ b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java @@ -55,6 +55,8 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem 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; } } @@ -94,6 +96,8 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem case "trustAllCertificates": return boolean.class; case "uriendpointoverride": case "uriEndpointOverride": return java.lang.String.class; + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return boolean.class; default: return null; } } @@ -129,6 +133,8 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem 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-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java index 962d84c..bf02ce2 100644 --- a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java +++ b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java @@ -45,6 +45,8 @@ public class Lambda2EndpointConfigurer extends PropertyConfigurerSupport impleme 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; default: return false; } } @@ -81,6 +83,8 @@ public class Lambda2EndpointConfigurer extends PropertyConfigurerSupport impleme case "trustAllCertificates": return boolean.class; case "uriendpointoverride": case "uriEndpointOverride": return java.lang.String.class; + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return boolean.class; default: return null; } } @@ -113,6 +117,8 @@ public class Lambda2EndpointConfigurer extends PropertyConfigurerSupport impleme case "trustAllCertificates": return target.getConfiguration().isTrustAllCertificates(); case "uriendpointoverride": case "uriEndpointOverride": return target.getConfiguration().getUriEndpointOverride(); + case "usedefaultcredentialsprovider": + case "useDefaultCredentialsProvider": return target.getConfiguration().isUseDefaultCredentialsProvider(); default: return null; } } diff --git a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointUriFactory.java b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointUriFactory.java index 475682d..f0b77e6 100644 --- a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointUriFactory.java +++ b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointUriFactory.java @@ -20,10 +20,11 @@ public class Lambda2EndpointUriFactory extends org.apache.camel.support.componen private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { - Set<String> props = new HashSet<>(14); + Set<String> props = new HashSet<>(15); props.add("proxyProtocol"); props.add("secretKey"); props.add("uriEndpointOverride"); + props.add("useDefaultCredentialsProvider"); props.add("pojoRequest"); props.add("proxyHost"); props.add("trustAllCertificates"); diff --git a/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json b/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json index e0b4164..611862a 100644 --- a/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json +++ b/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json @@ -30,6 +30,7 @@ "region": { "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "The region in which ECS client needs to work. When using this parameter, the configuration will expect the lowercase name of the r [...] "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, "uriEndpointOverride": { "kind": "property", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" }, + "useDefaultCredentialsProvider": { "kind": "property", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Set whether the Lambda client should expect to load credentials th [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] "awsLambdaClient": { "kind": "property", "displayName": "Aws Lambda Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.lambda.LambdaClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To use a existing configured AwsLambdaClient [...] "proxyHost": { "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Lambda client" }, @@ -47,6 +48,7 @@ "region": { "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "The region in which ECS client needs to work. When using this parameter, the configuration will expect the lowercase name of the [...] "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, "uriEndpointOverride": { "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint op [...] + "useDefaultCredentialsProvider": { "kind": "parameter", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Set whether the Lambda client should expect to load credentials t [...] "awsLambdaClient": { "kind": "parameter", "displayName": "Aws Lambda Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.lambda.LambdaClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To use a existing configured AwsLambdaClient [...] "proxyHost": { "kind": "parameter", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Lambda client" }, "proxyPort": { "kind": "parameter", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Lambda client" }, diff --git a/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc b/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc index 2b03424..2cb3513 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc +++ b/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc @@ -44,7 +44,7 @@ You can append query options to the URI in the following format, // component options: START -The AWS 2 Lambda component supports 15 options, which are listed below. +The AWS 2 Lambda component supports 16 options, which are listed below. @@ -59,6 +59,7 @@ The AWS 2 Lambda component supports 15 options, which are listed below. | *region* (producer) | The region in which ECS 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* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (producer) | Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | *awsLambdaClient* (advanced) | *Autowired* To use a existing configured AwsLambdaClient as client | | LambdaClient | *proxyHost* (proxy) | To define a proxy host when instantiating the Lambda client | | String @@ -91,7 +92,7 @@ with the following path and query parameters: |=== -=== Query Parameters (13 parameters): +=== Query Parameters (14 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -104,6 +105,7 @@ with the following path and query parameters: | *region* (producer) | The region in which ECS 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* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (producer) | Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *awsLambdaClient* (advanced) | *Autowired* To use a existing configured AwsLambdaClient as client | | LambdaClient | *proxyHost* (proxy) | To define a proxy host when instantiating the Lambda client | | String | *proxyPort* (proxy) | To define a proxy port when instantiating the Lambda client | | Integer diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java index 2836c77..8937e2a 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java @@ -56,7 +56,8 @@ public class Lambda2Component extends DefaultComponent { endpoint.setFunction(remaining); if (!configuration.isUseDefaultCredentialsProvider() && configuration.getAwsLambdaClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { - throw new IllegalArgumentException("useDefaultCredentialsProvider is set to false, accessKey/secretKey or awsLambdaClient must be specified"); + throw new IllegalArgumentException( + "useDefaultCredentialsProvider is set to false, accessKey/secretKey or awsLambdaClient must be specified"); } return endpoint; diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Configuration.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Configuration.java index 1515673..e3c5f2a 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Configuration.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Configuration.java @@ -189,8 +189,8 @@ public class Lambda2Configuration implements Cloneable { } /** - * Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect - * static credentials to be passed in. + * Set whether the Lambda client should expect to load credentials through a default credentials provider or to + * expect static credentials to be passed in. */ public void setUseDefaultCredentialsProvider(Boolean useDefaultCredentialsProvider) { this.useDefaultCredentialsProvider = useDefaultCredentialsProvider; diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java index 7c2c8a6..58d478c 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java @@ -16,8 +16,6 @@ */ package org.apache.camel.component.aws2.lambda; -import java.net.URI; - import org.apache.camel.Category; import org.apache.camel.Component; import org.apache.camel.Consumer; @@ -30,16 +28,7 @@ import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.util.ObjectHelper; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -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; -import software.amazon.awssdk.http.apache.ProxyConfiguration; -import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.lambda.LambdaClient; -import software.amazon.awssdk.services.lambda.LambdaClientBuilder; -import software.amazon.awssdk.utils.AttributeMap; /** * Manage and invoke AWS Lambda functions using AWS SDK version 2.x. diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientOptimizedImpl.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientOptimizedImpl.java index 20832ab..5fcda51 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientOptimizedImpl.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientOptimizedImpl.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.aws2.lambda.client.impl; +import java.net.URI; + import org.apache.camel.component.aws2.lambda.Lambda2Configuration; import org.apache.camel.component.aws2.lambda.client.Lambda2InternalClient; import org.apache.camel.util.ObjectHelper; @@ -30,11 +32,9 @@ import software.amazon.awssdk.services.lambda.LambdaClient; import software.amazon.awssdk.services.lambda.LambdaClientBuilder; import software.amazon.awssdk.utils.AttributeMap; -import java.net.URI; - /** - * Manage an AWS Lambda 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 Lambda 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 Lambda2ClientOptimizedImpl implements Lambda2InternalClient { private static final Logger LOG = LoggerFactory.getLogger(Lambda2ClientOptimizedImpl.class); diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientStandardImpl.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientStandardImpl.java index edc6fcf..a1d0f21 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientStandardImpl.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/client/impl/Lambda2ClientStandardImpl.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.aws2.lambda.client.impl; +import java.net.URI; + import org.apache.camel.component.aws2.lambda.Lambda2Configuration; import org.apache.camel.component.aws2.lambda.client.Lambda2InternalClient; import org.apache.camel.util.ObjectHelper; @@ -32,11 +34,9 @@ import software.amazon.awssdk.services.lambda.LambdaClient; import software.amazon.awssdk.services.lambda.LambdaClientBuilder; import software.amazon.awssdk.utils.AttributeMap; -import java.net.URI; - /** - * Manage an AWS Lambda client for all users to use. This implementation is for local instances to use a static and solid - * credential set. + * Manage an AWS Lambda client for all users to use. This implementation is for local instances to use a static and + * solid credential set. */ public class Lambda2ClientStandardImpl implements Lambda2InternalClient { private static final Logger LOG = LoggerFactory.getLogger(Lambda2ClientStandardImpl.class); diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java index 48783b9..8ba8633 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java @@ -191,6 +191,24 @@ public interface Aws2LambdaComponentBuilderFactory { return this; } /** + * Set whether the Lambda 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: producer + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Aws2LambdaComponentBuilder useDefaultCredentialsProvider( + boolean useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** * Whether autowiring is enabled. This is used for automatic autowiring * options (the option must be marked as autowired) by looking up in the * registry to find if there is a single instance of matching type, @@ -332,6 +350,7 @@ public interface Aws2LambdaComponentBuilderFactory { case "region": getOrCreateConfiguration((Lambda2Component) component).setRegion((java.lang.String) value); return true; case "trustAllCertificates": getOrCreateConfiguration((Lambda2Component) component).setTrustAllCertificates((boolean) value); return true; case "uriEndpointOverride": getOrCreateConfiguration((Lambda2Component) component).setUriEndpointOverride((java.lang.String) value); return true; + case "useDefaultCredentialsProvider": getOrCreateConfiguration((Lambda2Component) component).setUseDefaultCredentialsProvider((boolean) value); return true; case "autowiredEnabled": ((Lambda2Component) component).setAutowiredEnabled((boolean) value); return true; case "awsLambdaClient": getOrCreateConfiguration((Lambda2Component) component).setAwsLambdaClient((software.amazon.awssdk.services.lambda.LambdaClient) value); return true; case "proxyHost": getOrCreateConfiguration((Lambda2Component) component).setProxyHost((java.lang.String) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java index 996f15b..b9f0fa8 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java @@ -253,6 +253,43 @@ public interface Lambda2EndpointBuilderFactory { return this; } /** + * Set whether the Lambda 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: producer + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Lambda2EndpointBuilder useDefaultCredentialsProvider( + boolean useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** + * Set whether the Lambda 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: producer + * + * @param useDefaultCredentialsProvider the value to set + * @return the dsl builder + */ + default Lambda2EndpointBuilder useDefaultCredentialsProvider( + String useDefaultCredentialsProvider) { + doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider); + return this; + } + /** * To define a proxy host when instantiating the Lambda client. * * The option is a: <code>java.lang.String</code> type. diff --git a/docs/components/modules/ROOT/pages/aws2-lambda-component.adoc b/docs/components/modules/ROOT/pages/aws2-lambda-component.adoc index b0adcb5..711f691 100644 --- a/docs/components/modules/ROOT/pages/aws2-lambda-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-lambda-component.adoc @@ -46,7 +46,7 @@ You can append query options to the URI in the following format, // component options: START -The AWS 2 Lambda component supports 15 options, which are listed below. +The AWS 2 Lambda component supports 16 options, which are listed below. @@ -61,6 +61,7 @@ The AWS 2 Lambda component supports 15 options, which are listed below. | *region* (producer) | The region in which ECS 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* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (producer) | Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | *awsLambdaClient* (advanced) | *Autowired* To use a existing configured AwsLambdaClient as client | | LambdaClient | *proxyHost* (proxy) | To define a proxy host when instantiating the Lambda client | | String @@ -93,7 +94,7 @@ with the following path and query parameters: |=== -=== Query Parameters (13 parameters): +=== Query Parameters (14 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -106,6 +107,7 @@ with the following path and query parameters: | *region* (producer) | The region in which ECS 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* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *useDefaultCredentialsProvider* (producer) | Set whether the Lambda client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean | *awsLambdaClient* (advanced) | *Autowired* To use a existing configured AwsLambdaClient as client | | LambdaClient | *proxyHost* (proxy) | To define a proxy host when instantiating the Lambda client | | String | *proxyPort* (proxy) | To define a proxy port when instantiating the Lambda client | | Integer
