diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java index 70822846fe..2ecab6d806 100644 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java +++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java @@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -89,6 +90,20 @@ public ResponseEntity addDataStream(@RequestBody SpDataStream dataStream) { } } + @PutMapping( + produces = MediaType.APPLICATION_JSON_VALUE, + consumes = MediaType.APPLICATION_JSON_VALUE + ) + @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_ELEMENT_PRIVILEGE) + public ResponseEntity updateDataStream(@RequestBody SpDataStream dataStream) { + try { + getDataStreamResourceManager().update(dataStream); + return ok(); + } catch (IllegalArgumentException e) { + return badRequest(e.getMessage()); + } + } + private DataStreamResourceManager getDataStreamResourceManager() { return getSpResourceManager().manageDataStreams(); }