You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2023/01/23 19:04:19 UTC
[streampipes] 01/01: add rest endpoint to query a function definition by it's id
This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch feature/add-function-get-endpoint
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 63f047da1dffff8d4860d3337c0b61fdbf97bd7a
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Jan 23 20:04:05 2023 +0100
add rest endpoint to query a function definition by it's id
---
.../streampipes/manager/function/FunctionRegistrationService.java | 4 ++++
.../java/org/apache/streampipes/rest/impl/FunctionsResource.java | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/function/FunctionRegistrationService.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/function/FunctionRegistrationService.java
index 33e5fe790..92d40d3a2 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/function/FunctionRegistrationService.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/function/FunctionRegistrationService.java
@@ -38,6 +38,10 @@ public enum FunctionRegistrationService {
return registeredFunctions.values();
}
+ public FunctionDefinition getFunction (String functionId) {
+ return registeredFunctions.get(functionId);
+ }
+
public void registerFunction(FunctionDefinition function) {
this.registeredFunctions.put(function.getFunctionId().getId(), function);
}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FunctionsResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FunctionsResource.java
index 7903b3e18..335e72c65 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FunctionsResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FunctionsResource.java
@@ -45,6 +45,13 @@ public class FunctionsResource extends AbstractAuthGuardedRestResource {
return ok(FunctionRegistrationService.INSTANCE.getAllFunctions());
}
+ @GET
+ @Path("{functionId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getFunction(@PathParam("functionId") String functionId) {
+ return ok(FunctionRegistrationService.INSTANCE.getFunction(functionId));
+ }
+
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)