listCompute method
This API works with the following fleet types: EC2, Anywhere, Container
Retrieves information on the compute resources in an Amazon GameLift Servers fleet. Use the pagination parameters to retrieve results in a set of sequential pages.
Request options
- Retrieve a list of all computes in a fleet. Specify a fleet ID.
- Retrieve a list of all computes in a specific fleet location. Specify a fleet ID and location.
If successful, this operation returns information on a set of computes. Depending on the type of fleet, the result includes the following information:
-
For a managed EC2 fleet (compute type
EC2), this operation returns information about the EC2 instance. Compute names are EC2 instance IDs. -
For an Anywhere fleet (compute type
ANYWHERE), this operation returns compute names and details from when the compute was registered withRegisterCompute. This includesGameLiftServiceSdkEndpointorGameLiftAgentEndpoint.
May throw InternalServiceException.
May throw InvalidRequestException.
May throw UnauthorizedException.
May throw UnsupportedRegionException.
Parameter fleetId :
A unique identifier for the fleet to retrieve compute resources for.
Parameter computeStatus :
The status of computes in a managed container fleet, based on the success
of the latest update deployment.
-
ACTIVE-- The compute is deployed with the correct container definitions. It is ready to process game servers and host game sessions. -
IMPAIRED-- An update deployment to the compute failed, and the compute is deployed with incorrect container definitions.
Parameter containerGroupDefinitionName :
For computes in a managed container fleet, the name of the deployed
container group definition.
Parameter limit :
The maximum number of results to return. Use this parameter with
NextToken to get results as a set of sequential pages.
Parameter location :
The name of a location to retrieve compute resources for. For an Amazon
GameLift Servers Anywhere fleet, use a custom location. For a managed
fleet, provide a Amazon Web Services Region or Local Zone code (for
example: us-west-2 or us-west-2-lax-1).
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<ListComputeOutput> listCompute({
required String fleetId,
ListComputeInputStatus? computeStatus,
String? containerGroupDefinitionName,
int? limit,
String? location,
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.ListCompute'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'FleetId': fleetId,
if (computeStatus != null) 'ComputeStatus': computeStatus.value,
if (containerGroupDefinitionName != null)
'ContainerGroupDefinitionName': containerGroupDefinitionName,
if (limit != null) 'Limit': limit,
if (location != null) 'Location': location,
if (nextToken != null) 'NextToken': nextToken,
},
);
return ListComputeOutput.fromJson(jsonResponse.body);
}