return spResponse;
}
@Override
public LBHealthCheckResponse createLBHealthCheckPolicyResponse(List<? extends HealthCheckPolicy> healthcheckPolicies, LoadBalancer lb) {
LBHealthCheckResponse hcResponse = new LBHealthCheckResponse();
if (lb == null) {
return hcResponse;
}
hcResponse.setlbRuleId(lb.getUuid());
Account account = ApiDBUtils.findAccountById(lb.getAccountId());
if (account != null) {
hcResponse.setAccountName(account.getAccountName());
Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
if (domain != null) {
hcResponse.setDomainId(domain.getUuid());
hcResponse.setDomainName(domain.getName());
}
}
List<LBHealthCheckPolicyResponse> responses = new ArrayList<LBHealthCheckPolicyResponse>();
for (HealthCheckPolicy healthcheckPolicy : healthcheckPolicies) {
LBHealthCheckPolicyResponse ruleResponse = new LBHealthCheckPolicyResponse(healthcheckPolicy);
responses.add(ruleResponse);
}
hcResponse.setRules(responses);
hcResponse.setObjectName("healthcheckpolicies");
return hcResponse;
}