You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/11/09 07:23:52 UTC

[camel] branch master updated (96ccd8c -> 9261b20)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 96ccd8c  Sync deps
     new 90b1a2a  CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - SNS
     new 6eba38d  CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - regen SNS
     new 9261b20  CAMEL-15785 - Regen catalog

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/catalog/components/aws2-sns.json  |  2 +
 .../camel/catalog/docs/aws2-sns-component.adoc     |  6 ++-
 .../aws2/sns/Sns2ComponentConfigurer.java          |  6 +++
 .../component/aws2/sns/Sns2EndpointConfigurer.java |  6 +++
 .../component/aws2/sns/Sns2EndpointUriFactory.java |  3 +-
 .../apache/camel/component/aws2/sns/aws2-sns.json  |  2 +
 .../src/main/docs/aws2-sns-component.adoc          |  6 ++-
 .../component/aws2/sns/Sns2Configuration.java      | 14 +++++
 .../camel/component/aws2/sns/Sns2Endpoint.java     | 62 ++--------------------
 .../aws2/sns/client/Sns2ClientFactory.java}        | 22 ++++----
 .../aws2/sns/client/Sns2InternalClient.java}       | 12 ++---
 .../sns/client/impl/Sns2ClientIAMOptimized.java}   | 32 +++++------
 .../sns/client/impl/Sns2ClientStandardImpl.java}   | 35 ++++++------
 .../dsl/Aws2SnsComponentBuilderFactory.java        | 15 ++++++
 .../endpoint/dsl/Sns2EndpointBuilderFactory.java   | 26 +++++++++
 .../modules/ROOT/pages/aws2-sns-component.adoc     |  6 ++-
 16 files changed, 137 insertions(+), 118 deletions(-)
 copy components/{camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/Sqs2ClientFactory.java => camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java} (60%)
 copy components/{camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/Sqs2InternalClient.java => camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2InternalClient.java} (75%)
 copy components/{camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/client/impl/Sqs2ClientIAMOptimized.java => camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientIAMOptimized.java} (80%)
 copy components/{camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/client/impl/AWS2S3ClientStandardImpl.java => camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java} (76%)


[camel] 01/03: CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - SNS

Posted by ac...@apache.org.
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 90b1a2af4597eed7e26d4c35efd3bca3259a7121
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Nov 9 08:11:20 2020 +0100

    CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - SNS
---
 .../component/aws2/sns/Sns2Configuration.java      |  14 +++
 .../camel/component/aws2/sns/Sns2Endpoint.java     |  61 +-----------
 .../aws2/sns/client/Sns2ClientFactory.java         |  41 +++++++++
 .../aws2/sns/client/Sns2InternalClient.java        |  30 ++++++
 .../sns/client/impl/Sns2ClientIAMOptimized.java    | 101 ++++++++++++++++++++
 .../sns/client/impl/Sns2ClientStandardImpl.java    | 102 +++++++++++++++++++++
 6 files changed, 291 insertions(+), 58 deletions(-)

diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
index 7ef6f92..716fe14 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
@@ -65,6 +65,8 @@ public class Sns2Configuration implements Cloneable {
     private boolean trustAllCertificates;
     @UriParam(label = "common", defaultValue = "true")
     private boolean autoDiscoverClient = true;
+    @UriParam(defaultValue = "false")
+    private boolean useIAMCredentials;    
 
     public String getSubject() {
         return subject;
@@ -276,6 +278,18 @@ public class Sns2Configuration implements Cloneable {
     public void setAutoDiscoverClient(boolean autoDiscoverClient) {
         this.autoDiscoverClient = autoDiscoverClient;
     }
+    
+    public boolean isUseIAMCredentials() {
+        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.
+     */
+    public void setUseIAMCredentials(boolean useIAMCredentials) {
+        this.useIAMCredentials = useIAMCredentials;
+    }
 
     // *************************************************
     //
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
index 2b1ecca..aeb11b0 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
@@ -25,6 +25,7 @@ import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.component.aws2.sns.client.Sns2ClientFactory;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
 import org.apache.camel.spi.Metadata;
@@ -35,16 +36,8 @@ import org.apache.camel.support.DefaultEndpoint;
 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.StaticCredentialsProvider;
 import software.amazon.awssdk.awscore.exception.AwsServiceException;
-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.sns.SnsClient;
-import software.amazon.awssdk.services.sns.SnsClientBuilder;
 import software.amazon.awssdk.services.sns.model.CreateTopicRequest;
 import software.amazon.awssdk.services.sns.model.CreateTopicResponse;
 import software.amazon.awssdk.services.sns.model.ListTopicsRequest;
@@ -53,7 +46,6 @@ import software.amazon.awssdk.services.sns.model.SetTopicAttributesRequest;
 import software.amazon.awssdk.services.sns.model.SubscribeRequest;
 import software.amazon.awssdk.services.sns.model.SubscribeResponse;
 import software.amazon.awssdk.services.sns.model.Topic;
-import software.amazon.awssdk.utils.AttributeMap;
 
 /**
  * Send messages to an AWS Simple Notification Topic using AWS SDK version 2.x.
@@ -106,7 +98,8 @@ public class Sns2Endpoint extends DefaultEndpoint implements HeaderFilterStrateg
     @Override
     public void doInit() throws Exception {
         super.doInit();
-        snsClient = configuration.getAmazonSNSClient() != null ? configuration.getAmazonSNSClient() : createSNSClient();
+        snsClient = configuration.getAmazonSNSClient() != null
+                ? configuration.getAmazonSNSClient() : Sns2ClientFactory.getSnsClient(configuration).getSNSClient();
 
         // check the setting the headerFilterStrategy
         if (headerFilterStrategy == null) {
@@ -204,52 +197,4 @@ public class Sns2Endpoint extends DefaultEndpoint implements HeaderFilterStrateg
     public SnsClient getSNSClient() {
         return snsClient;
     }
-
-    /**
-     * Provide the possibility to override this method for an mock implementation
-     *
-     * @return AmazonSNSClient
-     */
-    SnsClient createSNSClient() {
-        SnsClient client = null;
-        SnsClientBuilder clientBuilder = SnsClient.builder();
-        ProxyConfiguration.Builder proxyConfig = null;
-        ApacheHttpClient.Builder httpClientBuilder = null;
-        boolean isClientConfigFound = false;
-        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
-            proxyConfig = ProxyConfiguration.builder();
-            URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
-                                           + configuration.getProxyPort());
-            proxyConfig.endpoint(proxyEndpoint);
-            httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
-            isClientConfigFound = true;
-        }
-        if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
-            AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey());
-            if (isClientConfigFound) {
-                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder)
-                        .credentialsProvider(StaticCredentialsProvider.create(cred));
-            } else {
-                clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
-            }
-        } else {
-            if (!isClientConfigFound) {
-                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
-            }
-        }
-        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
-            clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
-        }
-        if (configuration.isTrustAllCertificates()) {
-            SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
-                    .builder()
-                    .put(
-                            SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
-                            Boolean.TRUE)
-                    .build());
-            clientBuilder.httpClient(ahc);
-        }
-        client = clientBuilder.build();
-        return client;
-    }
 }
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java
new file mode 100644
index 0000000..3e1fd60
--- /dev/null
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.sns.client;
+
+import org.apache.camel.component.aws2.sns.Sns2Configuration;
+import org.apache.camel.component.aws2.sns.client.impl.Sns2ClientIAMOptimized;
+import org.apache.camel.component.aws2.sns.client.impl.Sns2ClientStandardImpl;
+
+/**
+ * Factory class to return the correct type of AWS SNS aws.
+ */
+public final class Sns2ClientFactory {
+
+    private Sns2ClientFactory() {
+    }
+
+    /**
+     * Return the correct aws SNS client (based on remote vs local).
+     * 
+     * @param  configuration configuration
+     * @return               SNSClient
+     */
+    public static Sns2InternalClient getSnsClient(Sns2Configuration configuration) {
+        return configuration.isUseIAMCredentials()
+                ? new Sns2ClientIAMOptimized(configuration) : new Sns2ClientStandardImpl(configuration);
+    }
+}
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2InternalClient.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2InternalClient.java
new file mode 100644
index 0000000..015692f
--- /dev/null
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2InternalClient.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.sns.client;
+
+import software.amazon.awssdk.services.sns.SnsClient;
+
+public interface Sns2InternalClient {
+
+    /**
+     * Returns an sns client after a factory method determines which one to return.
+     * 
+     * @return SnsClient snsClient
+     */
+    SnsClient getSNSClient();
+
+}
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientIAMOptimized.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientIAMOptimized.java
new file mode 100644
index 0000000..d97e70b
--- /dev/null
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientIAMOptimized.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.sns.client.impl;
+
+import java.net.URI;
+
+import org.apache.camel.component.aws2.sns.Sns2Configuration;
+import org.apache.camel.component.aws2.sns.client.Sns2InternalClient;
+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;
+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.sns.SnsClient;
+import software.amazon.awssdk.services.sns.SnsClientBuilder;
+import software.amazon.awssdk.utils.AttributeMap;
+
+/**
+ * Manage an AWS SNS client for all users to use. This implementation is for remote instances to manage the credentials
+ * on their own (eliminating credential rotations)
+ */
+public class Sns2ClientIAMOptimized implements Sns2InternalClient {
+    private static final Logger LOG = LoggerFactory.getLogger(Sns2ClientIAMOptimized.class);
+    private Sns2Configuration configuration;
+
+    /**
+     * Constructor that uses the config file.
+     */
+    public Sns2ClientIAMOptimized(Sns2Configuration configuration) {
+        LOG.trace("Creating an AWS SNS client for working on AWS Services");
+        this.configuration = configuration;
+    }
+
+    /**
+     * Getting the SNS AWS client that is used.
+     * 
+     * @return Amazon SNS Client.
+     */
+    @Override
+    public SnsClient getSNSClient() {
+        SnsClient client = null;
+        SnsClientBuilder clientBuilder = SnsClient.builder();
+        ProxyConfiguration.Builder proxyConfig = null;
+        ApacheHttpClient.Builder httpClientBuilder = null;
+        boolean isClientConfigFound = false;
+        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
+            proxyConfig = ProxyConfiguration.builder();
+            URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
+                                           + configuration.getProxyPort());
+            proxyConfig.endpoint(proxyEndpoint);
+            httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
+            isClientConfigFound = true;
+        }
+        if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
+            DefaultCredentialsProvider cred = DefaultCredentialsProvider.create();
+            if (isClientConfigFound) {
+                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder)
+                        .credentialsProvider(cred);
+            } else {
+                clientBuilder = clientBuilder.credentialsProvider(cred);
+            }
+        } else {
+            if (!isClientConfigFound) {
+                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
+            }
+        }
+
+        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+            clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
+        }
+        if (configuration.isTrustAllCertificates()) {
+            SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
+                    .builder()
+                    .put(
+                            SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
+                            Boolean.TRUE)
+                    .build());
+            clientBuilder.httpClient(ahc);
+        }
+        client = clientBuilder.build();
+        return client;
+    }
+}
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java
new file mode 100644
index 0000000..7b17b9f
--- /dev/null
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.sns.client.impl;
+
+import java.net.URI;
+
+import org.apache.camel.component.aws2.sns.Sns2Configuration;
+import org.apache.camel.component.aws2.sns.client.Sns2InternalClient;
+import org.apache.camel.util.FileUtil;
+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.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.sns.SnsClient;
+import software.amazon.awssdk.services.sns.SnsClientBuilder;
+import software.amazon.awssdk.utils.AttributeMap;
+
+/**
+ * Manage an AWS SNS client for all users to use. This implementation is for local instances to use a static and solid
+ * credential set.
+ */
+public class Sns2ClientStandardImpl implements Sns2InternalClient {
+    private static final Logger LOG = LoggerFactory.getLogger(Sns2ClientStandardImpl.class);
+    private Sns2Configuration configuration;
+
+    /**
+     * Constructor that uses the config file.
+     */
+    public Sns2ClientStandardImpl(Sns2Configuration configuration) {
+        LOG.trace("Creating an AWS SNS manager using static credentials.");
+        this.configuration = configuration;
+    }
+
+    /**
+     * Getting the SNS aws client that is used.
+     * 
+     * @return Amazon SNS Client.
+     */
+	@Override
+	public SnsClient getSNSClient() {
+        SnsClient client = null;
+        SnsClientBuilder clientBuilder = SnsClient.builder();
+        ProxyConfiguration.Builder proxyConfig = null;
+        ApacheHttpClient.Builder httpClientBuilder = null;
+        boolean isClientConfigFound = false;
+        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
+            proxyConfig = ProxyConfiguration.builder();
+            URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
+                                           + configuration.getProxyPort());
+            proxyConfig.endpoint(proxyEndpoint);
+            httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
+            isClientConfigFound = true;
+        }
+        if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
+            AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey());
+            if (isClientConfigFound) {
+                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder)
+                        .credentialsProvider(StaticCredentialsProvider.create(cred));
+            } else {
+                clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
+            }
+        } else {
+            if (!isClientConfigFound) {
+                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
+            }
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+            clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
+        }
+        if (configuration.isTrustAllCertificates()) {
+            SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
+                    .builder()
+                    .put(
+                            SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
+                            Boolean.TRUE)
+                    .build());
+            clientBuilder.httpClient(ahc);
+        }
+        client = clientBuilder.build();
+        return client;
+	}
+}


