in aliyun/log/logclient_core.py [0:0]
def list_entity(entity_name, logstore_level=None, root_resource=None, max_batch_size=DEFAULT_MAX_LIST_PAGING_SIZE, entities_key=None, raw_resource_name=None, job_type=None):
def do_list(self, project, resource_path, offset=0, size=100):
headers = {}
params = {}
resource_name = raw_resource_name if raw_resource_name else pluralize(entity_name)
params['offset'] = str(offset)
params['size'] = str(size)
if root_resource == '/jobs' and job_type:
params['jobType'] = str(job_type)
(resp, header) = self._send("GET", project, None, resource_path, params, headers)
return ListEntityResponse(header, resp, resource_name=resource_name, entities_key=entities_key)
if not logstore_level:
def fn(self, project, offset=0, size=100):
""" list the {entity_title}, get first 100 items by default
Unsuccessful opertaion will cause an LogException.
:type project: string
:param project: the Project name
:type offset: int
:param offset: the offset of all the matched names
:type size: int
:param size: the max return names count, -1 means all
:return: ListLogStoreResponse
:raise: LogException
"""
# need to use extended method to get more
if int(size) == -1 or int(size) > max_batch_size:
return list_more(fn, int(offset), int(size), max_batch_size, self, project)
resource_path = (root_resource and root_resource.rstrip('/')) or "/" + pluralize(entity_name)
return do_list(self, project, resource_path, offset=offset, size=size)
else:
def fn(self, project, logstore, offset=0, size=100):
""" list the {entity_title}, get first 100 items by default
Unsuccessful opertaion will cause an LogException.
:type project: string
:param project: the Project name
:type logstore: string
:param logstore: the logstore name
:type offset: int
:param offset: the offset of all the matched names
:type size: int
:param size: the max return names count, -1 means all
:return: ListLogStoreResponse
:raise: LogException
"""
# need to use extended method to get more
if int(size) == -1 or int(size) > max_batch_size:
return list_more(fn, int(offset), int(size), max_batch_size, self, project, logstore)
resource_path = (root_resource and root_resource.rstrip('/')) or "/" + pluralize(entity_name)
resource_path = "/logstores/" + logstore + resource_path
return do_list(self, project, resource_path, offset=offset, size=size)
fn.__name__ = 'list_' + entity_name
fn.__doc__ = fn.__doc__.format(entity_title=entity_name.title())
return fn