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 19e66809538d277efcadfee4bec81a825c5cecc8
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Jun 18 10:42:13 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 Step Functions
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../camel/component/aws2/sns/Sns2Endpoint.java     |  2 +-
 .../aws2/stepfunctions/StepFunctions2Endpoint.java | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
 
b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
index 6331b2215b1..52d9c1b2691 100644
--- 
a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
@@ -223,7 +223,7 @@ public class Sns2Endpoint extends DefaultEndpoint 
implements HeaderFilterStrateg
 
     @Override
     public String getServiceProtocol() {
-        return "kinesis";
+        return "sns";
     }
 
     @Override
diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
index 1bdebe2fbac..5a2927bec7c 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
@@ -18,12 +18,15 @@ package org.apache.camel.component.aws2.stepfunctions;
 
 import org.apache.camel.*;
 import 
org.apache.camel.component.aws2.stepfunctions.client.StepFunctions2ClientFactory;
+import org.apache.camel.spi.EndpointServiceLocation;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.util.ObjectHelper;
 import software.amazon.awssdk.services.sfn.SfnClient;
 
+import java.util.Map;
+
 /**
  * Manage and invoke AWS Step functions.
  */
@@ -31,7 +34,7 @@ import software.amazon.awssdk.services.sfn.SfnClient;
              syntax = "aws2-step-functions:label",
              producerOnly = true, category = { Category.CLOUD, 
Category.SERVERLESS },
              headersClass = StepFunctions2Constants.class)
-public class StepFunctions2Endpoint extends DefaultEndpoint {
+public class StepFunctions2Endpoint extends DefaultEndpoint implements 
EndpointServiceLocation {
 
     private SfnClient awsSfnClient;
 
@@ -85,4 +88,21 @@ public class StepFunctions2Endpoint extends DefaultEndpoint {
         return awsSfnClient;
     }
 
+    @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 "step-functions";
+    }
+
 }

Reply via email to