listContainerFleets method

Future<ListContainerFleetsOutput> listContainerFleets({
  1. String? containerGroupDefinitionName,
  2. int? limit,
  3. String? nextToken,
})

This API works with the following fleet types: Container

Retrieves a collection of container fleet resources in an Amazon Web Services Region. For fleets that have multiple locations, this operation retrieves fleets based on their home Region only.

Request options

  • Get a list of all fleets. Call this operation without specifying a container group definition.
  • Get a list of fleets filtered by container group definition. Provide the container group definition name or ARN value.
  • 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 collection of container fleets that match the request parameters. A NextToken value is also returned if there are more result pages to retrieve.

May throw InternalServiceException. May throw InvalidRequestException. May throw UnauthorizedException. May throw UnsupportedRegionException.

Parameter containerGroupDefinitionName : The container group definition to filter the list on. Use this parameter to retrieve only those fleets that use the specified container group definition. You can specify the container group definition's name to get fleets with the latest versions. Alternatively, provide an ARN value to get fleets with a specific version number.

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

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

Implementation

Future<ListContainerFleetsOutput> listContainerFleets({
  String? containerGroupDefinitionName,
  int? limit,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.ListContainerFleets'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (containerGroupDefinitionName != null)
        'ContainerGroupDefinitionName': containerGroupDefinitionName,
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListContainerFleetsOutput.fromJson(jsonResponse.body);
}