Search in sources :

Example 1 with AlarmCallbackSummary

use of org.graylog2.rest.models.alarmcallbacks.AlarmCallbackSummary in project graylog2-server by Graylog2.

the class StreamAlarmCallbackResource method get.

@GET
@Timed
@ApiOperation(value = "Get a list of all alarm callbacks for this stream")
@Produces(MediaType.APPLICATION_JSON)
public AlarmCallbackListSummary get(@ApiParam(name = "streamid", value = "The id of the stream whose alarm callbacks we want.", required = true) @PathParam("streamid") String streamid) throws NotFoundException {
    checkPermission(RestPermissions.STREAMS_READ, streamid);
    final Stream stream = streamService.load(streamid);
    final List<AlarmCallbackSummary> alarmCallbacks = Lists.newArrayList();
    for (AlarmCallbackConfiguration callback : alarmCallbackConfigurationService.getForStream(stream)) {
        alarmCallbacks.add(AlarmCallbackSummary.create(callback.getId(), callback.getStreamId(), callback.getType(), callback.getTitle(), callback.getConfiguration(), callback.getCreatedAt(), callback.getCreatorUserId()));
    }
    return AlarmCallbackListSummary.create(alarmCallbacks);
}
Also used : AlarmCallbackSummary(org.graylog2.rest.models.alarmcallbacks.AlarmCallbackSummary) Stream(org.graylog2.plugin.streams.Stream) AlarmCallbackConfiguration(org.graylog2.alarmcallbacks.AlarmCallbackConfiguration) 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 AlarmCallbackConfiguration (org.graylog2.alarmcallbacks.AlarmCallbackConfiguration)1 Stream (org.graylog2.plugin.streams.Stream)1 AlarmCallbackSummary (org.graylog2.rest.models.alarmcallbacks.AlarmCallbackSummary)1