use of com.cloud.network.LBHealthCheckPolicyVO in project cloudstack by apache.
the class LoadBalancingRulesManagerImpl method updateLBHealthCheckPolicy.
@Override
@ActionEvent(eventType = EventTypes.EVENT_LB_HEALTHCHECKPOLICY_UPDATE, eventDescription = "updating lb healthcheck policy", async = true)
public HealthCheckPolicy updateLBHealthCheckPolicy(long id, String customId, Boolean forDisplay) {
LBHealthCheckPolicyVO policy = _lb2healthcheckDao.findById(id);
if (policy == null) {
throw new InvalidParameterValueException("Fail to find stickiness policy with " + id);
}
LoadBalancerVO loadBalancer = _lbDao.findById(Long.valueOf(policy.getLoadBalancerId()));
if (loadBalancer == null) {
throw new InvalidParameterException("Invalid Load balancer : " + policy.getLoadBalancerId() + " for Stickiness policy id: " + id);
}
_accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, loadBalancer);
if (customId != null) {
policy.setUuid(customId);
}
if (forDisplay != null) {
policy.setDisplay(forDisplay);
}
_lb2healthcheckDao.update(id, policy);
return _lb2healthcheckDao.findById(id);
}
use of com.cloud.network.LBHealthCheckPolicyVO in project cloudstack by apache.
the class LoadBalancingRulesManagerImpl method getHealthCheckPolicies.
@Override
public List<LbHealthCheckPolicy> getHealthCheckPolicies(long lbId) {
List<LbHealthCheckPolicy> healthCheckPolicies = new ArrayList<LbHealthCheckPolicy>();
List<LBHealthCheckPolicyVO> hcDbpolicies = _lb2healthcheckDao.listByLoadBalancerIdAndDisplayFlag(lbId, null);
for (LBHealthCheckPolicyVO policy : hcDbpolicies) {
String pingpath = policy.getpingpath();
LbHealthCheckPolicy hDbPolicy = new LbHealthCheckPolicy(pingpath, policy.getDescription(), policy.getResponseTime(), policy.getHealthcheckInterval(), policy.getHealthcheckThresshold(), policy.getUnhealthThresshold(), policy.isRevoke());
healthCheckPolicies.add(hDbPolicy);
}
return healthCheckPolicies;
}
use of com.cloud.network.LBHealthCheckPolicyVO in project cloudstack by apache.
the class LoadBalancingRulesManagerImpl method searchForLBHealthCheckPolicies.
@Override
public List<LBHealthCheckPolicyVO> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd) throws PermissionDeniedException {
Account caller = CallContext.current().getCallingAccount();
Long loadBalancerId = cmd.getLbRuleId();
Long policyId = cmd.getId();
boolean forDisplay = cmd.getDisplay();
if (loadBalancerId == null) {
loadBalancerId = findLBIdByHealtCheckPolicyId(policyId);
}
LoadBalancerVO loadBalancer = _lbDao.findById(loadBalancerId);
if (loadBalancer == null) {
return null;
}
_accountMgr.checkAccess(caller, null, true, loadBalancer);
List<LBHealthCheckPolicyVO> hcDbpolicies = _lb2healthcheckDao.listByLoadBalancerIdAndDisplayFlag(loadBalancerId, forDisplay);
return hcDbpolicies;
}
use of com.cloud.network.LBHealthCheckPolicyVO in project cosmic by MissionCriticalCloud.
the class LoadBalancingRulesManagerImpl method updateLBHealthCheckPolicy.
@Override
@ActionEvent(eventType = EventTypes.EVENT_LB_HEALTHCHECKPOLICY_UPDATE, eventDescription = "updating lb healthcheck policy", async = true)
public HealthCheckPolicy updateLBHealthCheckPolicy(final long id, final String customId, final Boolean forDisplay) {
final LBHealthCheckPolicyVO policy = _lb2healthcheckDao.findById(id);
if (policy == null) {
throw new InvalidParameterValueException("Fail to find stickiness policy with " + id);
}
final LoadBalancerVO loadBalancer = _lbDao.findById(Long.valueOf(policy.getLoadBalancerId()));
if (loadBalancer == null) {
throw new InvalidParameterException("Invalid Load balancer : " + policy.getLoadBalancerId() + " for Stickiness policy id: " + id);
}
_accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, loadBalancer);
if (customId != null) {
policy.setUuid(customId);
}
if (forDisplay != null) {
policy.setDisplay(forDisplay);
}
_lb2healthcheckDao.update(id, policy);
return _lb2healthcheckDao.findById(id);
}
use of com.cloud.network.LBHealthCheckPolicyVO in project cosmic by MissionCriticalCloud.
the class LoadBalancingRulesManagerImpl method searchForLBHealthCheckPolicies.
@Override
public List<LBHealthCheckPolicyVO> searchForLBHealthCheckPolicies(final ListLBHealthCheckPoliciesCmd cmd) throws PermissionDeniedException {
final Account caller = CallContext.current().getCallingAccount();
Long loadBalancerId = cmd.getLbRuleId();
final Long policyId = cmd.getId();
final boolean forDisplay = cmd.getDisplay();
if (loadBalancerId == null) {
loadBalancerId = findLBIdByHealtCheckPolicyId(policyId);
}
final LoadBalancerVO loadBalancer = _lbDao.findById(loadBalancerId);
if (loadBalancer == null) {
return null;
}
_accountMgr.checkAccess(caller, null, true, loadBalancer);
final List<LBHealthCheckPolicyVO> hcDbpolicies = _lb2healthcheckDao.listByLoadBalancerIdAndDisplayFlag(loadBalancerId, forDisplay);
return hcDbpolicies;
}
Aggregations