# Path: mistralclient/api/base.py
# class Resource(object):
# class ResourceManager(object):
# class APIException(Exception):
#     def __init__(self, manager, data):
#     def _set_defaults(self):
#     def _set_attributes(self):
#     def to_dict(self):
#     def __str__(self):
# def _check_items(obj, searches):
# def extract_json(response, response_key):
#     def __init__(self, http_client, enforce_raw_definitions=False):
#     def get_contents_if_file(self, contents_or_file_name):
#     def find(self, **kwargs):
#     def list(self):
#     def _build_query_params(marker=None, limit=None, sort_keys=None,
#                             sort_dirs=None, fields=None, filters=None,
#                             scope=None, namespace=None):
#     def _ensure_not_empty(self, **kwargs):
#     def _validate(self, url, data, response_key=None, dump_json=True,
#                   headers=None, is_iter_resp=False):
#     def _create(self, url, data, response_key=None, dump_json=True,
#                 headers=None, is_iter_resp=False, resp_status_ok=201,
#                 as_class=True):
#     def _update(self, url, data, response_key=None, dump_json=True,
#                 headers=None, is_iter_resp=False):
#     def _list(self, url, response_key=None, headers=None,
#               returned_res_cls=None):
#     def _get(self, url, response_key=None, headers=None):
#     def _delete(self, url, headers=None):
#     def _raise_api_exception(resp):
# def get_json(response):
#     def __init__(self, error_code=None, error_message=None):
# 
# Path: mistralclient/api/v2/executions.py
# class Execution(base.Resource):
# class ExecutionManager(base.ResourceManager):
#     def create(self, wf_identifier='', namespace='',
#                workflow_input=None, description='', source_execution_id=None,
#                **params):
#     def update(self, id, state, description=None, env=None):
#     def list(self, task=None, marker='', limit=None, sort_keys='',
#              sort_dirs='', fields='', **filters):
#     def get(self, id):
#     def get_ex_sub_executions(self, id, errors_only='', max_depth=-1):
#     def delete(self, id, force=None):
#     def get_report(self, id, errors_only=True, max_depth=None,
#                    statistics_only=False):


from oslo_serialization import jsonutils
from mistralclient.api import base
from mistralclient.api.v2 import executions
        url = '/tasks'

        if workflow_execution_id:
            url = '/executions/%s/tasks' % workflow_execution_id

        url += '%s'

        query_string = self._build_query_params(
            marker=marker,
            limit=limit,
            sort_keys=sort_keys,
            sort_dirs=sort_dirs,
            fields=fields,
            filters=filters
        )

        return self._list(url % query_string, response_key='tasks')

    def get(self, id):
        self._ensure_not_empty(id=id)

        return self._get('/tasks/%s' % id)

    def get_task_sub_executions(self, id, errors_only='', max_depth=-1):
        task_sub_execs_path = '/tasks/%s/executions%s'
        params = '?max_depth=%s&errors_only=%s' % (max_depth, errors_only)

        return self._list(
            task_sub_execs_path % (id, params),
            response_key='executions',

# Path: mistralclient/api/base.py
# class Resource(object):
# class ResourceManager(object):
# class APIException(Exception):
#     def __init__(self, manager, data):
#     def _set_defaults(self):
#     def _set_attributes(self):
#     def to_dict(self):
#     def __str__(self):
# def _check_items(obj, searches):
# def extract_json(response, response_key):
#     def __init__(self, http_client, enforce_raw_definitions=False):
#     def get_contents_if_file(self, contents_or_file_name):
#     def find(self, **kwargs):
#     def list(self):
#     def _build_query_params(marker=None, limit=None, sort_keys=None,
#                             sort_dirs=None, fields=None, filters=None,
#                             scope=None, namespace=None):
#     def _ensure_not_empty(self, **kwargs):
#     def _validate(self, url, data, response_key=None, dump_json=True,
#                   headers=None, is_iter_resp=False):
#     def _create(self, url, data, response_key=None, dump_json=True,
#                 headers=None, is_iter_resp=False, resp_status_ok=201,
#                 as_class=True):
#     def _update(self, url, data, response_key=None, dump_json=True,
#                 headers=None, is_iter_resp=False):
#     def _list(self, url, response_key=None, headers=None,
#               returned_res_cls=None):
#     def _get(self, url, response_key=None, headers=None):
#     def _delete(self, url, headers=None):
#     def _raise_api_exception(resp):
# def get_json(response):
#     def __init__(self, error_code=None, error_message=None):
# 
# Path: mistralclient/api/v2/executions.py
# class Execution(base.Resource):
# class ExecutionManager(base.ResourceManager):
#     def create(self, wf_identifier='', namespace='',
#                workflow_input=None, description='', source_execution_id=None,
#                **params):
#     def update(self, id, state, description=None, env=None):
#     def list(self, task=None, marker='', limit=None, sort_keys='',
#              sort_dirs='', fields='', **filters):
#     def get(self, id):
#     def get_ex_sub_executions(self, id, errors_only='', max_depth=-1):
#     def delete(self, id, force=None):
#     def get_report(self, id, errors_only=True, max_depth=None,
#                    statistics_only=False):


# Path: mistralclient/api/v2/tasks.py
from oslo_serialization import jsonutils
from mistralclient.api import base
from mistralclient.api.v2 import executions

        url = '/tasks'

        if workflow_execution_id:
            url = '/executions/%s/tasks' % workflow_execution_id

        url += '%s'

        query_string = self._build_query_params(
            marker=marker,
            limit=limit,
            sort_keys=sort_keys,
            sort_dirs=sort_dirs,
            fields=fields,
            filters=filters
        )

        return self._list(url % query_string, response_key='tasks')

    def get(self, id):
        self._ensure_not_empty(id=id)

        return self._get('/tasks/%s' % id)

    def get_task_sub_executions(self, id, errors_only='', max_depth=-1):
        task_sub_execs_path = '/tasks/%s/executions%s'
        params = '?max_depth=%s&errors_only=%s' % (max_depth, errors_only)

        return self._list(
            task_sub_execs_path % (id, params),
            response_key='executions',

            returned_res_cls=executions.Execution