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 2023/04/24 09:47:23 UTC

[camel] 02/06: CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS SNS

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 344cce859b3a2206d507eafddbc44ab30812b32b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 24 10:22:24 2023 +0200

    CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS SNS
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../camel/component/aws2/sns/client/Sns2ClientFactory.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java
index 364aaf6fca0..c079e520e1e 100644
--- a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java
+++ b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/client/Sns2ClientFactory.java
@@ -18,6 +18,7 @@ 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.Sns2ClientIAMProfileOptimized;
 import org.apache.camel.component.aws2.sns.client.impl.Sns2ClientStandardImpl;
 
 /**
@@ -35,7 +36,12 @@ public final class Sns2ClientFactory {
      * @return               SNSClient
      */
     public static Sns2InternalClient getSnsClient(Sns2Configuration configuration) {
-        return configuration.isUseDefaultCredentialsProvider()
-                ? new Sns2ClientIAMOptimized(configuration) : new Sns2ClientStandardImpl(configuration);
+        if (Boolean.TRUE.equals(configuration.isUseDefaultCredentialsProvider())) {
+            return new Sns2ClientIAMOptimized(configuration);
+        } else if (Boolean.TRUE.equals(configuration.isUseProfileCredentialsProvider())) {
+            return new Sns2ClientIAMProfileOptimized(configuration);
+        } else {
+            return new Sns2ClientStandardImpl(configuration);
+        }
     }
 }