Class GameSession
- All Implemented Interfaces:
Serializable,SdkPojo,ToCopyableBuilder<GameSession.Builder,GameSession>
Properties describing a game session.
A game session in ACTIVE status can host players. When a game session ends, its status is set to
TERMINATED.
Amazon GameLift retains a game session resource for 30 days after the game session ends. You can reuse idempotency token values after this time. Game session logs are retained for 14 days.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic GameSession.Builderbuilder()final InstantA time stamp indicating when this data object was created.final StringA unique identifier for a player.final IntegerNumber of players currently in the game session.final StringdnsName()The DNS identifier assigned to the instance that is running the game session.final booleanfinal booleanequalsBySdkFields(Object obj) Indicates whether some other object is "equal to" this one by SDK fields.final StringfleetArn()The Amazon Resource Name (ARN) associated with the GameLift fleet that this game session is running on.final StringfleetId()A unique identifier for the fleet that the game session is running on.final List<GameProperty> A set of key-value pairs that can store custom data in a game session.final StringA set of custom game session properties, formatted as a single string value.final StringA unique identifier for the game session.final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) final booleanFor responses, this returns true if the service returned a value for the GameProperties property.final inthashCode()final StringThe IP address of the game session.final Stringlocation()The fleet location where the game session is running.final StringInformation about the matchmaking process that resulted in the game session, if matchmaking was used.final IntegerThe maximum number of players that can be connected simultaneously to the game session.final Stringname()A descriptive label that is associated with a game session.Indicates whether or not the game session is accepting new players.final StringIndicates whether or not the game session is accepting new players.final Integerport()The port number for the game session.static Class<? extends GameSession.Builder> final GameSessionStatusstatus()Current status of the game session.final StringCurrent status of the game session.final GameSessionStatusReasonProvides additional information about game session status.final StringProvides additional information about game session status.final InstantA time stamp indicating when this data object was terminated.Take this object and create a builder that contains all of the current property values of this object.final StringtoString()Returns a string representation of this object.Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
Method Details
-
gameSessionId
A unique identifier for the game session. A game session ARN has the following format:
arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token>.- Returns:
- A unique identifier for the game session. A game session ARN has the following format:
arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token>.
-
name
A descriptive label that is associated with a game session. Session names do not need to be unique.
- Returns:
- A descriptive label that is associated with a game session. Session names do not need to be unique.
-
fleetId
A unique identifier for the fleet that the game session is running on.
- Returns:
- A unique identifier for the fleet that the game session is running on.
-
fleetArn
-
creationTime
A time stamp indicating when this data object was created. Format is a number expressed in Unix time as milliseconds (for example
"1469498468.057").- Returns:
- A time stamp indicating when this data object was created. Format is a number expressed in Unix time as
milliseconds (for example
"1469498468.057").
-
terminationTime
A time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as milliseconds (for example
"1469498468.057").- Returns:
- A time stamp indicating when this data object was terminated. Format is a number expressed in Unix time
as milliseconds (for example
"1469498468.057").
-
currentPlayerSessionCount
Number of players currently in the game session.
- Returns:
- Number of players currently in the game session.
-
maximumPlayerSessionCount
The maximum number of players that can be connected simultaneously to the game session.
- Returns:
- The maximum number of players that can be connected simultaneously to the game session.
-
status
Current status of the game session. A game session must have an
ACTIVEstatus to have player sessions.If the service returns an enum value that is not available in the current SDK version,
statuswill returnGameSessionStatus.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromstatusAsString().- Returns:
- Current status of the game session. A game session must have an
ACTIVEstatus to have player sessions. - See Also:
-
statusAsString
Current status of the game session. A game session must have an
ACTIVEstatus to have player sessions.If the service returns an enum value that is not available in the current SDK version,
statuswill returnGameSessionStatus.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromstatusAsString().- Returns:
- Current status of the game session. A game session must have an
ACTIVEstatus to have player sessions. - See Also:
-
statusReason
Provides additional information about game session status.
INTERRUPTEDindicates that the game session was hosted on a spot instance that was reclaimed, causing the active game session to be terminated.If the service returns an enum value that is not available in the current SDK version,
statusReasonwill returnGameSessionStatusReason.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromstatusReasonAsString().- Returns:
- Provides additional information about game session status.
INTERRUPTEDindicates that the game session was hosted on a spot instance that was reclaimed, causing the active game session to be terminated. - See Also:
-
statusReasonAsString
Provides additional information about game session status.
INTERRUPTEDindicates that the game session was hosted on a spot instance that was reclaimed, causing the active game session to be terminated.If the service returns an enum value that is not available in the current SDK version,
statusReasonwill returnGameSessionStatusReason.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromstatusReasonAsString().- Returns:
- Provides additional information about game session status.
INTERRUPTEDindicates that the game session was hosted on a spot instance that was reclaimed, causing the active game session to be terminated. - See Also:
-
hasGameProperties
public final boolean hasGameProperties()For responses, this returns true if the service returned a value for the GameProperties property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified. -
gameProperties
A set of key-value pairs that can store custom data in a game session. For example:
{"Key": "difficulty", "Value": "novice"}.Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the
hasGameProperties()method.- Returns:
- A set of key-value pairs that can store custom data in a game session. For example:
{"Key": "difficulty", "Value": "novice"}.
-
ipAddress
The IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and port number.
- Returns:
- The IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and port number.
-
dnsName
The DNS identifier assigned to the instance that is running the game session. Values have the following format:
-
TLS-enabled fleets:
<unique identifier>.<region identifier>.amazongamelift.com. -
Non-TLS-enabled fleets:
ec2-<unique identifier>.compute.amazonaws.com. (See Amazon EC2 Instance IP Addressing.)
When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP address.
- Returns:
- The DNS identifier assigned to the instance that is running the game session. Values have the following
format:
-
TLS-enabled fleets:
<unique identifier>.<region identifier>.amazongamelift.com. -
Non-TLS-enabled fleets:
ec2-<unique identifier>.compute.amazonaws.com. (See Amazon EC2 Instance IP Addressing.)
When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP address.
-
-
-
port
The port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and port number.
- Returns:
- The port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and port number.
-
playerSessionCreationPolicy
Indicates whether or not the game session is accepting new players.
If the service returns an enum value that is not available in the current SDK version,
playerSessionCreationPolicywill returnPlayerSessionCreationPolicy.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromplayerSessionCreationPolicyAsString().- Returns:
- Indicates whether or not the game session is accepting new players.
- See Also:
-
playerSessionCreationPolicyAsString
Indicates whether or not the game session is accepting new players.
If the service returns an enum value that is not available in the current SDK version,
playerSessionCreationPolicywill returnPlayerSessionCreationPolicy.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromplayerSessionCreationPolicyAsString().- Returns:
- Indicates whether or not the game session is accepting new players.
- See Also:
-
creatorId
A unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), that limits the number of game sessions a player can create.
- Returns:
- A unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), that limits the number of game sessions a player can create.
-
gameSessionData
A set of custom game session properties, formatted as a single string value. This data is passed to a game server process with a request to start a new game session (see Start a Game Session).
- Returns:
- A set of custom game session properties, formatted as a single string value. This data is passed to a game server process with a request to start a new game session (see Start a Game Session).
-
matchmakerData
Information about the matchmaking process that resulted in the game session, if matchmaking was used. Data is in JSON syntax, formatted as a string. Information includes the matchmaker ID as well as player attributes and team assignments. For more details on matchmaker data, see Match Data. Matchmaker data is updated whenever new players are added during a successful backfill (see StartMatchBackfill).
- Returns:
- Information about the matchmaking process that resulted in the game session, if matchmaking was used. Data is in JSON syntax, formatted as a string. Information includes the matchmaker ID as well as player attributes and team assignments. For more details on matchmaker data, see Match Data. Matchmaker data is updated whenever new players are added during a successful backfill (see StartMatchBackfill).
-
location
The fleet location where the game session is running. This value might specify the fleet's home Region or a remote location. Location is expressed as an Amazon Web Services Region code such as
us-west-2.- Returns:
- The fleet location where the game session is running. This value might specify the fleet's home Region or
a remote location. Location is expressed as an Amazon Web Services Region code such as
us-west-2.
-
toBuilder
Description copied from interface:ToCopyableBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToCopyableBuilder<GameSession.Builder,GameSession> - Returns:
- a builder for type T
-
builder
-
serializableBuilderClass
-
hashCode
-
equals
-
equalsBySdkFields
Description copied from interface:SdkPojoIndicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in anSdkPojoclass, and is generated based on a service model.If an
SdkPojoclass does not have any inherited fields,equalsBySdkFieldsandequalsare essentially the same.- Specified by:
equalsBySdkFieldsin interfaceSdkPojo- Parameters:
obj- the object to be compared with- Returns:
- true if the other object equals to this object by sdk fields, false otherwise.
-
toString
-
getValueForField
-
sdkFields
-