use of org.graylog2.rest.models.streams.alerts.AlertConditionListSummary in project graylog2-server by Graylog2.
the class StreamAlertConditionResource method list.
@GET
@Timed
@ApiOperation(value = "Get all alert conditions of this stream")
@ApiResponses(value = { @ApiResponse(code = 404, message = "Stream not found."), @ApiResponse(code = 400, message = "Invalid ObjectId.") })
public AlertConditionListSummary list(@ApiParam(name = "streamId", value = "The stream id this new alert condition belongs to.", required = true) @PathParam("streamId") String streamid) throws NotFoundException {
checkPermission(RestPermissions.STREAMS_READ, streamid);
final Stream stream = streamService.load(streamid);
final List<AlertCondition> alertConditions = streamService.getAlertConditions(stream);
final List<AlertConditionSummary> conditionSummaries = alertConditions.stream().map((condition) -> AlertConditionSummary.create(condition.getId(), condition.getType(), condition.getCreatorUserId(), condition.getCreatedAt().toDate(), condition.getParameters(), alertService.inGracePeriod(condition), condition.getTitle())).collect(Collectors.toList());
return AlertConditionListSummary.create(conditionSummaries);
}
Aggregations