UpdateGameSessionCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GameLiftClient, UpdateGameSessionCommand } from "@aws-sdk/client-gamelift"; // ES Modules import
// const { GameLiftClient, UpdateGameSessionCommand } = require("@aws-sdk/client-gamelift"); // CommonJS import
const client = new GameLiftClient(config);
const input = { // UpdateGameSessionInput
  GameSessionId: "STRING_VALUE", // required
  MaximumPlayerSessionCount: Number("int"),
  Name: "STRING_VALUE",
  PlayerSessionCreationPolicy: "ACCEPT_ALL" || "DENY_ALL",
  ProtectionPolicy: "NoProtection" || "FullProtection",
  GameProperties: [ // GamePropertyList
    { // GameProperty
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE", // required
    },
  ],
};
const command = new UpdateGameSessionCommand(input);
const response = await client.send(command);
// { // UpdateGameSessionOutput
//   GameSession: { // GameSession
//     GameSessionId: "STRING_VALUE",
//     Name: "STRING_VALUE",
//     FleetId: "STRING_VALUE",
//     FleetArn: "STRING_VALUE",
//     CreationTime: new Date("TIMESTAMP"),
//     TerminationTime: new Date("TIMESTAMP"),
//     CurrentPlayerSessionCount: Number("int"),
//     MaximumPlayerSessionCount: Number("int"),
//     Status: "ACTIVE" || "ACTIVATING" || "TERMINATED" || "TERMINATING" || "ERROR",
//     StatusReason: "INTERRUPTED" || "TRIGGERED_ON_PROCESS_TERMINATE" || "FORCE_TERMINATED",
//     GameProperties: [ // GamePropertyList
//       { // GameProperty
//         Key: "STRING_VALUE", // required
//         Value: "STRING_VALUE", // required
//       },
//     ],
//     IpAddress: "STRING_VALUE",
//     DnsName: "STRING_VALUE",
//     Port: Number("int"),
//     PlayerSessionCreationPolicy: "ACCEPT_ALL" || "DENY_ALL",
//     CreatorId: "STRING_VALUE",
//     GameSessionData: "STRING_VALUE",
//     MatchmakerData: "STRING_VALUE",
//     Location: "STRING_VALUE",
//   },
// };

UpdateGameSessionCommand Input

See UpdateGameSessionCommandInput for more details

Parameter
Type
Description
GameSessionId
Required
string | undefined

A unique identifier for the game session to update.

GameProperties
GameProperty[] | undefined

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 .

MaximumPlayerSessionCount
number | undefined

The maximum number of players that can be connected simultaneously to the game session.

Name
string | undefined

A descriptive label that is associated with a game session. Session names do not need to be unique.

PlayerSessionCreationPolicy
PlayerSessionCreationPolicy | undefined

A policy that determines whether the game session is accepting new players.

ProtectionPolicy
ProtectionPolicy | undefined

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 an ACTIVE status, it cannot be terminated during a scale-down event.

UpdateGameSessionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
GameSession
GameSession | undefined

The updated game session properties.

Throws

Name
Fault
Details
ConflictException
client

The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.

InternalServiceException
server

The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

InvalidGameSessionStatusException
client

The requested operation would cause a conflict with the current state of a resource associated with the request and/or the game instance. Resolve the conflict before retrying.

InvalidRequestException
client

One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

NotFoundException
client

The requested resources was not found. The resource was either not created yet or deleted.

UnauthorizedException
client

The client failed authentication. Clients should not retry such requests.

GameLiftServiceException
Base exception class for all service exceptions from GameLift service.