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
-
Method Summary
Modifier and TypeMethodDescriptionstatic GameSession.Builder
builder()
final Instant
A time stamp indicating when this data object was created.final String
A unique identifier for a player.final Integer
Number of players currently in the game session.final String
dnsName()
The DNS identifier assigned to the instance that is running the game session.final boolean
final boolean
equalsBySdkFields
(Object obj) Indicates whether some other object is "equal to" this one by SDK fields.final String
fleetArn()
The Amazon Resource Name (ARN) associated with the GameLift fleet that this game session is running on.final String
fleetId()
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 String
A set of custom game session properties, formatted as a single string value.final String
A unique identifier for the game session.final <T> Optional
<T> getValueForField
(String fieldName, Class<T> clazz) final boolean
For responses, this returns true if the service returned a value for the GameProperties property.final int
hashCode()
final String
The IP address of the game session.final String
location()
The fleet location where the game session is running.final String
Information about the matchmaking process that resulted in the game session, if matchmaking was used.final Integer
The maximum number of players that can be connected simultaneously to the game session.final String
name()
A descriptive label that is associated with a game session.Indicates whether or not the game session is accepting new players.final String
Indicates whether or not the game session is accepting new players.final Integer
port()
The port number for the game session.static Class
<? extends GameSession.Builder> final GameSessionStatus
status()
Current status of the game session.final String
Current status of the game session.final GameSessionStatusReason
Provides additional information about game session status.final String
Provides additional information about game session status.final Instant
A 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 String
toString()
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
The Amazon Resource Name (ARN) associated with the GameLift fleet that this game session is running on.
- Returns:
- The Amazon Resource Name (ARN) associated with the GameLift fleet that this game session is running on.
-
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
ACTIVE
status to have player sessions.If the service returns an enum value that is not available in the current SDK version,
status
will 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
ACTIVE
status to have player sessions. - See Also:
-
statusAsString
Current status of the game session. A game session must have an
ACTIVE
status to have player sessions.If the service returns an enum value that is not available in the current SDK version,
status
will 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
ACTIVE
status to have player sessions. - See Also:
-
statusReason
Provides additional information about game session status.
INTERRUPTED
indicates 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,
statusReason
will returnGameSessionStatusReason.UNKNOWN_TO_SDK_VERSION
. The raw value returned by the service is available fromstatusReasonAsString()
.- Returns:
- Provides additional information about game session status.
INTERRUPTED
indicates 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.
INTERRUPTED
indicates 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,
statusReason
will returnGameSessionStatusReason.UNKNOWN_TO_SDK_VERSION
. The raw value returned by the service is available fromstatusReasonAsString()
.- Returns:
- Provides additional information about game session status.
INTERRUPTED
indicates 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,
playerSessionCreationPolicy
will 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,
playerSessionCreationPolicy
will 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:ToCopyableBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToCopyableBuilder<GameSession.Builder,
GameSession> - Returns:
- a builder for type T
-
builder
-
serializableBuilderClass
-
hashCode
public final int hashCode() -
equals
-
equalsBySdkFields
Description copied from interface:SdkPojo
Indicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in anSdkPojo
class, and is generated based on a service model.If an
SdkPojo
class does not have any inherited fields,equalsBySdkFields
andequals
are essentially the same.- Specified by:
equalsBySdkFields
in 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
Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value. -
getValueForField
-
sdkFields
-