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/25 18:21:49 UTC
[streampipes] branch dev updated: add rest endpoint to query a function definition by it's id (#1149)
This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new ede2fff0b add rest endpoint to query a function definition by it's id (#1149)
ede2fff0b is described below
commit ede2fff0b15d89911c248631ae1310364d9e1750
Author: Tim <50...@users.noreply.github.com>
AuthorDate: Wed Jan 25 19:21:41 2023 +0100
add rest endpoint to query a function definition by it's id (#1149)
Co-authored-by: Philipp Zehnder <te...@users.noreply.github.com>
---
.../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)