Search in sources :

Example 6 with StickinessPolicy

use of com.cloud.network.rules.StickinessPolicy in project CloudStack-archive by CloudStack-extras.

the class CreateLBStickinessPolicyCmd method create.

@Override
public void create() {
    try {
        StickinessPolicy result = _lbService.createLBStickinessPolicy(this);
        this.setEntityId(result.getId());
    } catch (NetworkRuleConflictException e) {
        s_logger.warn("Exception: ", e);
        throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) NetworkRuleConflictException(com.cloud.exception.NetworkRuleConflictException) StickinessPolicy(com.cloud.network.rules.StickinessPolicy)

Example 7 with StickinessPolicy

use of com.cloud.network.rules.StickinessPolicy in project cloudstack by apache.

the class CreateLBStickinessPolicyCmd method create.

@Override
public void create() {
    try {
        StickinessPolicy result = _lbService.createLBStickinessPolicy(this);
        this.setEntityId(result.getId());
        this.setEntityUuid(result.getUuid());
    } catch (NetworkRuleConflictException e) {
        s_logger.warn("Exception: ", e);
        throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) NetworkRuleConflictException(com.cloud.exception.NetworkRuleConflictException) StickinessPolicy(com.cloud.network.rules.StickinessPolicy)

Example 8 with StickinessPolicy

use of com.cloud.network.rules.StickinessPolicy in project cloudstack by apache.

the class DeleteLBStickinessPolicyCmd method getSyncObjId.

@Override
public Long getSyncObjId() {
    StickinessPolicy policy = _entityMgr.findById(StickinessPolicy.class, getId());
    if (policy == null) {
        throw new InvalidParameterValueException("Unable to find LB stickiness rule: " + id);
    }
    LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
    if (lb == null) {
        throw new InvalidParameterValueException("Unable to find load balancer rule for stickiness rule: " + id);
    }
    return lb.getNetworkId();
}
Also used : InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) LoadBalancer(com.cloud.network.rules.LoadBalancer) StickinessPolicy(com.cloud.network.rules.StickinessPolicy)

Aggregations

StickinessPolicy (com.cloud.network.rules.StickinessPolicy)8 LoadBalancer (com.cloud.network.rules.LoadBalancer)5 LBStickinessResponse (org.apache.cloudstack.api.response.LBStickinessResponse)3 ServerApiException (com.cloud.api.ServerApiException)2 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 LBStickinessResponse (com.cloud.api.response.LBStickinessResponse)1 Domain (com.cloud.domain.Domain)1 ProjectAccount (com.cloud.projects.ProjectAccount)1 Account (com.cloud.user.Account)1 UserAccount (com.cloud.user.UserAccount)1 ArrayList (java.util.ArrayList)1 LBStickinessPolicyResponse (org.apache.cloudstack.api.response.LBStickinessPolicyResponse)1