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 a4cddaace6bd7056d370402b6c8af6e95c5cd33a Author: Andrea Cosentino <[email protected]> AuthorDate: Thu Jun 15 10:49:57 2023 +0200 CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS EKS Signed-off-by: Andrea Cosentino <[email protected]> --- .../camel/component/aws2/eks/EKS2Component.java | 4 ++-- .../component/aws2/eks/EKS2Configuration.java | 27 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Component.java b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Component.java index f2e682dddd9..28ddbc4564e 100644 --- a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Component.java +++ b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Component.java @@ -45,10 +45,10 @@ public class EKS2Component extends DefaultComponent { EKS2Configuration configuration = this.configuration != null ? this.configuration.copy() : new EKS2Configuration(); EKS2Endpoint endpoint = new EKS2Endpoint(uri, this, configuration); setProperties(endpoint, parameters); - if (Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider()) && configuration.getEksClient() == null + if (Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider()) && Boolean.FALSE.equals(configuration.isUseProfileCredentialsProvider()) && configuration.getEksClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { throw new IllegalArgumentException( - "useDefaultCredentialsProvider is set to false, Amazon eks client or accessKey and secretKey must be specified"); + "useDefaultCredentialsProvider is set to false, useProfileCredentialsProvider is set to false, Amazon eks client or accessKey and secretKey must be specified"); } return endpoint; diff --git a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Configuration.java b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Configuration.java index 013305be3a4..44e5aaf2003 100644 --- a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Configuration.java +++ b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2Configuration.java @@ -58,6 +58,10 @@ public class EKS2Configuration implements Cloneable { private String uriEndpointOverride; @UriParam(defaultValue = "false") private boolean useDefaultCredentialsProvider; + @UriParam(defaultValue = "false") + private boolean useProfileCredentialsProvider; + @UriParam + private String profileCredentialsName; public EksClient getEksClient() { return eksClient; @@ -204,6 +208,29 @@ public class EKS2Configuration implements Cloneable { public Boolean isUseDefaultCredentialsProvider() { return useDefaultCredentialsProvider; } + + + public boolean isUseProfileCredentialsProvider() { + return useProfileCredentialsProvider; + } + + /** + * Set whether the EKS 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; + } // ************************************************* // // *************************************************
