listFleets method
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.
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.
May throw InternalServiceException.
May throw InvalidRequestException.
May throw NotFoundException.
May throw UnauthorizedException.
Parameter 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.
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.
Parameter 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.
Implementation
Future<ListFleetsOutput> listFleets({
String? buildId,
int? limit,
String? nextToken,
String? scriptId,
}) async {
_s.validateNumRange(
'limit',
limit,
1,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GameLift.ListFleets'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (buildId != null) 'BuildId': buildId,
if (limit != null) 'Limit': limit,
if (nextToken != null) 'NextToken': nextToken,
if (scriptId != null) 'ScriptId': scriptId,
},
);
return ListFleetsOutput.fromJson(jsonResponse.body);
}