use of com.cloud.region.ha.GlobalLoadBalancerRule 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 com.cloud.region.ha.GlobalLoadBalancerRule 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 com.cloud.region.ha.GlobalLoadBalancerRule in project cloudstack by apache.
the class GlobalLoadBalancingRulesServiceImpl method revokeAllGslbRulesForAccount.
@Override
public boolean revokeAllGslbRulesForAccount(com.cloud.user.Account caller, long accountId) throws com.cloud.exception.ResourceUnavailableException {
List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByAccount(accountId);
if (gslbRules != null && !gslbRules.isEmpty()) {
for (GlobalLoadBalancerRule gslbRule : gslbRules) {
revokeGslbRule(gslbRule.getId(), caller);
}
}
s_logger.debug("Successfully cleaned up GSLB rules for account id=" + accountId);
return true;
}
use of com.cloud.region.ha.GlobalLoadBalancerRule 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);
}
}
use of com.cloud.region.ha.GlobalLoadBalancerRule in project cloudstack by apache.
the class CreateGlobalLoadBalancerRuleCmd method create.
@Override
public void create() {
try {
GlobalLoadBalancerRule gslbRule = _gslbService.createGlobalLoadBalancerRule(this);
this.setEntityId(gslbRule.getId());
this.setEntityUuid(gslbRule.getUuid());
CallContext.current().setEventDetails("Rule Id: " + getEntityId());
} catch (Exception ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage());
} finally {
}
}
Aggregations