:doc:`GameLift <../../gamelift>` / Client / list_fleets

***********
list_fleets
***********



.. py:method:: GameLift.Client.list_fleets(**kwargs)

  

  **This API works with the following fleet types:** EC2, Anywhere, Container

   

  Retrieves a collection of fleet resources in an Amazon Web Services Region. You can filter the result set to find only those fleets that are deployed with a specific build or script. For fleets that have multiple locations, this operation retrieves fleets based on their home Region only.

   

  You can use operation in the following ways:

   

  
  * To get a list of all fleets in a Region, don't provide a build or script identifier.
   
  * To get a list of all fleets where a specific game build is deployed, provide the build ID.
   
  * To get a list of all Amazon GameLift Servers Realtime fleets with a specific configuration script, provide the script ID.
  

   

  Use the pagination parameters to retrieve results as a set of sequential pages.

   

  If successful, this operation returns a list of fleet IDs that match the request parameters. A NextToken value is also returned if there are more result pages to retrieve.

   

  .. note::

    

    Fleet IDs are returned in no particular order.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/gamelift-2015-10-01/ListFleets>`_  


  **Request Syntax**
  ::

    response = client.list_fleets(
        BuildId='string',
        ScriptId='string',
        Limit=123,
        NextToken='string'
    )
    
  :type BuildId: string
  :param BuildId: 

    A unique identifier for the build to request fleets for. Use this parameter to return only fleets using a specified build. Use either the build ID or ARN value.

    

  
  :type ScriptId: string
  :param ScriptId: 

    A unique identifier for the Realtime script to request fleets for. Use this parameter to return only fleets using a specified script. Use either the script ID or ARN value.

    

  
  :type Limit: integer
  :param Limit: 

    The maximum number of results to return. Use this parameter with ``NextToken`` to get results as a set of sequential pages.

    

  
  :type NextToken: string
  :param NextToken: 

    A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value.

    

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

    
    ::

      {
          'FleetIds': [
              'string',
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **FleetIds** *(list) --* 

        A set of fleet IDs that match the list request.

        
        

        - *(string) --* 
    
      

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

        A token that indicates where to resume retrieving results on the next call to this operation. If no token is returned, these results represent the end of the list.

        
  
  **Exceptions**
  
  *   :py:class:`GameLift.Client.exceptions.InternalServiceException`

  
  *   :py:class:`GameLift.Client.exceptions.NotFoundException`

  
  *   :py:class:`GameLift.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`GameLift.Client.exceptions.UnauthorizedException`

  