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


The following commit(s) were added to refs/heads/main by this push:
     new 309de7ee038 CAMEL-20798: EndpointServiceLocation on components to make 
it possible to know which remote system Camel connects to to assist for 
monitoring and observability - AWS EC2 (#14528)
309de7ee038 is described below

commit 309de7ee0383200f89c8fbcfbe0fc50583872fa0
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Jun 14 10:49:05 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 EC2 (#14528)
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../camel/component/aws2/ec2/AWS2EC2Endpoint.java    | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
 
b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
index 79c566322c5..62595174e32 100644
--- 
a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
@@ -22,6 +22,7 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.aws2.ec2.client.AWS2EC2ClientFactory;
+import org.apache.camel.spi.EndpointServiceLocation;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
@@ -34,7 +35,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client;
 @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-ec2", title = "AWS Elastic 
Compute Cloud (EC2)",
              syntax = "aws2-ec2:label", producerOnly = true, category = { 
Category.CLOUD, Category.MANAGEMENT },
              headersClass = AWS2EC2Constants.class)
-public class AWS2EC2Endpoint extends DefaultEndpoint {
+public class AWS2EC2Endpoint extends DefaultEndpoint implements 
EndpointServiceLocation {
 
     private Ec2Client ec2Client;
 
@@ -87,4 +88,21 @@ public class AWS2EC2Endpoint extends DefaultEndpoint {
     public AWS2EC2Component getComponent() {
         return (AWS2EC2Component) super.getComponent();
     }
+
+    @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 "ec2";
+    }
 }

Reply via email to