return response;
}
@Override
public AutoScaleVmGroupResponse createAutoScaleVmGroupResponse(AutoScaleVmGroup vmGroup) {
AutoScaleVmGroupResponse response = new AutoScaleVmGroupResponse();
response.setId(vmGroup.getUuid());
response.setMinMembers(vmGroup.getMinMembers());
response.setMaxMembers(vmGroup.getMaxMembers());
response.setState(vmGroup.getState());
response.setInterval(vmGroup.getInterval());
AutoScaleVmProfileVO profile = ApiDBUtils.findAutoScaleVmProfileById(vmGroup.getProfileId());
if (profile != null) {
response.setProfileId(profile.getUuid());
}
FirewallRuleVO fw = ApiDBUtils.findFirewallRuleById(vmGroup.getProfileId());
if (fw != null) {
response.setLoadBalancerId(fw.getUuid());
}
List<AutoScalePolicyResponse> scaleUpPoliciesResponse = new ArrayList<AutoScalePolicyResponse>();
List<AutoScalePolicyResponse> scaleDownPoliciesResponse = new ArrayList<AutoScalePolicyResponse>();
response.setScaleUpPolicies(scaleUpPoliciesResponse);
response.setScaleDownPolicies(scaleDownPoliciesResponse);
response.setObjectName("autoscalevmgroup");
// Fetch policies for vmgroup
List<AutoScalePolicy> scaleUpPolicies = new ArrayList<AutoScalePolicy>();
List<AutoScalePolicy> scaleDownPolicies = new ArrayList<AutoScalePolicy>();
ApiDBUtils.getAutoScaleVmGroupPolicies(vmGroup.getId(), scaleUpPolicies, scaleDownPolicies);