use of com.sequenceiq.periscope.domain.BaseAlert in project cloudbreak by hortonworks.
the class ScalingPolicyRequestConverter method convert.
@Override
public ScalingPolicyRequest convert(ScalingPolicy source) {
ScalingPolicyRequest json = new ScalingPolicyRequest();
json.setAdjustmentType(source.getAdjustmentType());
BaseAlert alert = source.getAlert();
if (alert != null) {
json.setAlertId(alert.getId());
}
json.setName(source.getName());
json.setScalingAdjustment(source.getScalingAdjustment());
json.setHostGroup(source.getHostGroup());
return json;
}
use of com.sequenceiq.periscope.domain.BaseAlert in project cloudbreak by hortonworks.
the class ScalingPolicyResponseConverter method convert.
@Override
public ScalingPolicyResponse convert(ScalingPolicy source) {
ScalingPolicyResponse json = new ScalingPolicyResponse();
json.setId(source.getId());
json.setAdjustmentType(source.getAdjustmentType());
BaseAlert alert = source.getAlert();
if (alert != null) {
json.setAlertId(alert.getId());
}
json.setName(source.getName());
json.setScalingAdjustment(source.getScalingAdjustment());
json.setHostGroup(source.getHostGroup());
return json;
}
use of com.sequenceiq.periscope.domain.BaseAlert in project cloudbreak by hortonworks.
the class ScalingHandler method onApplicationEvent.
@Override
public void onApplicationEvent(ScalingEvent event) {
BaseAlert alert = event.getAlert();
Cluster cluster = clusterService.find(alert.getCluster().getId());
MDCBuilder.buildMdcContext(cluster);
scale(cluster, alert.getScalingPolicy());
}
use of com.sequenceiq.periscope.domain.BaseAlert in project cloudbreak by hortonworks.
the class ScalingService method createPolicy.
public ScalingPolicy createPolicy(Long clusterId, Long alertId, ScalingPolicy policy) {
BaseAlert alert = alertService.getBaseAlert(clusterId, alertId);
policy.setAlert(alert);
ScalingPolicy scalingPolicy = policyRepository.save(policy);
alert.setScalingPolicy(scalingPolicy);
alertService.save(alert);
return scalingPolicy;
}
use of com.sequenceiq.periscope.domain.BaseAlert in project cloudbreak by hortonworks.
the class ScalingService method deletePolicy.
public void deletePolicy(Long clusterId, Long policyId) {
ScalingPolicy policy = getScalingPolicy(clusterId, policyId);
BaseAlert alert = policy.getAlert();
alert.setScalingPolicy(null);
policy.setAlert(null);
policyRepository.delete(policy);
alertService.save(alert);
}
Aggregations