예제 #1
0
 def applicability(
     pulp,
     data,
     path='/actions/content/regenerate_applicability/'
 ):
     path = path_join(RepoAppl.path, path)
     return pulp.send(Request('POST', path=path, data=data))
예제 #2
0
 def revoke_permission(self,
                       pulp,
                       login,
                       resource,
                       operations,
                       path='/actions/revoke_from_user/'):
     data = {"login": login, "resource": resource, "operations": operations}
     return pulp.send(
         Request('POST', data=data, path=path_join(Permission.path, path)))
예제 #3
0
 def revoke_permission(self,
                       pulp,
                       role_id,
                       resource,
                       operations,
                       path='/actions/revoke_from_role/'):
     data = {
         "role_id": role_id,
         "resource": resource,
         "operations": operations
     }
     return pulp.send(
         Request('POST', data=data, path=path_join(Permission.path, path)))
예제 #4
0
 def search(
     cls,
     pulp,
     data
 ):
     '''search API for various resource type as example users, repositories, consumers,etc'''
     path = '/search/'
     with pulp.asserting(True):
         '''in the data use criteria field to perform the search'''
         response = pulp.send(Request('POST', path_join(cls.path, path), data=data))
         # example of criteria search
         # {"criteria": {"sort": None, "fields": None, "limit": None, "filters": {"$and": [{"notes._repo-type": "puppet-repo"}, {"id": {"$regex": ".*repo.*"}}]}, "skip": None}}
         # {"criteria": {"sort": None, "fields": None, "limit": None, "filters": {"$and": [{"id": "m1"}, {"notes._repo-type": "puppet-repo"}]}, "skip": None}}
         # {"criteria": {"sort": None, "fields": None, "limit": None, "filters": {"$and": [{"notes._repo-type": "puppet-repo"}, {"id": {"$not": "m1"}}]}, "skip": None}}
     return cls.from_response(response)
예제 #5
0
 def create(cls, pulp, data):
     return pulp.send(Request('POST', path=cls.path, data=data))
예제 #6
0
 def create(self, pulp):
     '''create self in pulp'''
     return pulp.send(Request('POST', path=self.path, data=self.data))
예제 #7
0
 def list(cls, pulp, params={}):
     '''create a list of instances from pulp_auto '''
     with pulp.asserting(True):
         response = pulp.send(Request('GET', cls.path, params=params))
     return map(lambda x: cls(data=x), response.json())
예제 #8
0
 def get(cls, pulp, id, params={}):
     '''create an instance from pulp_auto id'''
     with pulp.asserting(True):
         response = pulp.send(Request('GET', path_join(cls.path, id), params=params))
     return cls.from_response(response)
예제 #9
0
 def request(self, method, path='', data={}, params={},
         headers=cidict({'content-type': 'application/json'})):
     return Request(method, data=data, path=path_join(self.path, self.id, path), params=params,
             headers=headers)