Search in sources :

Example 1 with ReceiverName

use of io.hops.hopsworks.alerting.api.alert.dto.ReceiverName in project hopsworks by logicalclocks.

the class AlertManagerClient method getReceivers.

public List<ReceiverName> getReceivers() throws AlertManagerResponseException, AlertManagerServerException {
    WebTarget wt = webTarget.path(Settings.ALERTS_API_RECEIVERS);
    LOGGER.log(Level.FINE, "Sending request getReceivers to: {0}", wt.toString());
    List<ReceiverName> receiver = getResponseList(sendRequest(wt.request(MediaType.APPLICATION_JSON), RequestMethod.GET, null), ReceiverName.class);
    return receiver;
}
Also used : WebTarget(javax.ws.rs.client.WebTarget) ReceiverName(io.hops.hopsworks.alerting.api.alert.dto.ReceiverName)

Example 2 with ReceiverName

use of io.hops.hopsworks.alerting.api.alert.dto.ReceiverName in project hopsworks by logicalclocks.

the class AlertManager method getReceivers.

public List<ReceiverName> getReceivers() throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        List<ReceiverName> response = client.getReceivers();
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException) ReceiverName(io.hops.hopsworks.alerting.api.alert.dto.ReceiverName)

Example 3 with ReceiverName

use of io.hops.hopsworks.alerting.api.alert.dto.ReceiverName in project hopsworks by logicalclocks.

the class ReceiverBuilder method itemsExpand.

private ReceiverDTO itemsExpand(ReceiverDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, ReceiverBeanParam receiverBeanParam, Project project, Boolean includeGlobal) throws AlertException {
    uri(dto, uriInfo);
    expand(dto, resourceRequest);
    if (dto.isExpand()) {
        List<ReceiverName> receiverNameList = getReceiverNames(project, includeGlobal);
        List<Receiver> receivers = new ArrayList<>();
        for (ReceiverName receiverName : receiverNameList) {
            receivers.add(getReceiver(receiverName.getName(), project));
        }
        dto.setCount((long) receivers.size());
        return itemsExpand(dto, uriInfo, resourceRequest, receiverBeanParam, receivers);
    }
    return dto;
}
Also used : ArrayList(java.util.ArrayList) Receiver(io.hops.hopsworks.alerting.config.dto.Receiver) ReceiverName(io.hops.hopsworks.alerting.api.alert.dto.ReceiverName)

Aggregations

ReceiverName (io.hops.hopsworks.alerting.api.alert.dto.ReceiverName)3 AlertManagerUnreachableException (io.hops.hopsworks.alert.exception.AlertManagerUnreachableException)1 Receiver (io.hops.hopsworks.alerting.config.dto.Receiver)1 AlertManagerServerException (io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)1 ArrayList (java.util.ArrayList)1 WebTarget (javax.ws.rs.client.WebTarget)1