def applicability( pulp, data, path='/actions/content/regenerate_applicability/' ): path = path_join(RepoAppl.path, path) return pulp.send(Request('POST', path=path, data=data))
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)))
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)))
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)
def create(cls, pulp, data): return pulp.send(Request('POST', path=cls.path, data=data))
def create(self, pulp): '''create self in pulp''' return pulp.send(Request('POST', path=self.path, data=self.data))
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())
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)
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)