Search in sources :

Example 1 with AlarmCallbackHistorySummary

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);
}
Also used : AlarmCallbackHistory(org.graylog2.alarmcallbacks.AlarmCallbackHistory) AlarmCallbackHistorySummary(org.graylog2.rest.models.alarmcallbacks.AlarmCallbackHistorySummary) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 AlarmCallbackHistory (org.graylog2.alarmcallbacks.AlarmCallbackHistory)1 AlarmCallbackHistorySummary (org.graylog2.rest.models.alarmcallbacks.AlarmCallbackHistorySummary)1