private void checkSubnetExists(ServiceConfiguration configuration) throws Exception { DescribeSubnetsType describeSubnetsType = MessageHelper.createMessage(DescribeSubnetsType.class, info.getEffectiveUserId()); describeSubnetsType.getFilterSet().add(Filter.filter("subnet-id", properties.getSubnetId())); DescribeSubnetsResponseType describeSubnetsResponseType = AsyncRequests.sendSync(configuration, describeSubnetsType); if (describeSubnetsResponseType.getSubnetSet() == null || describeSubnetsResponseType.getSubnetSet().getItem() == null || describeSubnetsResponseType.getSubnetSet().getItem().isEmpty()) { throw new ValidationErrorException("No such subnet with id '" + properties.getSubnetId()); } }
private boolean subnetExistsForDelete(ServiceConfiguration configuration) throws Exception { DescribeSubnetsType describeSubnetsType = MessageHelper.createMessage(DescribeSubnetsType.class, info.getEffectiveUserId()); describeSubnetsType.getFilterSet().add(Filter.filter("subnet-id", properties.getSubnetId())); DescribeSubnetsResponseType describeSubnetsResponseType = AsyncRequests.sendSync(configuration, describeSubnetsType); if (describeSubnetsResponseType.getSubnetSet() == null || describeSubnetsResponseType.getSubnetSet().getItem() == null || describeSubnetsResponseType.getSubnetSet().getItem().isEmpty()) { return false; } return true; }