labpack/platforms/aws/ec2.py
def read_image(self, image_id):

        '''
            a method to retrieve the details of a single image on AWS EC2

        :param image_id: string with AWS id of image
        :return: dictionary of image attributes

        relevant fields:
        
        'image_id': '',
        'snapshot_id': '',
        'region': '',
        'state': '',
        'tags': []
        '''

        title = '%s.read_image' % self.__class__.__name__

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

    # report query
        self.iam.printer('Querying AWS region %s for properties of image %s.' % (self.iam.region_name, image_id))

    # check image state
        self.iam.printer_on = False
        self.check_image_state(image_id)
        self.iam.printer_on = True

    # discover tags and snapshot id associated with image id
        try:
            response = self.connection.describe_images(ImageIds=[ image_id ])
        except:
            raise AWSConnectionError(title)
        image_info = response['Images'][0]

    # construct image details from response
        image_details = {
            'image_id': '',
            'state': '',
            'name': '',
            'region': self.iam.region_name,
            'tags': []
        }
        image_details = self.iam.ingest(image_info, image_details)
        image_details['snapshot_id'] = image_details['block_device_mappings'][0]['ebs']['snapshot_id']
        
        return image_details

            a method to retrieve the details of a single image on AWS EC2

        :param image_id: string with AWS id of image
        :return: dictionary of image attributes

        relevant fields:
        
        'image_id': '',
        'snapshot_id': '',
        'region': '',
        'state': '',
        'tags': []
        
a method to retrieve the details of a single image on AWS EC2
a method to retrieve the details of a single image on AWS EC2
def read_image(self, image_id):
        title = '%s.read_image' % self.__class__.__name__
        input_fields = {
            'image_id': image_id
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
        self.iam.printer('Querying AWS region %s for properties of image %s.' % (self.iam.region_name, image_id))
        self.iam.printer_on = False
        self.check_image_state(image_id)
        self.iam.printer_on = True
        try:
            response = self.connection.describe_images(ImageIds=[ image_id ])
        except:
            raise AWSConnectionError(title)
        image_info = response['Images'][0]
        image_details = {
            'image_id': '',
            'state': '',
            'name': '',
            'region': self.iam.region_name,
            'tags': []
        }
        image_details = self.iam.ingest(image_info, image_details)
        image_details['snapshot_id'] = image_details['block_device_mappings'][0]['ebs']['snapshot_id']
        return image_details
def read_image ( self , image_id ) : title = '%s.read_image' % self . __class__ . __name__ input_fields = { 'image_id' : image_id } for key , value in input_fields . items ( ) : object_title = '%s(%s=%s)' % ( title , key , str ( value ) ) self . fields . validate ( value , '.%s' % key , object_title ) self . iam . printer ( 'Querying AWS region %s for properties of image %s.' % ( self . iam . region_name , image_id ) ) self . iam . printer_on = False self . check_image_state ( image_id ) self . iam . printer_on = True try : response = self . connection . describe_images ( ImageIds = [ image_id ] ) except : raise AWSConnectionError ( title ) image_info = response [ 'Images' ] [ 0 ] image_details = { 'image_id' : '' , 'state' : '' , 'name' : '' , 'region' : self . iam . region_name , 'tags' : [ ] } image_details = self . iam . ingest ( image_info , image_details ) image_details [ 'snapshot_id' ] = image_details [ 'block_device_mappings' ] [ 0 ] [ 'ebs' ] [ 'snapshot_id' ] return image_details
a method to retrieve the details of a single image on AWS EC2
a method to retrieve the details of a single image on AWS EC2
'''
            a method to retrieve the details of a single image on AWS EC2

        :param image_id: string with AWS id of image
        :return: dictionary of image attributes

        relevant fields:
        
        'image_id': '',
        'snapshot_id': '',
        'region': '',
        'state': '',
        'tags': []
        ''' # validate inputs # report query # check image state # discover tags and snapshot id associated with image id # construct image details from response
dictionary of image attributes
relevant fields.


dictionary of image attributes relevant fields .
self
image_id
string with AWS id of image
string with AWS id of image