[camel] 03/03: CAMEL-15785 - Regen catalog

Posted by ac...@apache.org.
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 9261b20c98a5a7abf97ddc9600eb7865c5f4602e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Nov 9 08:18:25 2020 +0100

    CAMEL-15785 - Regen catalog
---
 .../resources/org/apache/camel/catalog/components/aws2-sns.json         | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sns.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sns.json
index 2433361..64d5b91 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sns.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sns.json
@@ -39,6 +39,7 @@
     "subject": { "kind": "property", "displayName": "Subject", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The subject which is used if the message header 'CamelAwsSnsSubject' is not present." },
     "subscribeSNStoSQS": { "kind": "property", "displayName": "Subscribe SNSto SQS", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Define if the subscription between SNS Topic and SQS must be done or not" },
     "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
+    "useIAMCredentials": { "kind": "property", "displayName": "Use IAMCredentials", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials  [...]
     "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
     "accessKey": { "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
     "secretKey": { "kind": "property", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }
@@ -62,6 +63,7 @@
     "subject": { "kind": "parameter", "displayName": "Subject", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The subject which is used if the message header 'CamelAwsSnsSubject' is not present." },
     "subscribeSNStoSQS": { "kind": "parameter", "displayName": "Subscribe SNSto SQS", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Define if the subscription between SNS Topic and SQS must be done or not" },
     "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
+    "useIAMCredentials": { "kind": "parameter", "displayName": "Use IAMCredentials", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials [...]
     "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
     "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported)." },
     "accessKey": { "kind": "parameter", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },


[camel] 02/03: CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - regen SNS

Posted by ac...@apache.org.
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 6eba38d7b97c12a426010cb1a80dd0b08ea12716
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Nov 9 08:12:40 2020 +0100

    CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - regen SNS
---
 .../camel/catalog/docs/aws2-sns-component.adoc     |  6 +++--
 .../aws2/sns/Sns2ComponentConfigurer.java          |  6 +++++
 .../component/aws2/sns/Sns2EndpointConfigurer.java |  6 +++++
 .../component/aws2/sns/Sns2EndpointUriFactory.java |  3 ++-
 .../apache/camel/component/aws2/sns/aws2-sns.json  |  2 ++
 .../src/main/docs/aws2-sns-component.adoc          |  6 +++--
 .../component/aws2/sns/Sns2Configuration.java      |  4 ++--
 .../camel/component/aws2/sns/Sns2Endpoint.java     |  1 -
 .../sns/client/impl/Sns2ClientStandardImpl.java    |  7 +++---
 .../dsl/Aws2SnsComponentBuilderFactory.java        | 15 +++++++++++++
 .../endpoint/dsl/Sns2EndpointBuilderFactory.java   | 26 ++++++++++++++++++++++
 .../modules/ROOT/pages/aws2-sns-component.adoc     |  6 +++--
 12 files changed, 74 insertions(+), 14 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc
index 168dbff..59f18e2 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc
@@ -45,7 +45,7 @@ The topic will be created if they don't already exists. +
 
 
 // component options: START
-The AWS 2 Simple Notification System (SNS) component supports 20 options, which are listed below.
+The AWS 2 Simple Notification System (SNS) component supports 21 options, which are listed below.
 
 
 
@@ -69,6 +69,7 @@ The AWS 2 Simple Notification System (SNS) component supports 20 options, which
 | *subject* (producer) | The subject which is used if the message header 'CamelAwsSnsSubject' is not present. |  | String
 | *subscribeSNStoSQS* (producer) | Define if the subscription between SNS Topic and SQS must be done or not | false | boolean
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
+| *useIAMCredentials* (producer) | 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
 | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
 | *secretKey* (security) | Amazon AWS Secret Key |  | String
@@ -98,7 +99,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (21 parameters):
+=== Query Parameters (22 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -121,6 +122,7 @@ with the following path and query parameters:
 | *subject* (producer) | The subject which is used if the message header 'CamelAwsSnsSubject' is not present. |  | String
 | *subscribeSNStoSQS* (producer) | Define if the subscription between SNS Topic and SQS must be done or not | false | boolean
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
+| *useIAMCredentials* (producer) | 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
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
diff --git a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java
index 2b0bac1..6838ad8 100644
--- a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java
+++ b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java
@@ -64,6 +64,8 @@ public class Sns2ComponentConfigurer extends PropertyConfigurerSupport implement
         case "subscribeSNStoSQS": getOrCreateConfiguration(target).setSubscribeSNStoSQS(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;
         default: return false;
         }
     }
@@ -107,6 +109,8 @@ public class Sns2ComponentConfigurer extends PropertyConfigurerSupport implement
         case "subscribeSNStoSQS": return boolean.class;
         case "trustallcertificates":
         case "trustAllCertificates": return boolean.class;
+        case "useiamcredentials":
+        case "useIAMCredentials": return boolean.class;
         default: return null;
         }
     }
@@ -151,6 +155,8 @@ public class Sns2ComponentConfigurer extends PropertyConfigurerSupport implement
         case "subscribeSNStoSQS": return getOrCreateConfiguration(target).isSubscribeSNStoSQS();
         case "trustallcertificates":
         case "trustAllCertificates": return getOrCreateConfiguration(target).isTrustAllCertificates();
+        case "useiamcredentials":
+        case "useIAMCredentials": return getOrCreateConfiguration(target).isUseIAMCredentials();
         default: return null;
         }
     }
diff --git a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java
index bd7a1d9..0e559d7 100644
--- a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java
+++ b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java
@@ -59,6 +59,8 @@ public class Sns2EndpointConfigurer extends PropertyConfigurerSupport implements
         case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true;
         case "trustallcertificates":
         case "trustAllCertificates": target.getConfiguration().setTrustAllCertificates(property(camelContext, boolean.class, value)); return true;
+        case "useiamcredentials":
+        case "useIAMCredentials": target.getConfiguration().setUseIAMCredentials(property(camelContext, boolean.class, value)); return true;
         default: return false;
         }
     }
