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 <[email protected]>
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 <[email protected]>
---
 .../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)

Reply via email to