# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class ScTestJob(BaseModel):
#     def __init__(
#             self,
#             container_id=None,
#             job_id=None,
#             error=None,
#             job_status=None,
#             created_at=None,
#             updated_at=None,
#     ):
#         self.container_id = container_id
#         self.job_id = job_id
#         self.error = error
#         self.job_status = job_status
#         self.created_at = created_at
#         self.updated_at = updated_at


from tenable_io.api.base import BaseApi
from tenable_io.api.models import ScTestJob

    def status(self, job_id):
        """Get the status of a test.

        :param job_id: The job ID.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.ScTestJob`.
        """
        response = self._client.get('container-security/api/v1/jobs/status', params={'job_id': job_id})
        return ScTestJob.from_json(response.text)

    def by_image(self, image_id):
        """Get the status of a test by Docker image ID.

        :param image_id: The Docker image ID.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.ScTestJob`.
        """
        response = self._client.get('container-security/api/v1/jobs/image_status', params={'image_id': image_id})
        return ScTestJob.from_json(response.text)

    def by_image_digest(self, sha256):
        """Get the status of a test by SHA256 checksum.

        :param sha256: SHA256 checksum of the container image.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.ScTestJob`.
        """
        response = self._client.get('container-security/api/v1/jobs/image_status_digest',
                                    params={'image_digest': sha256})

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class ScTestJob(BaseModel):
#     def __init__(
#             self,
#             container_id=None,
#             job_id=None,
#             error=None,
#             job_status=None,
#             created_at=None,
#             updated_at=None,
#     ):
#         self.container_id = container_id
#         self.job_id = job_id
#         self.error = error
#         self.job_status = job_status
#         self.created_at = created_at
#         self.updated_at = updated_at


# Path: tenable_io/api/sc_test_jobs.py
from tenable_io.api.base import BaseApi
from tenable_io.api.models import ScTestJob


    def status(self, job_id):
        """Get the status of a test.

        :param job_id: The job ID.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.ScTestJob`.
        """
        response = self._client.get('container-security/api/v1/jobs/status', params={'job_id': job_id})
        return ScTestJob.from_json(response.text)

    def by_image(self, image_id):
        """Get the status of a test by Docker image ID.

        :param image_id: The Docker image ID.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.ScTestJob`.
        """
        response = self._client.get('container-security/api/v1/jobs/image_status', params={'image_id': image_id})
        return ScTestJob.from_json(response.text)

    def by_image_digest(self, sha256):
        """Get the status of a test by SHA256 checksum.

        :param sha256: SHA256 checksum of the container image.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.ScTestJob`.
        """
        response = self._client.get('container-security/api/v1/jobs/image_status_digest',
                                    params={'image_digest': sha256})

        return ScTestJob.from_json(response.text)