def _find_vpcs(vpc_id=None, vpc_name=None, cidr=None, tags=None, region=None, key=None, keyid=None, profile=None):
 if all((vpc_id, vpc_name)):
  raise SaltInvocationError('Only one of vpc_name or vpc_id may be provided.')
 if (not any((vpc_id, vpc_name, tags, cidr))):
  raise SaltInvocationError('At least one of the following must be provided: vpc_id, vpc_name, cidr or tags.')
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 filter_parameters = {'filters': {}}
 if vpc_id:
  filter_parameters['vpc_ids'] = [vpc_id]
 if cidr:
  filter_parameters['filters']['cidr'] = cidr
 if vpc_name:
  filter_parameters['filters']['tag:Name'] = vpc_name
 if tags:
  for (tag_name, tag_value) in six.iteritems(tags):
   filter_parameters['filters']['tag:{0}'.format(tag_name)] = tag_value
 vpcs = conn.get_all_vpcs(**filter_parameters)
 log.debug('The filters criteria {0} matched the following VPCs:{1}'.format(filter_parameters, vpcs))
 if vpcs:
  return [vpc.id for vpc in vpcs]
 else:
  return []

def _find_vpcs ( vpc_id = None , vpc_name = None , cidr = None , tags = None , region = None , key = None , keyid = None , profile = None ) : if all ( ( vpc_id , vpc_name ) ) : raise SaltInvocationError ( 'Only one of vpc_name or vpc_id may be provided.' ) if ( not any ( ( vpc_id , vpc_name , tags , cidr ) ) ) : raise SaltInvocationError ( 'At least one of the following must be provided: vpc_id, vpc_name, cidr or tags.' ) conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) filter_parameters = { 'filters' : { } } if vpc_id : filter_parameters [ 'vpc_ids' ] = [ vpc_id ] if cidr : filter_parameters [ 'filters' ] [ 'cidr' ] = cidr if vpc_name : filter_parameters [ 'filters' ] [ 'tag:Name' ] = vpc_name if tags : for ( tag_name , tag_value ) in six . iteritems ( tags ) : filter_parameters [ 'filters' ] [ 'tag:{0}' . format ( tag_name ) ] = tag_value vpcs = conn . get_all_vpcs ( ** filter_parameters ) log . debug ( 'The filters criteria {0} matched the following VPCs:{1}' . format ( filter_parameters , vpcs ) ) if vpcs : return [ vpc . id for vpc in vpcs ] else : return [ ]
given vpc properties .