@@ -104,6 +106,8 @@ public class Sns2EndpointConfigurer extends PropertyConfigurerSupport implements
         case "synchronous": return boolean.class;
         case "trustallcertificates":
         case "trustAllCertificates": return boolean.class;
+        case "useiamcredentials":
+        case "useIAMCredentials": return boolean.class;
         default: return null;
         }
     }
@@ -150,6 +154,8 @@ public class Sns2EndpointConfigurer extends PropertyConfigurerSupport implements
         case "synchronous": return target.isSynchronous();
         case "trustallcertificates":
         case "trustAllCertificates": return target.getConfiguration().isTrustAllCertificates();
+        case "useiamcredentials":
+        case "useIAMCredentials": return target.getConfiguration().isUseIAMCredentials();
         default: return null;
         }
     }
diff --git a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java
index f830ab7..0b800df 100644
--- a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java
+++ b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java
@@ -20,7 +20,8 @@ public class Sns2EndpointUriFactory 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<>(22);
+        Set<String> props = new HashSet<>(23);
+        props.add("useIAMCredentials");
         props.add("basicPropertyBinding");
         props.add("autoDiscoverClient");
         props.add("serverSideEncryptionEnabled");
diff --git a/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json b/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json
index 2433361..64d5b91 100644
--- a/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json
+++ b/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json
@@ -39,6 +39,7 @@
     "subject": { "kind": "property", "displayName": "Subject", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The subject which is used if the message header 'CamelAwsSnsSubject' is not present." },
     "subscribeSNStoSQS": { "kind": "property", "displayName": "Subscribe SNSto SQS", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Define if the subscription between SNS Topic and SQS must be done or not" },
     "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
+    "useIAMCredentials": { "kind": "property", "displayName": "Use IAMCredentials", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials  [...]
     "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
     "accessKey": { "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
     "secretKey": { "kind": "property", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }
@@ -62,6 +63,7 @@
     "subject": { "kind": "parameter", "displayName": "Subject", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The subject which is used if the message header 'CamelAwsSnsSubject' is not present." },
     "subscribeSNStoSQS": { "kind": "parameter", "displayName": "Subscribe SNSto SQS", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Define if the subscription between SNS Topic and SQS must be done or not" },
     "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
+    "useIAMCredentials": { "kind": "parameter", "displayName": "Use IAMCredentials", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Set whether the SQS client should expect to load credentials on an AWS infra instance or to expect static credentials [...]
     "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
     "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported)." },
     "accessKey": { "kind": "parameter", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
diff --git a/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc b/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc
index 168dbff..59f18e2 100644
--- a/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc
+++ b/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc
@@ -45,7 +45,7 @@ The topic will be created if they don't already exists. +
 
 
 // component options: START
-The AWS 2 Simple Notification System (SNS) component supports 20 options, which are listed below.
+The AWS 2 Simple Notification System (SNS) component supports 21 options, which are listed below.
 
 
 
@@ -69,6 +69,7 @@ The AWS 2 Simple Notification System (SNS) component supports 20 options, which
 | *subject* (producer) | The subject which is used if the message header 'CamelAwsSnsSubject' is not present. |  | String
 | *subscribeSNStoSQS* (producer) | Define if the subscription between SNS Topic and SQS must be done or not | false | boolean
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
+| *useIAMCredentials* (producer) | 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
 | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
 | *secretKey* (security) | Amazon AWS Secret Key |  | String
@@ -98,7 +99,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (21 parameters):
+=== Query Parameters (22 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -121,6 +122,7 @@ with the following path and query parameters:
 | *subject* (producer) | The subject which is used if the message header 'CamelAwsSnsSubject' is not present. |  | String
 | *subscribeSNStoSQS* (producer) | Define if the subscription between SNS Topic and SQS must be done or not | false | boolean
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
+| *useIAMCredentials* (producer) | 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
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
index 716fe14..b5994e4 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
@@ -66,7 +66,7 @@ public class Sns2Configuration implements Cloneable {
     @UriParam(label = "common", defaultValue = "true")
     private boolean autoDiscoverClient = true;
     @UriParam(defaultValue = "false")
-    private boolean useIAMCredentials;    
+    private boolean useIAMCredentials;
 
     public String getSubject() {
         return subject;
@@ -278,7 +278,7 @@ public class Sns2Configuration implements Cloneable {
     public void setAutoDiscoverClient(boolean autoDiscoverClient) {
         this.autoDiscoverClient = autoDiscoverClient;
     }
-    
+
     public boolean isUseIAMCredentials() {
         return useIAMCredentials;
     }
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
index aeb11b0..ef5b00c 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.aws2.sns;
 
-import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 
diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java
index 7b17b9f..cefb059 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/impl/Sns2ClientStandardImpl.java
@@ -20,7 +20,6 @@ import java.net.URI;
 
 import org.apache.camel.component.aws2.sns.Sns2Configuration;
 import org.apache.camel.component.aws2.sns.client.Sns2InternalClient;
-import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -56,8 +55,8 @@ public class Sns2ClientStandardImpl implements Sns2InternalClient {
      * 
      * @return Amazon SNS Client.
      */
-	@Override
-	public SnsClient getSNSClient() {
+    @Override
+    public SnsClient getSNSClient() {
         SnsClient client = null;
         SnsClientBuilder clientBuilder = SnsClient.builder();
         ProxyConfiguration.Builder proxyConfig = null;
@@ -98,5 +97,5 @@ public class Sns2ClientStandardImpl implements Sns2InternalClient {
         }
         client = clientBuilder.build();
         return client;
-	}
+    }
 }
diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java
index 03a840a..bb35af7 100644
--- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java
+++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java
@@ -273,6 +273,20 @@ public interface Aws2SnsComponentBuilderFactory {
             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: producer
+         */
+        default Aws2SnsComponentBuilder useIAMCredentials(
+                boolean useIAMCredentials) {
+            doSetProperty("useIAMCredentials", useIAMCredentials);
+            return this;
+        }
+        /**
          * Whether the component should use basic property binding (Camel 2.x)
          * or the newer property binding with additional capabilities.
          * 
@@ -350,6 +364,7 @@ public interface Aws2SnsComponentBuilderFactory {
             case "subject": getOrCreateConfiguration((Sns2Component) component).setSubject((java.lang.String) value); return true;
             case "subscribeSNStoSQS": getOrCreateConfiguration((Sns2Component) component).setSubscribeSNStoSQS((boolean) value); return true;
             case "trustAllCertificates": getOrCreateConfiguration((Sns2Component) component).setTrustAllCertificates((boolean) value); return true;
+            case "useIAMCredentials": getOrCreateConfiguration((Sns2Component) component).setUseIAMCredentials((boolean) value); return true;
             case "basicPropertyBinding": ((Sns2Component) component).setBasicPropertyBinding((boolean) value); return true;
             case "accessKey": getOrCreateConfiguration((Sns2Component) component).setAccessKey((java.lang.String) value); return true;
             case "secretKey": getOrCreateConfiguration((Sns2Component) component).setSecretKey((java.lang.String) value); return true;
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java
index cccf389..14cecde 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java
@@ -394,6 +394,32 @@ public interface Sns2EndpointBuilderFactory {
             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: producer
+         */
+        default Sns2EndpointBuilder 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: producer
+         */
+        default Sns2EndpointBuilder useIAMCredentials(String useIAMCredentials) {
+            doSetProperty("useIAMCredentials", useIAMCredentials);
+            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-sns-component.adoc b/docs/components/modules/ROOT/pages/aws2-sns-component.adoc
index c5210ea..c774b77 100644
--- a/docs/components/modules/ROOT/pages/aws2-sns-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws2-sns-component.adoc
@@ -47,7 +47,7 @@ The topic will be created if they don't already exists. +
 
 
 // component options: START
-The AWS 2 Simple Notification System (SNS) component supports 20 options, which are listed below.
+The AWS 2 Simple Notification System (SNS) component supports 21 options, which are listed below.
 
 
 
@@ -71,6 +71,7 @@ The AWS 2 Simple Notification System (SNS) component supports 20 options, which
 | *subject* (producer) | The subject which is used if the message header 'CamelAwsSnsSubject' is not present. |  | String
 | *subscribeSNStoSQS* (producer) | Define if the subscription between SNS Topic and SQS must be done or not | false | boolean
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
+| *useIAMCredentials* (producer) | 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
 | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
 | *secretKey* (security) | Amazon AWS Secret Key |  | String
@@ -100,7 +101,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (21 parameters):
+=== Query Parameters (22 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -123,6 +124,7 @@ with the following path and query parameters:
 | *subject* (producer) | The subject which is used if the message header 'CamelAwsSnsSubject' is not present. |  | String
 | *subscribeSNStoSQS* (producer) | Define if the subscription between SNS Topic and SQS must be done or not | false | boolean
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
+| *useIAMCredentials* (producer) | 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
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String