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 fb179f44b61de2dded5ef35c21f53a32fe96f581
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Jun 18 10:02:20 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]>
---
 .../camel/component/aws2/iam/IAM2Endpoint.java     | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java
 
b/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java
index 582b6af0c21..c259a6c61e7 100644
--- 
a/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java
@@ -22,19 +22,22 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.aws2.iam.client.IAM2ClientFactory;
+import org.apache.camel.spi.EndpointServiceLocation;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.ScheduledPollEndpoint;
 import org.apache.camel.util.ObjectHelper;
 import software.amazon.awssdk.services.iam.IamClient;
 
+import java.util.Map;
+
 /**
  * Manage AWS IAM instances.
  */
 @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-iam", title = "AWS 
Identity and Access Management (IAM)",
              syntax = "aws2-iam:label", producerOnly = true, category = { 
Category.CLOUD, Category.MANAGEMENT },
              headersClass = IAM2Constants.class)
-public class IAM2Endpoint extends ScheduledPollEndpoint {
+public class IAM2Endpoint extends ScheduledPollEndpoint implements 
EndpointServiceLocation {
 
     private IamClient iamClient;
 
@@ -86,4 +89,21 @@ public class IAM2Endpoint extends ScheduledPollEndpoint {
     public IamClient getIamClient() {
         return iamClient;
     }
+
+    @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 "eventbridge";
+    }
 }

Reply via email to