This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-20798-AWS-full in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5aab21eb3272dab6292ba2c69aa1e2305d1628aa Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Jun 11 11:56:09 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 Athena Signed-off-by: Andrea Cosentino <anco...@gmail.com> --- .../component/aws2/athena/Athena2Endpoint.java | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/components/camel-aws/camel-aws2-athena/src/main/java/org/apache/camel/component/aws2/athena/Athena2Endpoint.java b/components/camel-aws/camel-aws2-athena/src/main/java/org/apache/camel/component/aws2/athena/Athena2Endpoint.java index 2e5a3dedc4a..6b86773919e 100644 --- a/components/camel-aws/camel-aws2-athena/src/main/java/org/apache/camel/component/aws2/athena/Athena2Endpoint.java +++ b/components/camel-aws/camel-aws2-athena/src/main/java/org/apache/camel/component/aws2/athena/Athena2Endpoint.java @@ -22,18 +22,21 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.athena.client.Athena2ClientFactory; +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.athena.AthenaClient; +import java.util.Map; + /** * Access AWS Athena. */ @UriEndpoint(firstVersion = "3.4.0", scheme = "aws2-athena", title = "AWS Athena", syntax = "aws2-athena:label", producerOnly = true, category = { Category.CLOUD, Category.DATABASE }, headersClass = Athena2Constants.class) -public class Athena2Endpoint extends DefaultEndpoint { +public class Athena2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { private AthenaClient athenaClient; @@ -95,4 +98,25 @@ public class Athena2Endpoint extends DefaultEndpoint { public void setAthenaClient(AthenaClient athenaClient) { this.athenaClient = athenaClient; } + + @Override + public String getServiceUrl() { + if (ObjectHelper.isNotEmpty(configuration.getRegion())) { + return configuration.getRegion(); + } + return null; + } + + @Override + public String getServiceProtocol() { + return "athena"; + } + + @Override + public Map<String, String> getServiceMetadata() { + if (configuration.getDatabase() != null) { + return Map.of("database", configuration.getDatabase()); + } + return null; + } }