Skip to content

Commit

Permalink
apache#3042 added Put endpoint to Data Streams back-end
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaakKrut committed Aug 20, 2024
1 parent 84d6082 commit a594748
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit a594748

Please sign in to comment.