Search in sources :

Example 1 with AvailableAlarmCallbacksResponse

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

the class AlarmCallbacksResource method available.

@GET
@Path("/types")
@Timed
@ApiOperation(value = "Get a list of all alarm callbacks types")
public AvailableAlarmCallbacksResponse available() {
    final Map<String, AvailableAlarmCallbackSummaryResponse> types = Maps.newHashMapWithExpectedSize(availableAlarmCallbacks.size());
    for (AlarmCallback availableAlarmCallback : availableAlarmCallbacks) {
        final AvailableAlarmCallbackSummaryResponse type = new AvailableAlarmCallbackSummaryResponse();
        type.name = availableAlarmCallback.getName();
        type.requested_configuration = getConfigurationRequest(availableAlarmCallback).asList();
        types.put(availableAlarmCallback.getClass().getCanonicalName(), type);
    }
    final AvailableAlarmCallbacksResponse response = new AvailableAlarmCallbacksResponse();
    response.types = types;
    return response;
}
Also used : AvailableAlarmCallbackSummaryResponse(org.graylog2.rest.models.alarmcallbacks.responses.AvailableAlarmCallbackSummaryResponse) EmailAlarmCallback(org.graylog2.alarmcallbacks.EmailAlarmCallback) AlarmCallback(org.graylog2.plugin.alarms.callbacks.AlarmCallback) AvailableAlarmCallbacksResponse(org.graylog2.rest.models.alarmcallbacks.responses.AvailableAlarmCallbacksResponse) Path(javax.ws.rs.Path) 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 Path (javax.ws.rs.Path)1 EmailAlarmCallback (org.graylog2.alarmcallbacks.EmailAlarmCallback)1 AlarmCallback (org.graylog2.plugin.alarms.callbacks.AlarmCallback)1 AvailableAlarmCallbackSummaryResponse (org.graylog2.rest.models.alarmcallbacks.responses.AvailableAlarmCallbackSummaryResponse)1 AvailableAlarmCallbacksResponse (org.graylog2.rest.models.alarmcallbacks.responses.AvailableAlarmCallbacksResponse)1