Search in sources :

Example 1 with AlertRange

use of com.thinkbiganalytics.alerts.rest.model.AlertRange in project kylo by Teradata.

the class SlaIT method assertSuccessfulSlaAppearsNotInAlerts.

private void assertSuccessfulSlaAppearsNotInAlerts(String slaId) {
    AlertRange range = getAlerts();
    List<Alert> alerts = range.getAlerts();
    Assert.assertFalse(anyAlertMatch(slaId, alerts));
}
Also used : AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) Alert(com.thinkbiganalytics.alerts.rest.model.Alert)

Example 2 with AlertRange

use of com.thinkbiganalytics.alerts.rest.model.AlertRange in project kylo by Teradata.

the class SlaIT method assertFailedSlaAppearsInAlerts.

private void assertFailedSlaAppearsInAlerts(String slaId) {
    AlertRange range = getAlerts();
    List<Alert> alerts = range.getAlerts();
    Assert.assertTrue(anyAlertMatch(slaId, alerts));
}
Also used : AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) Alert(com.thinkbiganalytics.alerts.rest.model.Alert)

Example 3 with AlertRange

use of com.thinkbiganalytics.alerts.rest.model.AlertRange in project kylo by Teradata.

the class AlertsController method getAlerts.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Lists the current alerts.")
@ApiResponses(@ApiResponse(code = 200, message = "Returns the alerts.", response = AlertRange.class))
public AlertRange getAlerts(@QueryParam("limit") Integer limit, @QueryParam("type") String type, @QueryParam("subtype") String subtype, @QueryParam("state") String state, @QueryParam("level") String level, @QueryParam("before") String before, @QueryParam("after") String after, @QueryParam("cleared") @DefaultValue("false") String cleared, @QueryParam("filter") String filter) {
    List<Alert> alerts = new ArrayList<>();
    AlertCriteria criteria = createCriteria(limit, type, subtype, state, level, before, after, cleared);
    criteria.orFilter(filter);
    provider.getAlerts(criteria).forEachRemaining(alerts::add);
    return new AlertRange(alerts.stream().map(alertsModel::toModel).collect(Collectors.toList()));
}
Also used : AlertCriteria(com.thinkbiganalytics.alerts.api.AlertCriteria) AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) ArrayList(java.util.ArrayList) Alert(com.thinkbiganalytics.alerts.api.Alert) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

AlertRange (com.thinkbiganalytics.alerts.rest.model.AlertRange)3 Alert (com.thinkbiganalytics.alerts.rest.model.Alert)2 Alert (com.thinkbiganalytics.alerts.api.Alert)1 AlertCriteria (com.thinkbiganalytics.alerts.api.AlertCriteria)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1