use of org.graylog2.rest.models.alarmcallbacks.AlarmCallbackHistorySummary in project graylog2-server by Graylog2.
the class AlarmCallbackHistoryResource method getForAlert.
@GET
@Timed
@ApiOperation(value = "Get a list of all alarm callbacks for this stream")
@Produces(MediaType.APPLICATION_JSON)
public AlarmCallbackHistoryListSummary getForAlert(@ApiParam(name = "streamid", value = "The id of the stream whose alarm callbacks history we want.", required = true) @PathParam("streamid") String streamid, @ApiParam(name = "alertId", value = "The id of the alert whose callback history we want.", required = true) @PathParam("alertId") String alertId) throws NotFoundException {
checkPermission(RestPermissions.STREAMS_READ, streamid);
final List<AlarmCallbackHistory> historyList = this.alarmCallbackHistoryService.getForAlertId(alertId);
final List<AlarmCallbackHistorySummary> historySummaryList = Lists.newArrayListWithCapacity(historyList.size());
for (AlarmCallbackHistory alarmCallbackHistory : historyList) {
historySummaryList.add(AlarmCallbackHistorySummary.create(alarmCallbackHistory.id(), alarmCallbackHistory.alarmcallbackConfiguration(), alarmCallbackHistory.alertId(), alarmCallbackHistory.alertConditionId(), alarmCallbackHistory.result(), alarmCallbackHistory.createdAt()));
}
return AlarmCallbackHistoryListSummary.create(historySummaryList);
}
Aggregations