:doc:`DataSync <../../datasync>` / Client / list_tasks

**********
list_tasks
**********



.. py:method:: DataSync.Client.list_tasks(**kwargs)

  

  Returns a list of the DataSync tasks you created.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/datasync-2018-11-09/ListTasks>`_  


  **Request Syntax**
  ::

    response = client.list_tasks(
        MaxResults=123,
        NextToken='string',
        Filters=[
            {
                'Name': 'LocationId'|'CreationTime',
                'Values': [
                    'string',
                ],
                'Operator': 'Equals'|'NotEquals'|'In'|'LessThanOrEqual'|'LessThan'|'GreaterThanOrEqual'|'GreaterThan'|'Contains'|'NotContains'|'BeginsWith'
            },
        ]
    )
    
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of tasks to return.

    

  
  :type NextToken: string
  :param NextToken: 

    An opaque string that indicates the position at which to begin the next list of tasks.

    

  
  :type Filters: list
  :param Filters: 

    You can use API filters to narrow down the list of resources returned by ``ListTasks``. For example, to retrieve all tasks on a specific source location, you can use ``ListTasks`` with filter name ``LocationId`` and ``Operator Equals`` with the ARN for the location.

    

  
    - *(dict) --* 

      You can use API filters to narrow down the list of resources returned by ``ListTasks``. For example, to retrieve all tasks on a source location, you can use ``ListTasks`` with filter name ``LocationId`` and ``Operator Equals`` with the ARN for the location.

       

      For more information, see `filtering DataSync resources <https://docs.aws.amazon.com/datasync/latest/userguide/query-resources.html>`__.

      

    
      - **Name** *(string) --* **[REQUIRED]** 

        The name of the filter being used. Each API call supports a list of filters that are available for it. For example, ``LocationId`` for ``ListTasks``.

        

      
      - **Values** *(list) --* **[REQUIRED]** 

        The values that you want to filter for. For example, you might want to display only tasks for a specific destination location.

        

      
        - *(string) --* 

        
    
      - **Operator** *(string) --* **[REQUIRED]** 

        The operator that is used to compare filter values (for example, ``Equals`` or ``Contains``).

        

      
    

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

    
    ::

      {
          'Tasks': [
              {
                  'TaskArn': 'string',
                  'Status': 'AVAILABLE'|'CREATING'|'QUEUED'|'RUNNING'|'UNAVAILABLE',
                  'Name': 'string',
                  'TaskMode': 'BASIC'|'ENHANCED'
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      ListTasksResponse

      
      

      - **Tasks** *(list) --* 

        A list of all the tasks that are returned.

        
        

        - *(dict) --* 

          Represents a single entry in a list of tasks. ``TaskListEntry`` returns an array that contains a list of tasks when the `ListTasks <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListTasks.html>`__ operation is called. A task includes the source and destination file systems to sync and the options to use for the tasks.

          
          

          - **TaskArn** *(string) --* 

            The Amazon Resource Name (ARN) of the task.

            
          

          - **Status** *(string) --* 

            The status of the task.

            
          

          - **Name** *(string) --* 

            The name of the task.

            
          

          - **TaskMode** *(string) --* 

            The task mode that you're using. For more information, see `Choosing a task mode for your data transfer <https://docs.aws.amazon.com/datasync/latest/userguide/choosing-task-mode.html>`__.

            
      
    
      

      - **NextToken** *(string) --* 

        An opaque string that indicates the position at which to begin returning the next list of tasks.

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

  
  *   :py:class:`DataSync.Client.exceptions.InternalException`

  