Skip to content

list_audit_tasks

list_audit_tasks(
    start_time: Timestamp,
    end_time: Timestamp,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    task_type: Optional[AuditTaskType] = None,
    task_status: Optional[AuditTaskStatus] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListAuditTasksResponse

Lists the Device Defender audits that have been performed during a given time period.

Requires permission to access the ListAuditTasks action.

Parameters:

  • start_time (Timestamp) –

    The beginning of the time period. Audit information is retained for a limited time (90 days). Requesting a start time prior to what is retained results in an "InvalidRequestException".

  • end_time (Timestamp) –

    The end of the time period.

  • task_type (Optional[AuditTaskType], default: None ) –

    A filter to limit the output to the specified type of audit: can be one of "ON_DEMAND_AUDIT_TASK" or "SCHEDULED__AUDIT_TASK".

  • task_status (Optional[AuditTaskStatus], default: None ) –

    A filter to limit the output to audits with the specified completion status: can be one of "IN_PROGRESS", "COMPLETED", "FAILED", or "CANCELED".

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of results.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return at one time. The default is 25.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def list_audit_tasks(
    self,
    start_time: "capo_iot.types.timestamp.Timestamp",
    end_time: "capo_iot.types.timestamp.Timestamp",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    task_type: Optional["capo_iot.types.audit_task_type.AuditTaskType"] = None,
    task_status: Optional[
        "capo_iot.types.audit_task_status.AuditTaskStatus"
    ] = None,
    next_token: Optional["capo_iot.types.next_token.NextToken"] = None,
    max_results: Optional["capo_iot.types.max_results.MaxResults"] = None,
) -> "capo_iot.types.list_audit_tasks_response.ListAuditTasksResponse":
    """<p>Lists the Device Defender audits that have been performed during a given time period.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListAuditTasks</a> action.</p>

    Args:
        start_time: <p>The beginning of the time period. Audit information is retained for a limited time (90 days). Requesting a start time prior to what is retained results in an "InvalidRequestException".</p>
        end_time: <p>The end of the time period.</p>
        task_type: <p>A filter to limit the output to the specified type of audit: can be one of "ON_DEMAND_AUDIT_TASK" or "SCHEDULED__AUDIT_TASK".</p>
        task_status: <p>A filter to limit the output to audits with the specified completion status: can be one of "IN_PROGRESS", "COMPLETED", "FAILED", or "CANCELED".</p>
        next_token: <p>The token for the next set of results.</p>
        max_results: <p>The maximum number of results to return at one time. The default is 25.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.list_audit_tasks_request.ListAuditTasksRequest]",
    ) -> OperationResponse[
        "capo_iot.types.list_audit_tasks_response.ListAuditTasksResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_audit_tasks

        output, http_response = (
            capo_iot._operations.aws_iot_service.list_audit_tasks.list_audit_tasks(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAuditTasks")
    )
    input_: capo_iot.types.list_audit_tasks_request.ListAuditTasksRequest = {
        "start_time": start_time,
        "end_time": end_time,
    }
    if task_type is not None:
        input_["task_type"] = task_type
    if task_status is not None:
        input_["task_status"] = task_status
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output