コード例 #1
0
 @Override
 public void create() {
   // cidr list parameter is deprecated
   if (cidrlist != null) {
     throw new InvalidParameterValueException(
         "Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
   }
   try {
     LoadBalancer result =
         _lbService.createPublicLoadBalancerRule(
             getXid(),
             getName(),
             getDescription(),
             getSourcePortStart(),
             getSourcePortEnd(),
             getDefaultPortStart(),
             getDefaultPortEnd(),
             getSourceIpAddressId(),
             getProtocol(),
             getAlgorithm(),
             getNetworkId(),
             getEntityOwnerId(),
             getOpenFirewall());
     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());
   } catch (InsufficientAddressCapacityException e) {
     s_logger.warn("Exception: ", e);
     throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
   }
 }
コード例 #2
0
 @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());
   }
 }
コード例 #3
0
  @Override
  public void create() {

    // cidr list parameter is deprecated
    if (cidrlist != null) {
      throw new InvalidParameterValueException(
          "Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
    }

    try {
      StaticNatRule rule = _rulesService.createStaticNatRule(this, getOpenFirewall());
      this.setEntityId(rule.getId());
      this.setEntityUuid(rule.getUuid());
    } catch (NetworkRuleConflictException e) {
      s_logger.info("Unable to create Static Nat Rule due to ", e);
      throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
    }
  }