private void checkDeprecatedParameters() throws InvalidParameterValueException { if (gatewayId != null) { throw new InvalidParameterValueException("Parameter gatewayId is DEPRECATED, use vpcId and nextHop instead."); } }
public List<String> getSourceCidrList() { 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"); } return null; }
public List<String> getAccountNames() { if (accountNames != null && projectIds != null) { throw new InvalidParameterValueException("Accounts and projectIds can't be specified together"); } return accountNames; }
public List<Long> getProjectIds() { if (accountNames != null && projectIds != null) { throw new InvalidParameterValueException("Accounts and projectIds can't be specified together"); } return projectIds; }
@Override public Integer getPageSize() { if (pageSize != null && s_maxPageSize.longValue() != s_pageSizeUnlimited && pageSize.longValue() > s_maxPageSize.longValue()) { throw new InvalidParameterValueException("Page size can't exceed max allowed page size value: " + s_maxPageSize.longValue()); } if (pageSize != null && pageSize.longValue() == s_pageSizeUnlimited && page != null) { throw new InvalidParameterValueException("Can't specify page parameter when pagesize is -1 (Unlimited)"); } return pageSize; }
private IpAddress getIp() { final IpAddress ip = _networkService.getIp(ipAddressId); if (ip == null) { throw new InvalidParameterValueException("Unable to find IP address by ID " + ipAddressId); } return ip; }
private IpAddress getIp() { final IpAddress ip = _networkService.getIp(ipAddressId); if (ip == null) { throw new InvalidParameterValueException("Unable to find IP address by ID " + ipAddressId); } return ip; }
public Long getZoneId() { final Long physicalNetworkId = getPhysicalNetworkId(); if (physicalNetworkId == null && zoneId == null) { throw new InvalidParameterValueException("Zone ID is required"); } return zoneId; }
private IpAddress getIpAddress(final long id) { final IpAddress ip = _entityMgr.findById(IpAddress.class, id); if (ip == null) { throw new InvalidParameterValueException("Unable to find IP address by ID=" + id); } else { return ip; } }
public String getMacAddress() { if (macAddress == null) { return null; } if (!NetUtils.isValidMac(macAddress)) { throw new InvalidParameterValueException("MAC-Address is not valid: " + macAddress); } else if (!NetUtils.isUnicastMac(macAddress)) { throw new InvalidParameterValueException("MAC-Address is not unicast: " + macAddress); } return NetUtils.standardizeMacAddress(macAddress); }
public NetworkACLItem.TrafficType getTrafficType() { if (trafficType == null) { return NetworkACLItem.TrafficType.Ingress; } for (final NetworkACLItem.TrafficType type : NetworkACLItem.TrafficType.values()) { if (type.toString().equalsIgnoreCase(trafficType)) { return type; } } throw new InvalidParameterValueException("Invalid traffic type " + trafficType); }
@Override public Long getSyncObjId() { final LoadBalancer lb = _lbService.findById(id); if (lb == null) { throw new InvalidParameterValueException("Unable to find load balancer rule: " + id); } return lb.getNetworkId(); }
@Override public Long getSyncObjId() { final Vpc vpc = _entityMgr.findById(Vpc.class, vpcId); if (vpc == null) { throw new InvalidParameterValueException("Invalid id is specified for the vpc"); } return vpc.getId(); } }
@Override public Long getSyncObjId() { final StickinessPolicy policy = _entityMgr.findById(StickinessPolicy.class, getId()); if (policy == null) { throw new InvalidParameterValueException("Unable to find LB stickiness rule: " + id); } final 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(); }
private Long getVpcId() { if (publicIpId != null) { final IpAddress ipAddr = _networkService.getIp(publicIpId); if (ipAddr == null || !ipAddr.readyToUse()) { throw new InvalidParameterValueException("Unable to create load balancer rule, invalid IP address ID " + publicIpId); } else { return ipAddr.getVpcId(); } } return null; }
@Override public long getEntityOwnerId() { final Project project = _projectService.getProject(id); //verify input parameters if (project == null) { throw new InvalidParameterValueException("Unable to find project by id " + id); } return _projectService.getProjectOwner(id).getId(); }
@Override public long getEntityOwnerId() { final Nic nic = _entityMgr.findById(Nic.class, nicId); if (nic == null) { throw new InvalidParameterValueException("Can't find nic for id specified"); } final long vmId = nic.getInstanceId(); final VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, vmId); return vm.getAccountId(); }
@Override public long getEntityOwnerId() { if (ownerId == null) { final FirewallRule rule = _entityMgr.findById(FirewallRule.class, id); if (rule == null || rule.getTrafficType() != TrafficType.Egress) { throw new InvalidParameterValueException("Unable to find egress firewall rule by ID"); } else { ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId(); } } return ownerId; }
@Override public Long getSyncObjId() { final LoadBalancer lb = _lbService.findById(getId()); if (lb == null) { throw new InvalidParameterValueException("Unable to find load balancer rule by ID " + getId()); } return lb.getNetworkId(); }
public Long getSourceIpAddressId() { if (publicIpId != null) { final IpAddress ipAddr = _networkService.getIp(publicIpId); if (ipAddr == null || !ipAddr.readyToUse()) { throw new InvalidParameterValueException("Unable to create load balancer rule, invalid IP address ID " + publicIpId); } } else if (getEntityId() != null) { final LoadBalancer rule = _entityMgr.findById(LoadBalancer.class, getEntityId()); return rule.getSourceIpAddressId(); } return publicIpId; }