use of org.apache.cloudstack.api.response.LBStickinessPolicyResponse in project cloudstack by apache.
the class ApiResponseHelper method createLBStickinessPolicyResponse.
@Override
public LBStickinessResponse createLBStickinessPolicyResponse(List<? extends StickinessPolicy> stickinessPolicies, LoadBalancer lb) {
LBStickinessResponse spResponse = new LBStickinessResponse();
if (lb == null) {
return spResponse;
}
spResponse.setlbRuleId(lb.getUuid());
Account account = ApiDBUtils.findAccountById(lb.getAccountId());
if (account != null) {
spResponse.setAccountName(account.getAccountName());
Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
if (domain != null) {
spResponse.setDomainId(domain.getUuid());
spResponse.setDomainName(domain.getName());
}
}
List<LBStickinessPolicyResponse> responses = new ArrayList<LBStickinessPolicyResponse>();
for (StickinessPolicy stickinessPolicy : stickinessPolicies) {
LBStickinessPolicyResponse ruleResponse = new LBStickinessPolicyResponse(stickinessPolicy);
responses.add(ruleResponse);
}
spResponse.setRules(responses);
spResponse.setObjectName("stickinesspolicies");
return spResponse;
}
use of org.apache.cloudstack.api.response.LBStickinessPolicyResponse in project cloudstack by apache.
the class ApiResponseHelper method createLBStickinessPolicyResponse.
@Override
public LBStickinessResponse createLBStickinessPolicyResponse(StickinessPolicy stickinessPolicy, LoadBalancer lb) {
LBStickinessResponse spResponse = new LBStickinessResponse();
spResponse.setlbRuleId(lb.getUuid());
Account accountTemp = ApiDBUtils.findAccountById(lb.getAccountId());
if (accountTemp != null) {
spResponse.setAccountName(accountTemp.getAccountName());
Domain domain = ApiDBUtils.findDomainById(accountTemp.getDomainId());
if (domain != null) {
spResponse.setDomainId(domain.getUuid());
spResponse.setDomainName(domain.getName());
}
}
List<LBStickinessPolicyResponse> responses = new ArrayList<LBStickinessPolicyResponse>();
LBStickinessPolicyResponse ruleResponse = new LBStickinessPolicyResponse(stickinessPolicy);
responses.add(ruleResponse);
spResponse.setRules(responses);
spResponse.setObjectName("stickinesspolicies");
return spResponse;
}
Aggregations