This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-20798-AWS-complete
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 4db400ec28fea57466c3cd6aa2416611aba1c680
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Jun 18 10:21:59 2024 +0200

    CAMEL-20798: EndpointServiceLocation on components to make it possible to 
know which remote system Camel connects to to assist for monitoring and 
observability - AWS IAM
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../component/aws2/lambda/Lambda2Endpoint.java     | 26 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git 
a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
 
b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
index 7419d915ed8..3faa52f9c6e 100644
--- 
a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
@@ -22,21 +22,20 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.aws2.lambda.client.Lambda2ClientFactory;
-import org.apache.camel.spi.Metadata;
-import org.apache.camel.spi.UriEndpoint;
-import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriPath;
+import org.apache.camel.spi.*;
 import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.util.ObjectHelper;
 import software.amazon.awssdk.services.lambda.LambdaClient;
 
+import java.util.Map;
+
 /**
  * Manage and invoke AWS Lambda functions.
  */
 @UriEndpoint(firstVersion = "3.2.0", scheme = "aws2-lambda", title = "AWS 
Lambda", syntax = "aws2-lambda:function",
              producerOnly = true, category = { Category.CLOUD, 
Category.SERVERLESS },
              headersClass = Lambda2Constants.class)
-public class Lambda2Endpoint extends DefaultEndpoint {
+public class Lambda2Endpoint extends DefaultEndpoint implements 
EndpointServiceLocation {
 
     private LambdaClient awsLambdaClient;
 
@@ -102,4 +101,21 @@ public class Lambda2Endpoint extends DefaultEndpoint {
     public LambdaClient getAwsLambdaClient() {
         return awsLambdaClient;
     }
+
+    @Override
+    public String getServiceUrl() {
+        if (!configuration.isOverrideEndpoint()) {
+            if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+                return configuration.getRegion();
+            }
+        } else if 
(ObjectHelper.isNotEmpty(configuration.getUriEndpointOverride())) {
+            return configuration.getUriEndpointOverride();
+        }
+        return null;
+    }
+
+    @Override
+    public String getServiceProtocol() {
+        return "iam";
+    }
 }

Reply via email to