Search in sources :

Example 1 with TimeAlert

use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.

the class AlertController method validateTimeAlert.

private TimeAlert validateTimeAlert(TimeAlertRequest json) throws ParseException {
    TimeAlert alert = timeAlertRequestConverter.convert(json);
    dateUtils.getCronExpression(alert.getCron());
    return alert;
}
Also used : TimeAlert(com.sequenceiq.periscope.domain.TimeAlert)

Example 2 with TimeAlert

use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.

the class TimeAlertRequestConverter method convert.

@Override
public TimeAlert convert(TimeAlertRequest source) {
    TimeAlert alarm = new TimeAlert();
    alarm.setName(source.getAlertName());
    alarm.setDescription(source.getDescription());
    alarm.setCron(source.getCron());
    alarm.setTimeZone(source.getTimeZone());
    if (source.getScalingPolicy() != null) {
        alarm.setScalingPolicy(scalingPolicyRequestConverter.convert(source.getScalingPolicy()));
    }
    return alarm;
}
Also used : TimeAlert(com.sequenceiq.periscope.domain.TimeAlert)

Example 3 with TimeAlert

use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.

the class TimeAlertResponseConverter method convert.

@Override
public TimeAlert convert(TimeAlertResponse source) {
    TimeAlert alarm = new TimeAlert();
    alarm.setName(source.getAlertName());
    alarm.setDescription(source.getDescription());
    alarm.setCron(source.getCron());
    alarm.setTimeZone(source.getTimeZone());
    if (source.getScalingPolicy() != null) {
        alarm.setScalingPolicy(scalingPolicyRequestConverter.convert(source.getScalingPolicy()));
    }
    return alarm;
}
Also used : TimeAlert(com.sequenceiq.periscope.domain.TimeAlert)

Example 4 with TimeAlert

use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.

the class AlertService method updateTimeAlert.

public TimeAlert updateTimeAlert(Long clusterId, Long alertId, TimeAlert timeAlert) {
    TimeAlert alert = timeAlertRepository.findByCluster(alertId, clusterId);
    alert.setDescription(timeAlert.getDescription());
    alert.setCron(timeAlert.getCron());
    alert.setTimeZone(timeAlert.getTimeZone());
    alert.setName(timeAlert.getName());
    return timeAlertRepository.save(alert);
}
Also used : TimeAlert(com.sequenceiq.periscope.domain.TimeAlert)

Example 5 with TimeAlert

use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.

the class DateUtilsTest method createTimeAlert.

private TimeAlert createTimeAlert(String cron, String timeZone) {
    TimeAlert testTime = new TimeAlert();
    testTime.setName("testAlert");
    testTime.setCron(cron);
    testTime.setTimeZone(timeZone);
    return testTime;
}
Also used : TimeAlert(com.sequenceiq.periscope.domain.TimeAlert)

Aggregations

TimeAlert (com.sequenceiq.periscope.domain.TimeAlert)14 ZoneId (java.time.ZoneId)7 ZonedDateTime (java.time.ZonedDateTime)7 Test (org.junit.Test)7 Cluster (com.sequenceiq.periscope.domain.Cluster)2 AutoscaleClusterRequest (com.sequenceiq.periscope.api.model.AutoscaleClusterRequest)1 MetricAlertRequest (com.sequenceiq.periscope.api.model.MetricAlertRequest)1 PrometheusAlertRequest (com.sequenceiq.periscope.api.model.PrometheusAlertRequest)1 ScalingConfigurationRequest (com.sequenceiq.periscope.api.model.ScalingConfigurationRequest)1 TimeAlertRequest (com.sequenceiq.periscope.api.model.TimeAlertRequest)1 MetricAlert (com.sequenceiq.periscope.domain.MetricAlert)1 PrometheusAlert (com.sequenceiq.periscope.domain.PrometheusAlert)1 ScalingEvent (com.sequenceiq.periscope.monitor.event.ScalingEvent)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 Component (org.springframework.stereotype.Component)1