use of org.graylog2.rest.resources.streams.responses.StreamListResponse in project graylog2-server by Graylog2.
the class StreamResource method getEnabled.
@GET
@Path("/enabled")
@Timed
@ApiOperation(value = "Get a list of all enabled streams")
@Produces(MediaType.APPLICATION_JSON)
public StreamListResponse getEnabled() throws NotFoundException {
final List<Stream> enabledStreams = streamService.loadAllEnabled();
final List<Stream> streams = new ArrayList<>(enabledStreams.size());
for (Stream stream : enabledStreams) {
if (isPermitted(RestPermissions.STREAMS_READ, stream.getId())) {
streams.add(stream);
}
}
return StreamListResponse.create(streams.size(), streams.stream().map(this::streamToResponse).collect(Collectors.toSet()));
}
use of org.graylog2.rest.resources.streams.responses.StreamListResponse in project graylog2-server by Graylog2.
the class StreamResource method get.
@GET
@Timed
@ApiOperation(value = "Get a list of all streams")
@Deprecated
@Produces(MediaType.APPLICATION_JSON)
public StreamListResponse get() {
final List<Stream> allStreams = streamService.loadAll();
final List<Stream> streams = new ArrayList<>(allStreams.size());
for (Stream stream : allStreams) {
if (isPermitted(RestPermissions.STREAMS_READ, stream.getId())) {
streams.add(stream);
}
}
return StreamListResponse.create(streams.size(), streams.stream().map(this::streamToResponse).collect(Collectors.toSet()));
}