Search in sources :

Example 1 with TimeAlertResponse

use of com.sequenceiq.periscope.api.model.TimeAlertResponse in project cloudbreak by hortonworks.

the class TimeAlertResponseConverter method convert.

@Override
public TimeAlertResponse convert(TimeAlert source) {
    TimeAlertResponse json = new TimeAlertResponse();
    json.setId(source.getId());
    json.setAlertName(source.getName());
    json.setCron(source.getCron());
    json.setTimeZone(source.getTimeZone());
    json.setDescription(source.getDescription());
    json.setScalingPolicyId(source.getScalingPolicyId());
    if (source.getScalingPolicy() != null) {
        json.setScalingPolicy(scalingPolicyRequestConverter.convert(source.getScalingPolicy()));
    }
    return json;
}
Also used : TimeAlertResponse(com.sequenceiq.periscope.api.model.TimeAlertResponse)

Example 2 with TimeAlertResponse

use of com.sequenceiq.periscope.api.model.TimeAlertResponse in project cloudbreak by hortonworks.

the class ClusterConverter method convert.

@Override
public AutoscaleClusterResponse convert(Cluster source) {
    AutoscaleClusterResponse json = new AutoscaleClusterResponse(source.getHost(), source.getPort(), source.getAmbariUser(), source.getStackId(), source.isAutoscalingEnabled(), source.getId(), source.getState().name());
    if (!source.getMetricAlerts().isEmpty()) {
        List<MetricAlertResponse> metricAlerts = metricAlertResponseConverter.convertAllToJson(new ArrayList<>(source.getMetricAlerts()));
        json.setMetricAlerts(metricAlerts);
    }
    if (!source.getTimeAlerts().isEmpty()) {
        List<TimeAlertResponse> timeAlertRequests = timeAlertResponseConverter.convertAllToJson(new ArrayList<>(source.getTimeAlerts()));
        json.setTimeAlerts(timeAlertRequests);
    }
    if (!source.getPrometheusAlerts().isEmpty()) {
        List<PrometheusAlertResponse> prometheusAlertRequests = prometheusAlertResponseConverter.convertAllToJson(new ArrayList<>(source.getPrometheusAlerts()));
        json.setPrometheusAlerts(prometheusAlertRequests);
    }
    ScalingConfigurationRequest scalingConfig = new ScalingConfigurationRequest(source.getMinSize(), source.getMaxSize(), source.getCoolDown());
    json.setScalingConfiguration(scalingConfig);
    return json;
}
Also used : AutoscaleClusterResponse(com.sequenceiq.periscope.api.model.AutoscaleClusterResponse) ScalingConfigurationRequest(com.sequenceiq.periscope.api.model.ScalingConfigurationRequest) TimeAlertResponse(com.sequenceiq.periscope.api.model.TimeAlertResponse) PrometheusAlertResponse(com.sequenceiq.periscope.api.model.PrometheusAlertResponse) MetricAlertResponse(com.sequenceiq.periscope.api.model.MetricAlertResponse)

Aggregations

TimeAlertResponse (com.sequenceiq.periscope.api.model.TimeAlertResponse)2 AutoscaleClusterResponse (com.sequenceiq.periscope.api.model.AutoscaleClusterResponse)1 MetricAlertResponse (com.sequenceiq.periscope.api.model.MetricAlertResponse)1 PrometheusAlertResponse (com.sequenceiq.periscope.api.model.PrometheusAlertResponse)1 ScalingConfigurationRequest (com.sequenceiq.periscope.api.model.ScalingConfigurationRequest)1