Skip to content

get_export_job_v2 async

get_export_job_v2(
    export_job_id: ExportJobId,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
) -> GetExportJobV2Response

Returns the details of a single findings export job, including its current Status, the Destination it writes to, the OutputConfiguration it was started with, and its StartedAt and EndedAt timestamps. Use this operation to poll an export job that you started with StartExportJobV2 until it reaches a terminal state (SUCCEEDED, FAILED, or CANCELLED).

If the job failed, the response includes a FailureCode and FailureMessage that describe the reason. Input values such as Scopes and Filters are echoed back as they were submitted, with relative date ranges returned unresolved. If no export job matches the ExportJobId that you provide, this operation returns a ResourceNotFoundException.

Parameters:

  • export_job_id (ExportJobId) –

    The unique identifier of the export job to retrieve. This is the value returned by StartExportJobV2.

Raises:

Examples:

Example – Getting the details of a failed export job The following example retrieves an export job that failed because Security Hub couldn't write to the destination. The FailureCode and FailureMessage explain the cause.

>>> await client.get_export_job_v2(export_job_id='f6e5d4c3b2a1')
Example – Getting the details of a completed export job
The following example retrieves an export job that has finished successfully. The output is available in the destination bucket.
>>> await client.get_export_job_v2(export_job_id='a1b2c3d4e5f6')
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def get_export_job_v2(
    self,
    export_job_id: "capo_securityhub.types.export_job_id.ExportJobId",
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
) -> "capo_securityhub.types.get_export_job_v2_response.GetExportJobV2Response":
    """<p>Returns the details of a single findings export job, including its current <code>Status</code>, the <code>Destination</code> it writes to, the <code>OutputConfiguration</code> it was started with, and its <code>StartedAt</code> and <code>EndedAt</code> timestamps. Use this operation to poll an export job that you started with <code>StartExportJobV2</code> until it reaches a terminal state (<code>SUCCEEDED</code>, <code>FAILED</code>, or <code>CANCELLED</code>).</p> <p>If the job failed, the response includes a <code>FailureCode</code> and <code>FailureMessage</code> that describe the reason. Input values such as <code>Scopes</code> and <code>Filters</code> are echoed back as they were submitted, with relative date ranges returned unresolved. If no export job matches the <code>ExportJobId</code> that you provide, this operation returns a <code>ResourceNotFoundException</code>.</p>

    Args:
        export_job_id: <p>The unique identifier of the export job to retrieve. This is the value returned by <code>StartExportJobV2</code>.</p>

    Raises:
        capo_securityhub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action specified in the request.</p>
        capo_securityhub.errors.internal_server_exception.InternalServerException: <p> The request has failed due to an internal failure of the service. </p>
        capo_securityhub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
        capo_securityhub.errors.throttling_exception.ThrottlingException: <p> The limit on the number of requests per second was exceeded. </p>
        capo_securityhub.errors.validation_exception.ValidationException: <p>The request has failed validation because it's missing required fields or has invalid inputs.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example – Getting the details of a failed export job
        The following example retrieves an export job that failed because Security Hub couldn't write to the destination. The FailureCode and FailureMessage explain the cause.

        >>> await client.get_export_job_v2(export_job_id='f6e5d4c3b2a1')
        Example – Getting the details of a completed export job
        The following example retrieves an export job that has finished successfully. The output is available in the destination bucket.

        >>> await client.get_export_job_v2(export_job_id='a1b2c3d4e5f6')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.get_export_job_v2_request.GetExportJobV2Request]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.get_export_job_v2_response.GetExportJobV2Response"
    ]:
        import capo_securityhub._operations.security_hub_api_service.get_export_job_v2

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_service.get_export_job_v2.async_get_export_job_v2(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetExportJobV2")
    )
    input_: capo_securityhub.types.get_export_job_v2_request.GetExportJobV2Request = {
        "export_job_id": export_job_id
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output