updateGameSession method
This API works with the following fleet types: EC2, Anywhere, Container
Updates the mutable properties of a game session.
To update a game session, specify the game session ID and the values you want to change.
If successful, the updated GameSession object is returned.
May throw ConflictException.
May throw InternalServiceException.
May throw InvalidGameSessionStatusException.
May throw InvalidRequestException.
May throw NotFoundException.
May throw NotReadyException.
May throw UnauthorizedException.
Parameter gameSessionId :
An identifier for the game session that is unique across all regions to
update. The value is always a full ARN in the following format:
arn:aws:gamelift:.
Parameter gameProperties :
A set of key-value pairs that can store custom data in a game session. For
example: {"Key": "difficulty", "Value": "novice"}. You can
use this parameter to modify game properties in an active game session.
This action adds new properties and modifies existing properties. There is
no way to delete properties. For an example, see Update
the value of a game property.
- Avoid using periods (".") in property keys if you plan to search for game sessions by properties. Property keys containing periods cannot be searched and will be filtered out from search results due to search index limitations.
- If you use SearchGameSessions API, there is a limit of 500 game property keys across all game sessions and all fleets per region. If the limit is exceeded, there will potentially be game session entries missing from SearchGameSessions API results.
Parameter maximumPlayerSessionCount :
The maximum number of players that can be connected simultaneously to the
game session.
Parameter name :
A descriptive label that is associated with a game session. Session names
do not need to be unique.
Parameter playerSessionCreationPolicy :
A policy that determines whether the game session is accepting new
players.
Parameter protectionPolicy :
Game session protection policy to apply to this game session only.
-
NoProtection-- The game session can be terminated during a scale-down event. -
FullProtection-- If the game session is in anACTIVEstatus, it cannot be terminated during a scale-down event.
Implementation
Future<UpdateGameSessionOutput> updateGameSession({
required String gameSessionId,
List<GameProperty>? gameProperties,
int? maximumPlayerSessionCount,
String? name,
PlayerSessionCreationPolicy? playerSessionCreationPolicy,
ProtectionPolicy? protectionPolicy,
}) async {
_s.validateNumRange(
'maximumPlayerSessionCount',
maximumPlayerSessionCount,
0,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GameLift.UpdateGameSession'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'GameSessionId': gameSessionId,
if (gameProperties != null) 'GameProperties': gameProperties,
if (maximumPlayerSessionCount != null)
'MaximumPlayerSessionCount': maximumPlayerSessionCount,
if (name != null) 'Name': name,
if (playerSessionCreationPolicy != null)
'PlayerSessionCreationPolicy': playerSessionCreationPolicy.value,
if (protectionPolicy != null)
'ProtectionPolicy': protectionPolicy.value,
},
);
return UpdateGameSessionOutput.fromJson(jsonResponse.body);
}