# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class BulkOpTask(BaseModel):
# 
#     STATUS_NEW = u'NEW'
#     STATUS_RUNNING = u'RUNNING'
#     STATUS_COMPLETED = u'COMPLETED'
#     STATUS_FAILED = u'FAILED'
# 
#     def __init__(
#             self,
#             task_id=None,
#             container_uuid=None,
#             status=None,
#             message=None,
#             start_time=None,
#             end_time=None,
#             last_update_time=None,
#             total_work_units=None,
#             total_work_units_completed=None,
#             completion_percentage=None
#     ):
#         self.task_id = task_id
#         self.container_uuid = container_uuid
#         self.status = status
#         self.message = message
#         self.start_time = start_time
#         self.end_time = end_time
#         self.last_update_time = last_update_time
#         self.total_work_units = total_work_units
#         self.total_work_units_completed = total_work_units_completed
#         self.completion_percentage = completion_percentage


from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import BulkOpTask
    def bulk_agent_group_status(self, group_id, task_uuid, scanner_id=1):
        """Check the status of a bulk operation on an agent group.

        :param group_id: The agent group ID.
        :param task_uuid: The uuid of the task.
        :param scanner_id: The scanner ID.
        :raise TenableIOApiException: When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.BulkOpTask`.
        """
        response = self._client.get('scanners/%(scanner_id)s/agent-groups/%(group_id)s/agents/_bulk/%(task_uuid)s',
                                    path_params={
                                        'scanner_id': scanner_id,
                                        'group_id': group_id,
                                        'task_uuid': task_uuid
                                    })
        return BulkOpTask.from_json(response.text)

    def bulk_agent_status(self, task_uuid, scanner_id=1):
        """Check the status of a bulk operation on an agent.

        :param task_uuid: The uuid of the task.
        :param scanner_id: The scanner ID.
        :raise TenableIOApiException: When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.BulkOpTask`.
        """
        response = self._client.get('scanners/%(scanner_id)s/agents/_bulk/%(task_uuid)s',
                                    path_params={
                                        'scanner_id': scanner_id,
                                        'task_uuid': task_uuid
                                    })

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class BulkOpTask(BaseModel):
# 
#     STATUS_NEW = u'NEW'
#     STATUS_RUNNING = u'RUNNING'
#     STATUS_COMPLETED = u'COMPLETED'
#     STATUS_FAILED = u'FAILED'
# 
#     def __init__(
#             self,
#             task_id=None,
#             container_uuid=None,
#             status=None,
#             message=None,
#             start_time=None,
#             end_time=None,
#             last_update_time=None,
#             total_work_units=None,
#             total_work_units_completed=None,
#             completion_percentage=None
#     ):
#         self.task_id = task_id
#         self.container_uuid = container_uuid
#         self.status = status
#         self.message = message
#         self.start_time = start_time
#         self.end_time = end_time
#         self.last_update_time = last_update_time
#         self.total_work_units = total_work_units
#         self.total_work_units_completed = total_work_units_completed
#         self.completion_percentage = completion_percentage


# Path: tenable_io/api/bulk_operations.py
from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import BulkOpTask

    def bulk_agent_group_status(self, group_id, task_uuid, scanner_id=1):
        """Check the status of a bulk operation on an agent group.

        :param group_id: The agent group ID.
        :param task_uuid: The uuid of the task.
        :param scanner_id: The scanner ID.
        :raise TenableIOApiException: When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.BulkOpTask`.
        """
        response = self._client.get('scanners/%(scanner_id)s/agent-groups/%(group_id)s/agents/_bulk/%(task_uuid)s',
                                    path_params={
                                        'scanner_id': scanner_id,
                                        'group_id': group_id,
                                        'task_uuid': task_uuid
                                    })
        return BulkOpTask.from_json(response.text)

    def bulk_agent_status(self, task_uuid, scanner_id=1):
        """Check the status of a bulk operation on an agent.

        :param task_uuid: The uuid of the task.
        :param scanner_id: The scanner ID.
        :raise TenableIOApiException: When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.BulkOpTask`.
        """
        response = self._client.get('scanners/%(scanner_id)s/agents/_bulk/%(task_uuid)s',
                                    path_params={
                                        'scanner_id': scanner_id,
                                        'task_uuid': task_uuid
                                    })

        return BulkOpTask.from_json(response.text)