labpack/platforms/aws/ec2.py
def read_subnet(self, subnet_id):

        '''
            a method to retrieve the details about a subnet

        :param subnet_id: string with AWS id of subnet
        :return: dictionary with subnet details

        relevant fields:
        
        'subnet_id': '',
        'vpc_id': '',
        'availability_zone': '',
        'state': '',
        'tags': [{'key': '', 'value': ''}]
        '''

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

    # validate inputs
        input_fields = {
            'subnet_id': subnet_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 subnet %s.' % (self.iam.region_name, subnet_id))
        
    # construct keyword definitions
        kw_args = { 'SubnetIds': [ subnet_id ] }

    # send request for details about subnet
        try:
            response = self.connection.describe_subnets(**kw_args)
        except:
            raise AWSConnectionError(title)

    # construct subnet details from response
        subnet_dict = response['Subnets'][0]
        subnet_details = {
            'subnet_id': '',
            'vpc_id': '',
            'availability_zone': '',
            'state': '',
            'tags': []
        }
        subnet_details = self.iam.ingest(subnet_dict, subnet_details)

        return subnet_details

            a method to retrieve the details about a subnet

        :param subnet_id: string with AWS id of subnet
        :return: dictionary with subnet details

        relevant fields:
        
        'subnet_id': '',
        'vpc_id': '',
        'availability_zone': '',
        'state': '',
        'tags': [{'key': '', 'value': ''}]
        
a method to retrieve the details about a subnet
a method to retrieve the details about a subnet
def read_subnet(self, subnet_id):
        title = '%s.read_subnet' % self.__class__.__name__
        input_fields = {
            'subnet_id': subnet_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 subnet %s.' % (self.iam.region_name, subnet_id))
        kw_args = { 'SubnetIds': [ subnet_id ] }
        try:
            response = self.connection.describe_subnets(**kw_args)
        except:
            raise AWSConnectionError(title)
        subnet_dict = response['Subnets'][0]
        subnet_details = {
            'subnet_id': '',
            'vpc_id': '',
            'availability_zone': '',
            'state': '',
            'tags': []
        }
        subnet_details = self.iam.ingest(subnet_dict, subnet_details)
        return subnet_details
def read_subnet ( self , subnet_id ) : title = '%s.read_subnet' % self . __class__ . __name__ input_fields = { 'subnet_id' : subnet_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 subnet %s.' % ( self . iam . region_name , subnet_id ) ) kw_args = { 'SubnetIds' : [ subnet_id ] } try : response = self . connection . describe_subnets ( ** kw_args ) except : raise AWSConnectionError ( title ) subnet_dict = response [ 'Subnets' ] [ 0 ] subnet_details = { 'subnet_id' : '' , 'vpc_id' : '' , 'availability_zone' : '' , 'state' : '' , 'tags' : [ ] } subnet_details = self . iam . ingest ( subnet_dict , subnet_details ) return subnet_details
a method to retrieve the details about a subnet
a method to retrieve the details about a subnet
'''
            a method to retrieve the details about a subnet

        :param subnet_id: string with AWS id of subnet
        :return: dictionary with subnet details

        relevant fields:
        
        'subnet_id': '',
        'vpc_id': '',
        'availability_zone': '',
        'state': '',
        'tags': [{'key': '', 'value': ''}]
        ''' # validate inputs # report query # construct keyword definitions # send request for details about subnet # construct subnet details from response
dictionary with subnet details
relevant fields.


dictionary with subnet details relevant fields .
self
subnet_id
string with AWS id of subnet
string with AWS id of subnet