labpack/platforms/aws/ec2.py
def list_addresses(self, tag_values=None):
        
        '''
            a method to list elastic ip addresses associated with account on AWS
            
        :param tag_values: [optional] dictionary of tag key values
        :return: list of strings with ip addresses
        '''
        
        title = '%s.list_addresses' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'tag_values': tag_values
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
        self._validate_tags(tag_values, title)

    # add tags to method arguments
        kw_args = {}
        tag_text = ''
        if tag_values:
            kw_args = {
                'Filters': []
            }
            tag_words = []
            for key, value in tag_values.items():
                kw_args['Filters'].append({ 'Name': 'tag:%s' % key, 'Values': [value] })
            from labpack.parsing.grammar import join_words
            plural_value = ''
            if len(tag_values) > 1:
                plural_value = 's'
            tag_text = ' with tag value%s %s' % (plural_value, join_words(tag_words))

    # report query
        self.iam.printer('Querying AWS region %s for elastic ip addresses%s.' % (self.iam.region_name, tag_text))
        address_list = []
        
    # discover details associated with instance id
        try:
            response = self.connection.describe_addresses(**kw_args)
        except:
            raise AWSConnectionError(title)

    # populate address list with response
        response_list = response['Addresses']
        for address in response_list:
            address_list.append(address['PublicIp'])

        return address_list

            a method to list elastic ip addresses associated with account on AWS
            
        :param tag_values: [optional] dictionary of tag key values
        :return: list of strings with ip addresses
        
a method to list elastic ip addresses associated with account on AWS
a method to list elastic ip addresses associated with account on AWS
def list_addresses(self, tag_values=None):
        title = '%s.list_addresses' % self.__class__.__name__
        input_fields = {
            'tag_values': tag_values
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
        self._validate_tags(tag_values, title)
        kw_args = {}
        tag_text = ''
        if tag_values:
            kw_args = {
                'Filters': []
            }
            tag_words = []
            for key, value in tag_values.items():
                kw_args['Filters'].append({ 'Name': 'tag:%s' % key, 'Values': [value] })
            from labpack.parsing.grammar import join_words
            plural_value = ''
            if len(tag_values) > 1:
                plural_value = 's'
            tag_text = ' with tag value%s %s' % (plural_value, join_words(tag_words))
        self.iam.printer('Querying AWS region %s for elastic ip addresses%s.' % (self.iam.region_name, tag_text))
        address_list = []
        try:
            response = self.connection.describe_addresses(**kw_args)
        except:
            raise AWSConnectionError(title)
        response_list = response['Addresses']
        for address in response_list:
            address_list.append(address['PublicIp'])
        return address_list
def list_addresses ( self , tag_values = None ) : title = '%s.list_addresses' % self . __class__ . __name__ input_fields = { 'tag_values' : tag_values } for key , value in input_fields . items ( ) : if value : object_title = '%s(%s=%s)' % ( title , key , str ( value ) ) self . fields . validate ( value , '.%s' % key , object_title ) self . _validate_tags ( tag_values , title ) kw_args = { } tag_text = '' if tag_values : kw_args = { 'Filters' : [ ] } tag_words = [ ] for key , value in tag_values . items ( ) : kw_args [ 'Filters' ] . append ( { 'Name' : 'tag:%s' % key , 'Values' : [ value ] } ) from labpack . parsing . grammar import join_words plural_value = '' if len ( tag_values ) > 1 : plural_value = 's' tag_text = ' with tag value%s %s' % ( plural_value , join_words ( tag_words ) ) self . iam . printer ( 'Querying AWS region %s for elastic ip addresses%s.' % ( self . iam . region_name , tag_text ) ) address_list = [ ] try : response = self . connection . describe_addresses ( ** kw_args ) except : raise AWSConnectionError ( title ) response_list = response [ 'Addresses' ] for address in response_list : address_list . append ( address [ 'PublicIp' ] ) return address_list
a method to list elastic ip addresses associated with account on AWS
a method to list elastic ip addresses associated with account on AWS
'''
            a method to list elastic ip addresses associated with account on AWS
            
        :param tag_values: [optional] dictionary of tag key values
        :return: list of strings with ip addresses
        ''' # validate inputs # add tags to method arguments # report query # discover details associated with instance id # populate address list with response
list of strings with ip addresses
list of strings with ip addresses
self
tag_values
[optional] dictionary of tag key values
[ optional ] dictionary of tag key values