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/06/14 09:58:06 UTC
[camel] 01/06: CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS ECS
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 91f1a8617c49120511a047511d061f9ecd606f7b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jun 14 11:18:36 2023 +0200
CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS ECS
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../camel/component/aws2/ecs/ECS2Component.java | 4 +--
.../component/aws2/ecs/ECS2Configuration.java | 29 ++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
index c960ff0849a..f8948213f4b 100644
--- a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
+++ b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
@@ -45,10 +45,10 @@ public class ECS2Component extends DefaultComponent {
ECS2Configuration configuration = this.configuration != null ? this.configuration.copy() : new ECS2Configuration();
ECS2Endpoint endpoint = new ECS2Endpoint(uri, this, configuration);
setProperties(endpoint, parameters);
- if (Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider()) && configuration.getEcsClient() == null
+ if (Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider()) && Boolean.FALSE.equals(configuration.isUseProfileCredentialsProvider()) && configuration.getEcsClient() == null
&& (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
throw new IllegalArgumentException(
- "useDefaultCredentialsProvider is set to false, Amazon ecs client or accessKey and secretKey must be specified");
+ "useDefaultCredentialsProvider is set to false, useProfileCredentialsProvider is set to false, Amazon ecs client or accessKey and secretKey must be specified");
}
return endpoint;
diff --git a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Configuration.java b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Configuration.java
index e77236f61a4..52bfb6f7fa3 100644
--- a/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Configuration.java
+++ b/components/camel-aws/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Configuration.java
@@ -59,6 +59,12 @@ public class ECS2Configuration implements Cloneable {
@UriParam(defaultValue = "false")
private boolean useDefaultCredentialsProvider;
+ @UriParam(defaultValue = "false")
+ private boolean useProfileCredentialsProvider;
+
+ @UriParam
+ private String profileCredentialsName;
+
public EcsClient getEcsClient() {
return ecsClient;
}
@@ -204,6 +210,29 @@ public class ECS2Configuration implements Cloneable {
public Boolean isUseDefaultCredentialsProvider() {
return useDefaultCredentialsProvider;
}
+
+
+ public boolean isUseProfileCredentialsProvider() {
+ return useProfileCredentialsProvider;
+ }
+
+ /**
+ * Set whether the ECS client should expect to load credentials through a profile credentials provider.
+ */
+ public void setUseProfileCredentialsProvider(boolean useProfileCredentialsProvider) {
+ this.useProfileCredentialsProvider = useProfileCredentialsProvider;
+ }
+
+ public String getProfileCredentialsName() {
+ return profileCredentialsName;
+ }
+
+ /**
+ * If using a profile credentials provider this parameter will set the profile name
+ */
+ public void setProfileCredentialsName(String profileCredentialsName) {
+ this.profileCredentialsName = profileCredentialsName;
+ }
// *************************************************
//
// *************************************************