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/23 10:47:30 UTC

[camel] 04/12: CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS Translate

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 3a648228ac09e5a2af2691d14b188d0e70b6ca1e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jun 23 11:29:55 2023 +0200

    CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS Translate
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../apache/camel/component/aws2/translate/Translate2Component.java    | 4 +++-
 .../camel/component/aws2/translate/Translate2Configuration.java       | 1 -
 .../translate/client/impl/Translate2ClientIAMProfileOptimized.java    | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Component.java b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Component.java
index c021af3b832..38ef1b5e43b 100644
--- a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Component.java
+++ b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Component.java
@@ -47,7 +47,9 @@ public class Translate2Component extends DefaultComponent {
 
         Translate2Endpoint endpoint = new Translate2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        if (Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider()) && Boolean.FALSE.equals(configuration.isUseProfileCredentialsProvider()) && configuration.getTranslateClient() == null
+        if (Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider())
+                && Boolean.FALSE.equals(configuration.isUseProfileCredentialsProvider())
+                && configuration.getTranslateClient() == null
                 && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException(
                     "useDefaultCredentialsProvider is set to false, useProfileCredentialsProvider is set to false, Amazon translate client or accessKey and secretKey must be specified");
diff --git a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Configuration.java b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Configuration.java
index 355f4effd44..a727980d384 100644
--- a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Configuration.java
+++ b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Configuration.java
@@ -69,7 +69,6 @@ public class Translate2Configuration implements Cloneable {
     @UriParam
     private String profileCredentialsName;
 
-
     public TranslateClient getTranslateClient() {
         return translateClient;
     }
diff --git a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/client/impl/Translate2ClientIAMProfileOptimized.java b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/client/impl/Translate2ClientIAMProfileOptimized.java
index 04fcc69f04e..21f14c6f06b 100644
--- a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/client/impl/Translate2ClientIAMProfileOptimized.java
+++ b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/client/impl/Translate2ClientIAMProfileOptimized.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.aws2.translate.client.impl;
 
+import java.net.URI;
+
 import org.apache.camel.component.aws2.translate.Translate2Configuration;
 import org.apache.camel.component.aws2.translate.client.Translate2InternalClient;
 import org.apache.camel.util.ObjectHelper;
@@ -31,8 +33,6 @@ import software.amazon.awssdk.services.translate.TranslateClient;
 import software.amazon.awssdk.services.translate.TranslateClientBuilder;
 import software.amazon.awssdk.utils.AttributeMap;
 
-import java.net.URI;
-
 /**
  * Manage an AWS Translate client for all users to use. This implementation is for remote instances to manage the
  * credentials on their own (eliminating credential rotations)