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