labpack/platforms/aws/ec2.py
def read_security_group(self, group_id):

        '''
            a method to retrieve the details about a security group

        :param group_id: string with AWS id of security group
        :return: dictionary with security group details

        relevant fields:
        
        'group_id: '',
        'vpc_id': '',
        'group_name': '',
        'tags': [{'key': '', 'value': ''}]
        'ip_permissions': [{
            'from_port': 0, 
            'ip_ranges':[{'cidr_ip':'0.0.0.0/0'}]
        }]
        '''

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

    # validate inputs
        input_fields = {
            'group_id': group_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 security group %s.' % (self.iam.region_name, group_id))

    # construct keyword definitions
        kw_args = { 'GroupIds': [ group_id ] }

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

    # construct security group details from response
        group_info = response['SecurityGroups'][0]
        group_details = {
            'group_id': '',
            'vpc_id': '',
            'group_name': '',
            'tags': [],
            'ip_permissions': []
        }
        group_details = self.iam.ingest(group_info, group_details)
        
        return group_details

            a method to retrieve the details about a security group

        :param group_id: string with AWS id of security group
        :return: dictionary with security group details

        relevant fields:
        
        'group_id: '',
        'vpc_id': '',
        'group_name': '',
        'tags': [{'key': '', 'value': ''}]
        'ip_permissions': [{
            'from_port': 0, 
            'ip_ranges':[{'cidr_ip':'0.0.0.0/0'}]
        }]
        
a method to retrieve the details about a security group
a method to retrieve the details about a security group
def read_security_group(self, group_id):
        title = '%s.read_security_group' % self.__class__.__name__
        input_fields = {
            'group_id': group_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 security group %s.' % (self.iam.region_name, group_id))
        kw_args = { 'GroupIds': [ group_id ] }
        try:
            response = self.connection.describe_security_groups(**kw_args)
        except:
            raise AWSConnectionError(title)
        group_info = response['SecurityGroups'][0]
        group_details = {
            'group_id': '',
            'vpc_id': '',
            'group_name': '',
            'tags': [],
            'ip_permissions': []
        }
        group_details = self.iam.ingest(group_info, group_details)
        return group_details
def read_security_group ( self , group_id ) : title = '%s.read_security_group' % self . __class__ . __name__ input_fields = { 'group_id' : group_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 security group %s.' % ( self . iam . region_name , group_id ) ) kw_args = { 'GroupIds' : [ group_id ] } try : response = self . connection . describe_security_groups ( ** kw_args ) except : raise AWSConnectionError ( title ) group_info = response [ 'SecurityGroups' ] [ 0 ] group_details = { 'group_id' : '' , 'vpc_id' : '' , 'group_name' : '' , 'tags' : [ ] , 'ip_permissions' : [ ] } group_details = self . iam . ingest ( group_info , group_details ) return group_details
a method to retrieve the details about a security group
a method to retrieve the details about a security group
'''
            a method to retrieve the details about a security group

        :param group_id: string with AWS id of security group
        :return: dictionary with security group details

        relevant fields:
        
        'group_id: '',
        'vpc_id': '',
        'group_name': '',
        'tags': [{'key': '', 'value': ''}]
        'ip_permissions': [{
            'from_port': 0, 
            'ip_ranges':[{'cidr_ip':'0.0.0.0/0'}]
        }]
        ''' # validate inputs # report query # construct keyword definitions # send request for details about security group # construct security group details from response
dictionary with security group details
relevant fields.


dictionary with security group details relevant fields .
self
group_id
string with AWS id of security group
string with AWS id of security group