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

**************
list_locations
**************



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

  

  Returns a list of source and destination locations.

   

  If you have more locations than are returned in a response (that is, the response returns only a truncated list of your agents), the response contains a token that you can specify in your next request to fetch the next page of locations.

  

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


  **Request Syntax**
  ::

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

    The maximum number of locations to return.

    

  
  :type NextToken: string
  :param NextToken: 

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

    

  
  :type Filters: list
  :param Filters: 

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

    

  
    - *(dict) --* 

      Narrow down the list of resources returned by ``ListLocations``. For example, to see all your Amazon S3 locations, create a filter using ``"Name": "LocationType"``, ``"Operator": "Equals"``, and ``"Values": "S3"``.

       

      For more information, see `filtering 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, ``LocationType`` for ``ListLocations``).

        

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

        The values that you want to filter for. For example, you might want to display only Amazon S3 locations.

        

      
        - *(string) --* 

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

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

        

      
    

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

    
    ::

      {
          'Locations': [
              {
                  'LocationArn': 'string',
                  'LocationUri': 'string'
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      ListLocationsResponse

      
      

      - **Locations** *(list) --* 

        An array that contains a list of locations.

        
        

        - *(dict) --* 

          Represents a single entry in a list of locations. ``LocationListEntry`` returns an array that contains a list of locations when the `ListLocations <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListLocations.html>`__ operation is called.

          
          

          - **LocationArn** *(string) --* 

            The Amazon Resource Name (ARN) of the location. For Network File System (NFS) or Amazon EFS, the location is the export path. For Amazon S3, the location is the prefix path that you want to mount and use as the root of the location.

            
          

          - **LocationUri** *(string) --* 

            Represents a list of URIs of a location. ``LocationUri`` returns an array that contains a list of locations when the `ListLocations <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListLocations.html>`__ operation is called.

             

            Format: ``TYPE://GLOBAL_ID/SUBDIR``.

             

            TYPE designates the type of location (for example, ``nfs`` or ``s3``).

             

            GLOBAL_ID is the globally unique identifier of the resource that backs the location. An example for EFS is ``us-east-2.fs-abcd1234``. An example for Amazon S3 is the bucket name, such as ``myBucket``. An example for NFS is a valid IPv4 or IPv6 address or a hostname that is compliant with DNS.

             

            SUBDIR is a valid file system path, delimited by forward slashes as is the *nix convention. For NFS and Amazon EFS, it's the export path to mount the location. For Amazon S3, it's the prefix path that you mount to and treat as the root of the location.

            
      
    
      

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

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

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

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

  