Exemple #1
0
 def get_vpc_by_name_tag(self, vpc_name):
     """lookup vpc by vpc_name tag. Raises exceptions on insanity."""
     vpcs = self._get_vpcs_by_filter(tag_filter('Name', vpc_name))
     if len(vpcs) > 1:
         raise Exception('Multiple VPCs match tag Name:{}'.format(vpc_name))
     if len(vpcs) == 0:
         raise Exception('VPC not found with tag Name:{}'.format(vpc_name))
     return vpcs[0]
Exemple #2
0
 def get_vpc_by_name_tag(self, vpc_name):
     """lookup vpc by vpc_name tag. Raises exceptions on insanity."""
     vpcs = self._get_vpcs_by_filter(tag_filter('Name', vpc_name))
     if len(vpcs) > 1:
         raise Exception('Multiple VPCs match tag Name:{}'.format(vpc_name))
     if len(vpcs) == 0:
         raise Exception('VPC not found with tag Name:{}'.format(vpc_name))
     return vpcs[0]
Exemple #3
0
 def _filter_collection_by_name(self, name, collection):
     names = [name, '{}-{}'.format(self.name, name)]
     objs = list(collection.filter(Filters=tag_filter('Name', names)))
     return objs[0] if len(objs) == 1 else None
Exemple #4
0
 def _filter_collection_by_name(self, name, collection):
     names = [name, '{}-{}'.format(self.name, name)]
     objs = list(collection.filter(Filters=tag_filter('Name', names)))
     return objs[0] if len(objs) == 1 else None