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; }
private void throwInvalidIdException(String message, String uuid, String description) { InvalidParameterValueException ex = new InvalidParameterValueException(message); ex.addProxyObject(uuid, description); throw ex; }
@Override public String toString() { String str = super.toString(); return str + "Scope=" + scope + "; id=" + id; } }
@Override public void stop(final String vmUuid) throws ResourceUnavailableException { try { advanceStop(vmUuid, false); } catch (final OperationTimedoutException e) { throw new AgentUnavailableException("Unable to stop vm because the operation to stop timed out", e.getAgentId(), e); } catch (final ConcurrentOperationException e) { throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation", e); } }
private void denyApiAccess(final String commandName) throws PermissionDeniedException { throw new PermissionDeniedException("The API " + commandName + " is blacklisted for the account's role."); }
@Override public void run() { try { _userVmManager.destroyVm(vmId, false); } catch (ResourceUnavailableException e) { e.printStackTrace(); } catch (ConcurrentOperationException e) { e.printStackTrace(); } } }, destroyVmGracePeriod, TimeUnit.SECONDS);
public List<String> getAccountNames() { if (accountNames != null && projectIds != null) { throw new InvalidParameterValueException("Accounts and projectIds can't be specified together"); } return accountNames; }
@Override public void stopForced(String vmUuid) throws ResourceUnavailableException { try { advanceStop(vmUuid, true); } catch (final OperationTimedoutException e) { throw new AgentUnavailableException("Unable to stop vm because the operation to stop timed out", e.getAgentId(), e); } catch (final ConcurrentOperationException e) { throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation", e); } }
public boolean validateVolumeSizeRange(long size) { if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) { throw new InvalidParameterValueException("Please specify a size of at least 1 GB."); } else if (size > (_maxVolumeSizeInGb * 1024 * 1024 * 1024)) { throw new InvalidParameterValueException("Requested volume size is " + size + ", but the maximum size allowed is " + _maxVolumeSizeInGb + " GB."); } return true; }
public List<Long> getProjectIds() { if (accountNames != null && projectIds != null) { throw new InvalidParameterValueException("Accounts and projectIds can't be specified together"); } return projectIds; }
@Override 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; }
private void validateIops(Long minIops, Long maxIops) { if ((minIops == null && maxIops != null) || (minIops != null && maxIops == null)) { throw new InvalidParameterValueException("Either 'miniops' and 'maxiops' must both be provided or neither must be provided."); } if (minIops != null && maxIops != null) { if (minIops > maxIops) { throw new InvalidParameterValueException("The 'miniops' parameter must be less than or equal to the 'maxiops' parameter."); } } }
/** * Validates the network ACL rule action given as a {@link String}. * If the parameter is null, we do not perform any validations. Otherwise, we check if the parameter is equal to 'Allow' or 'Deny' (ignoring the case). * If the parameter is an invalid action, we throw an {@link InvalidParameterValueException}. */ protected void validateNetworkAclRuleAction(String action) { if (action != null) { if (!("Allow".equalsIgnoreCase(action) || "Deny".equalsIgnoreCase(action))) { throw new InvalidParameterValueException(String.format("Invalid action [%s]. Permitted actions are Allow and Deny", action)); } } }
@Override public EngineHostVO loadHost(String uuid) { EngineHostVO host = _hostDao.findByUuid(uuid); if (host == null) { throw new InvalidParameterValueException("Host does not exist"); } return host; }
private IpAddress getIp() { IpAddress ip = _networkService.getIp(ipAddressId); if (ip == null) { throw new InvalidParameterValueException("Unable to find ip address by id " + ipAddressId); } return ip; }
private DomainVO getDomain(Long domainId) { DomainVO domain = _domainDao.findById(domainId); if (domain == null) { throw new InvalidParameterValueException("Unable to find domain by specified id"); } return domain; }
private void checkIfNotMovingAcrossDomains(long domainId, Account newAccount) { if (newAccount.getDomainId() != domainId) { // not in scope throw new InvalidParameterValueException("moving a user from an account in one domain to an account in annother domain is not supported!"); } }
private IpAddress getIp() { IpAddress ip = _networkService.getIp(ipAddressId); if (ip == null) { throw new InvalidParameterValueException("Unable to find IP address by ID " + ipAddressId); } return ip; } }
public void checkNameForRFCCompliance(String name) { if (!NetUtils.verifyDomainNameLabel(name, true)) { throw new InvalidParameterValueException("Invalid name. Vm name can contain ASCII letters 'a' through 'z', the digits '0' through '9', " + "and the hyphen ('-'), must be between 1 and 63 characters long, and can't start or end with \"-\" and can't start with digit"); } }
private IpAddress getIp() { IpAddress ip = _networkService.getIp(ipAddressId); if (ip == null) { throw new InvalidParameterValueException("Unable to find IP address by ID " + ipAddressId); } return ip; }