use of io.hops.hopsworks.alerting.api.alert.dto.PostableSilence in project hopsworks by logicalclocks.
the class SilenceBuilder method getPostableSilence.
public PostableSilence getPostableSilence(PostableSilenceDTO postableSilenceDTO) {
PostableSilence postableSilence = new PostableSilence();
postableSilence.setId(postableSilenceDTO.getId());
postableSilence.setComment(postableSilenceDTO.getComment());
postableSilence.setEndsAt(postableSilenceDTO.getEndsAt());
postableSilence.setStartsAt(postableSilenceDTO.getStartsAt());
postableSilence.setMatchers(postableSilenceDTO.getMatchers());
return postableSilence;
}
use of io.hops.hopsworks.alerting.api.alert.dto.PostableSilence in project hopsworks by logicalclocks.
the class AdminSilenceResource method postSilence.
private SilenceID postSilence(PostableSilenceDTO postableSilenceDTO, Users users) throws AlertException {
PostableSilence postableSilence = silenceBuilder.getPostableSilence(postableSilenceDTO);
postableSilence.setCreatedBy(users.getEmail());
try {
return alertManager.postSilences(postableSilence);
} catch (AlertManagerClientCreateException | AlertManagerUnreachableException e) {
throw new AlertException(RESTCodes.AlertErrorCode.FAILED_TO_CONNECT, Level.FINE, e.getMessage());
} catch (AlertManagerResponseException e) {
throw new AlertException(RESTCodes.AlertErrorCode.RESPONSE_ERROR, Level.FINE, e.getMessage());
}
}
Aggregations