use of org.apache.cloudstack.api.response.GlobalLoadBalancerResponse in project cloudstack by apache.
the class ListGlobalLoadBalancerRuleCmd method execute.
@Override
public void execute() {
List<GlobalLoadBalancerRule> globalLoadBalancers = _gslbService.listGlobalLoadBalancerRule(this);
ListResponse<GlobalLoadBalancerResponse> gslbRuleResponse = new ListResponse<GlobalLoadBalancerResponse>();
List<GlobalLoadBalancerResponse> gslbResponses = new ArrayList<GlobalLoadBalancerResponse>();
if (globalLoadBalancers != null) {
for (GlobalLoadBalancerRule gslbRule : globalLoadBalancers) {
GlobalLoadBalancerResponse gslbResponse = _responseGenerator.createGlobalLoadBalancerResponse(gslbRule);
gslbResponse.setObjectName("globalloadbalancerrule");
gslbResponses.add(gslbResponse);
}
}
gslbRuleResponse.setResponses(gslbResponses);
gslbRuleResponse.setResponseName(getCommandName());
this.setResponseObject(gslbRuleResponse);
}
use of org.apache.cloudstack.api.response.GlobalLoadBalancerResponse in project cloudstack by apache.
the class UpdateGlobalLoadBalancerRuleCmd method execute.
@Override
public void execute() {
org.apache.cloudstack.context.CallContext.current().setEventDetails("Global Load balancer Id: " + getId());
GlobalLoadBalancerRule gslbRule = _gslbService.updateGlobalLoadBalancerRule(this);
if (gslbRule != null) {
GlobalLoadBalancerResponse response = _responseGenerator.createGlobalLoadBalancerResponse(gslbRule);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update global load balancer rule");
}
}
use of org.apache.cloudstack.api.response.GlobalLoadBalancerResponse in project cloudstack by apache.
the class ApiResponseHelper method createGlobalLoadBalancerResponse.
@Override
public GlobalLoadBalancerResponse createGlobalLoadBalancerResponse(GlobalLoadBalancerRule globalLoadBalancerRule) {
GlobalLoadBalancerResponse response = new GlobalLoadBalancerResponse();
response.setAlgorithm(globalLoadBalancerRule.getAlgorithm());
response.setStickyMethod(globalLoadBalancerRule.getPersistence());
response.setServiceType(globalLoadBalancerRule.getServiceType());
response.setServiceDomainName(globalLoadBalancerRule.getGslbDomain() + "." + ApiDBUtils.getDnsNameConfiguredForGslb());
response.setName(globalLoadBalancerRule.getName());
response.setDescription(globalLoadBalancerRule.getDescription());
response.setRegionIdId(globalLoadBalancerRule.getRegion());
response.setId(globalLoadBalancerRule.getUuid());
populateOwner(response, globalLoadBalancerRule);
response.setObjectName("globalloadbalancer");
List<LoadBalancerResponse> siteLbResponses = new ArrayList<LoadBalancerResponse>();
List<? extends LoadBalancer> siteLoadBalaners = ApiDBUtils.listSiteLoadBalancers(globalLoadBalancerRule.getId());
for (LoadBalancer siteLb : siteLoadBalaners) {
LoadBalancerResponse siteLbResponse = createLoadBalancerResponse(siteLb);
siteLbResponses.add(siteLbResponse);
}
response.setSiteLoadBalancers(siteLbResponses);
return response;
}
use of org.apache.cloudstack.api.response.GlobalLoadBalancerResponse in project cloudstack by apache.
the class CreateGlobalLoadBalancerRuleCmd method execute.
@Override
public void execute() throws ResourceAllocationException, ResourceUnavailableException {
GlobalLoadBalancerRule rule = _entityMgr.findById(GlobalLoadBalancerRule.class, getEntityId());
if (rule != null) {
GlobalLoadBalancerResponse response = _responseGenerator.createGlobalLoadBalancerResponse(rule);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}
Aggregations