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 2021/04/30 06:42:13 UTC

[camel] 01/02: CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - EC2 Component

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 135e2ddbff754e27e31a12cf19b72b24dd9958a1
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 30 08:39:13 2021 +0200

    CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - EC2 Component
---
 .../java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
index 0139af2..9abcb4f 100644
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
@@ -54,9 +54,9 @@ public class AWS2EC2Component extends DefaultComponent {
                 = this.configuration != null ? this.configuration.copy() : new AWS2EC2Configuration();
         AWS2EC2Endpoint endpoint = new AWS2EC2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        if (configuration.getAmazonEc2Client() == null
+        if (!configuration.isUseDefaultCredentialsProvider() && configuration.getAmazonEc2Client() == null
                 && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
-            throw new IllegalArgumentException("amazonEC2Client or accessKey and secretKey must be specified");
+            throw new IllegalArgumentException("useDefaultCredentialsProvider is set to false, amazonEC2Client or accessKey and secretKey must be specified");
         }
 
         return endpoint;