def get_all(self): LOG.info("Get all %ss.", self.type) executions = [resources.Execution.from_dict(db_model.to_dict()) for db_model in db_api.get_executions()] return resources.Executions(executions=executions)
def get_all(self, function_id=None, all_projects=False, project_id=None, status=None, description=None): """Return a list of executions. :param function_id: Optional. Filtering executions by function_id. :param project_id: Optional. Admin user can query other projects resources, the param is ignored for normal user. :param all_projects: Optional. Get resources of all projects. :param status: Optional. Filter by execution status. :param description: Optional. Filter by description. """ ctx = context.get_ctx() if project_id and not ctx.is_admin: project_id = context.ctx().projectid if project_id and ctx.is_admin: all_projects = True if all_projects: acl.enforce('execution:get_all:all_projects', ctx) filters = rest_utils.get_filters( function_id=function_id, project_id=project_id, status=status, description=description ) LOG.info("Get all %ss. filters=%s", self.type, filters) db_execs = db_api.get_executions(insecure=all_projects, **filters) executions = [resources.Execution.from_dict(db_model.to_dict()) for db_model in db_execs] return resources.Executions(executions=executions)