describeGameServerInstances method
This operation is used with the Amazon GameLift FleetIQ solution and game server groups.
Retrieves status information about the Amazon EC2 instances associated with a GameLift FleetIQ game server group. Use this operation to detect when instances are active or not available to host new game servers. If you are looking for instance configuration information, call DescribeGameServerGroup or access the corresponding Auto Scaling group properties.
To request status for all instances in the game server group, provide a
game server group ID only. To request status for specific instances,
provide the game server group ID and one or more instance IDs. Use the
pagination parameters to retrieve results in sequential segments. If
successful, a collection of GameServerInstance
objects is
returned.
This operation is not designed to be called with every game server claim request; this practice can cause you to exceed your API limit, which results in errors. Instead, as a best practice, cache the results and refresh your cache no more than once every 10 seconds.
Learn more
Related operations
- CreateGameServerGroup
- ListGameServerGroups
- DescribeGameServerGroup
- UpdateGameServerGroup
- DeleteGameServerGroup
- ResumeGameServerGroup
- SuspendGameServerGroup
- DescribeGameServerInstances
May throw InvalidRequestException. May throw NotFoundException. May throw UnauthorizedException. May throw InternalServiceException.
Parameter gameServerGroupName
:
A unique identifier for the game server group. Use either the
GameServerGroup name or ARN value.
Parameter instanceIds
:
The EC2 instance IDs that you want to retrieve status on. EC2 instance IDs
use a 17-character format, for example: i-1234567890abcdef0
.
To retrieve all instances in the game server group, leave this parameter
empty.
Parameter limit
:
The maximum number of results to return. Use this parameter with
NextToken
to get results as a set of sequential segments.
Parameter nextToken
:
A token that indicates the start of the next sequential segment of
results. Use the token returned with the previous call to this operation.
To start at the beginning of the result set, do not specify a value.
Implementation
Future<DescribeGameServerInstancesOutput> describeGameServerInstances({
required String gameServerGroupName,
List<String>? instanceIds,
int? limit,
String? nextToken,
}) async {
ArgumentError.checkNotNull(gameServerGroupName, 'gameServerGroupName');
_s.validateStringLength(
'gameServerGroupName',
gameServerGroupName,
1,
256,
isRequired: true,
);
_s.validateNumRange(
'limit',
limit,
1,
1152921504606846976,
);
_s.validateStringLength(
'nextToken',
nextToken,
1,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GameLift.DescribeGameServerInstances'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'GameServerGroupName': gameServerGroupName,
if (instanceIds != null) 'InstanceIds': instanceIds,
if (limit != null) 'Limit': limit,
if (nextToken != null) 'NextToken': nextToken,
},
);
return DescribeGameServerInstancesOutput.fromJson(jsonResponse.body);
}