:doc:`IoT <../../iot>` / Client / list_audit_tasks

****************
list_audit_tasks
****************



.. py:method:: IoT.Client.list_audit_tasks(**kwargs)

  

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

   

  Requires permission to access the `ListAuditTasks <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/ListAuditTasks>`_  


  **Request Syntax**
  ::

    response = client.list_audit_tasks(
        startTime=datetime(2015, 1, 1),
        endTime=datetime(2015, 1, 1),
        taskType='ON_DEMAND_AUDIT_TASK'|'SCHEDULED_AUDIT_TASK',
        taskStatus='IN_PROGRESS'|'COMPLETED'|'FAILED'|'CANCELED',
        nextToken='string',
        maxResults=123
    )
    
  :type startTime: datetime
  :param startTime: **[REQUIRED]** 

    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".

    

  
  :type endTime: datetime
  :param endTime: **[REQUIRED]** 

    The end of the time period.

    

  
  :type taskType: string
  :param taskType: 

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

    

  
  :type taskStatus: string
  :param taskStatus: 

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

    

  
  :type nextToken: string
  :param nextToken: 

    The token for the next set of results.

    

  
  :type maxResults: integer
  :param maxResults: 

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

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'tasks': [
              {
                  'taskId': 'string',
                  'taskStatus': 'IN_PROGRESS'|'COMPLETED'|'FAILED'|'CANCELED',
                  'taskType': 'ON_DEMAND_AUDIT_TASK'|'SCHEDULED_AUDIT_TASK'
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **tasks** *(list) --* 

        The audits that were performed during the specified time period.

        
        

        - *(dict) --* 

          The audits that were performed.

          
          

          - **taskId** *(string) --* 

            The ID of this audit.

            
          

          - **taskStatus** *(string) --* 

            The status of this audit. One of "IN_PROGRESS", "COMPLETED", "FAILED", or "CANCELED".

            
          

          - **taskType** *(string) --* 

            The type of this audit. One of "ON_DEMAND_AUDIT_TASK" or "SCHEDULED_AUDIT_TASK".

            
      
    
      

      - **nextToken** *(string) --* 

        A token that can be used to retrieve the next set of results, or ``null`` if there are no additional results.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  