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/03/11 14:51:43 UTC

[camel] branch master updated (dc8ba28 -> 6ba09ac)

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 dc8ba28  Merge pull request #3624 from aashnajena/patch-1
     new 8a9f433  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, IAM
     new 6ba09ac  Camel-AWS2-IAM: Fixed CS

The 2 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:
 .../camel/component/aws2/iam/IAM2Component.java    | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)


[camel] 01/02: CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, IAM

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 8a9f433137a4e4a44b5562e3a0080d0de6436f24
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 15:46:51 2020 +0100

    CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, IAM
---
 .../camel/component/aws2/iam/IAM2Component.java    | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java
index 3c113eb..fd7931e 100644
--- a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java
+++ b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java
@@ -24,6 +24,10 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import software.amazon.awssdk.services.iam.IamClient;
 
 /**
@@ -31,6 +35,8 @@ import software.amazon.awssdk.services.iam.IamClient;
  */
 @Component("aws2-iam")
 public class IAM2Component extends DefaultComponent {
+	
+    private static final Logger LOG = LoggerFactory.getLogger(IAM2Component.class);
 
     @Metadata
     private IAM2Configuration configuration = new IAM2Configuration();
@@ -50,7 +56,7 @@ public class IAM2Component extends DefaultComponent {
         IAM2Configuration configuration = this.configuration != null ? this.configuration.copy() : new IAM2Configuration();
         IAM2Endpoint endpoint = new IAM2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (configuration.getIamClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("Amazon IAM client or accessKey and secretKey must be specified");
         }
@@ -69,10 +75,18 @@ public class IAM2Component extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(IAM2Configuration configuration) {
-        Set<IamClient> clients = getCamelContext().getRegistry().findByType(IamClient.class);
-        if (clients.size() == 1) {
-            configuration.setIamClient(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(IAM2Configuration configuration, IAM2Endpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getIamClient())) {
+            LOG.debug("Looking for an IamClient instance in the registry");
+            Set<IamClient> clients = getCamelContext().getRegistry().findByType(IamClient.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one IamClient instance in the registry");
+                configuration.setIamClient(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No IamClient instance in the registry");
+            }
+        } else {
+            LOG.debug("IamClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }


[camel] 02/02: Camel-AWS2-IAM: Fixed CS

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 6ba09ac07d1bd483a0d9f48653f29f9e040d213e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 15:48:41 2020 +0100

    Camel-AWS2-IAM: Fixed CS
---
 .../main/java/org/apache/camel/component/aws2/iam/IAM2Component.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java
index fd7931e..218d175 100644
--- a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java
+++ b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Component.java
@@ -27,7 +27,6 @@ import org.apache.camel.support.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import software.amazon.awssdk.services.iam.IamClient;
 
 /**
@@ -35,7 +34,7 @@ import software.amazon.awssdk.services.iam.IamClient;
  */
 @Component("aws2-iam")
 public class IAM2Component extends DefaultComponent {
-	
+
     private static final Logger LOG = LoggerFactory.getLogger(IAM2Component.class);
 
     @Metadata