Example #1
0
    def list_instance_profiles(self,
                               max_items=None,
                               path_prefix=None,
                               marker=None):
        request = Request()
        request.set_action(u'ListInstanceProfiles')
        if max_items is not None:
            request.set_max_items(max_items)
        if path_prefix is not None:
            request.set_path_prefix(path_prefix)
        if marker is not None:
            request.set_marker(marker)

        try:
            response = self.call(request)
        except AwsServiceException:
            raise

        results = response[u'ListInstanceProfilesResponse']\
            [u'ListInstanceProfilesResult'][u'InstanceProfiles']
        request_id = response[u'ListInstanceProfilesResponse']\
            [u'ResponseMetadata'][u'RequestId']

        profiles = []
        for result in results:
            profiles.append(InstanceProfile.from_json(result))
        return Response(request_id, profiles)
Example #2
0
 def put_role_policy(self, role_name, policy_name, policy_document):
     request = Request()
     request.set_action(u'PutRolePolicy')
     request.set_role_name(role_name)
     request.set_policy_name(policy_name)
     request.set_policy_document(policy_document)
     
     try:    
         response = self.call(request)
     except AwsServiceException:
         raise 
     
     request_id = response[u'PutRolePolicyResponse']\
         [u'ResponseMetadata'][u'RequestId']
             
     return Response(request_id)
Example #3
0
 def create_role(self, role_name, assume_role_policy_document, path = None):
     request = Request()
     request.set_action(u'CreateRole')
     request.set_role_name(role_name)
     request.set_assume_role_policy_document(assume_role_policy_document)
     if path is not None: 
         request.set_path(path)
     
     try:    
         response = self.call(request)
     except AwsServiceException:       
         raise 
     
     role = Role.from_json(response[u'CreateRoleResponse'][u'CreateRoleResult'][u'Role'])
     request_id = response[u'CreateRoleResponse'][u'ResponseMetadata'][u'RequestId']
             
     return Response(request_id, role)
Example #4
0
 def add_role_to_instance_profile(self, role_name, instance_profile_name):
     request = Request()
     request.set_action(u'AddRoleToInstanceProfile')
     request.set_role_name(role_name)
     request.set_instance_profile_name(instance_profile_name)
     
     try:    
         response = self.call(request)
     except AwsServiceException:
         raise 
     
     request_id = response[u'AddRoleToInstanceProfileResponse']\
         [u'ResponseMetadata'][u'RequestId']
             
     return Response(request_id)
Example #5
0
 def create_instance_profile(self, instance_profile_name, path = None):
     request = Request()
     request.set_action(u'CreateInstanceProfile')
     request.set_instance_profile_name(instance_profile_name)
     if path is not None: 
         request.set_path(path)
     
     try:    
         response = self.call(request)
     except AwsServiceException:
         raise 
     
     profile = InstanceProfile.from_json(response[u'CreateInstanceProfileResponse']\
                                         [u'CreateInstanceProfileResult'][u'InstanceProfile'])
     request_id = response[u'CreateInstanceProfileResponse']\
         [u'ResponseMetadata'][u'RequestId']
             
     return Response(request_id, profile)
    def list_instance_profiles(self, max_items = None, path_prefix = None,  marker = None):
        request = Request()
        request.set_action(u'ListInstanceProfiles')
        if max_items is not None: 
            request.set_max_items(max_items)
        if path_prefix is not None: 
            request.set_path_prefix(path_prefix)
        if marker is not None: 
            request.set_marker(marker)
        
        try:    
            response = self.call(request)
        except AwsServiceException:
            raise 
        
        results = response[u'ListInstanceProfilesResponse']\
            [u'ListInstanceProfilesResult'][u'InstanceProfiles']
        request_id = response[u'ListInstanceProfilesResponse']\
            [u'ResponseMetadata'][u'RequestId']

        profiles = []
        for result in results:
            profiles.append(InstanceProfile.from_json(result))                
        return Response(request_id, profiles)