java.lang.Object
software.amazon.awssdk.services.gamelift.model.GameSession
All Implemented Interfaces:
Serializable, SdkPojo, ToCopyableBuilder<GameSession.Builder,GameSession>

@Generated("software.amazon.awssdk:codegen") public final class GameSession extends Object implements SdkPojo, Serializable, 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.

All APIs by task

See Also:
  • Method Details

    • gameSessionId

      public final String 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

      public final String 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

      public final String 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

      public final String 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

      public final Instant 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

      public final Instant 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

      public final Integer currentPlayerSessionCount()

      Number of players currently in the game session.

      Returns:
      Number of players currently in the game session.
    • maximumPlayerSessionCount

      public final Integer 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

      public final GameSessionStatus 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 return GameSessionStatus.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from statusAsString().

      Returns:
      Current status of the game session. A game session must have an ACTIVE status to have player sessions.
      See Also:
    • statusAsString

      public final String 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 return GameSessionStatus.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from statusAsString().

      Returns:
      Current status of the game session. A game session must have an ACTIVE status to have player sessions.
      See Also:
    • statusReason

      public final GameSessionStatusReason 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 return GameSessionStatusReason.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from statusReasonAsString().

      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

      public final String 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 return GameSessionStatusReason.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from statusReasonAsString().

      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 the isEmpty() 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

      public final List<GameProperty> 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

      public final String 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

      public final String 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

      public final Integer 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

      public final PlayerSessionCreationPolicy 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 return PlayerSessionCreationPolicy.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from playerSessionCreationPolicyAsString().

      Returns:
      Indicates whether or not the game session is accepting new players.
      See Also:
    • playerSessionCreationPolicyAsString

      public final String 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 return PlayerSessionCreationPolicy.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from playerSessionCreationPolicyAsString().

      Returns:
      Indicates whether or not the game session is accepting new players.
      See Also:
    • creatorId

      public final String 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

      public final String 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

      public final String 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

      public final String 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

      public GameSession.Builder 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 interface ToCopyableBuilder<GameSession.Builder,GameSession>
      Returns:
      a builder for type T
    • builder

      public static GameSession.Builder builder()
    • serializableBuilderClass

      public static Class<? extends GameSession.Builder> serializableBuilderClass()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsBySdkFields

      public final boolean equalsBySdkFields(Object obj)
      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 an SdkPojo class, and is generated based on a service model.

      If an SdkPojo class does not have any inherited fields, equalsBySdkFields and equals are essentially the same.

      Specified by:
      equalsBySdkFields in interface SdkPojo
      Parameters:
      obj - the object to be compared with
      Returns:
      true if the other object equals to this object by sdk fields, false otherwise.
    • toString

      public final String 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.
      Overrides:
      toString in class Object
    • getValueForField

      public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
    • sdkFields

      public final List<SdkField<?>> sdkFields()
      Specified by:
      sdkFields in interface SdkPojo
      Returns:
      List of SdkField in this POJO. May be empty list but should never be null.