{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GameLift.Types.PlayerSession
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GameLift.Types.PlayerSession where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.PlayerSessionStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a player session. Player sessions are created either for a
-- specific game session, or as part of a game session placement or
-- matchmaking request. A player session can represents a reserved player
-- slot in a game session (when status is @RESERVED@) or actual player
-- activity in a game session (when status is @ACTIVE@). A player session
-- object, including player data, is automatically passed to a game session
-- when the player connects to the game session and is validated. After the
-- game session ends, player sessions information is retained for 30 days
-- and then removed.
--
-- __Related actions__
--
-- CreatePlayerSession | CreatePlayerSessions | DescribePlayerSessions |
-- StartGameSessionPlacement | DescribeGameSessionPlacement |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newPlayerSession' smart constructor.
data PlayerSession = PlayerSession'
  { -- | A time stamp indicating when this data object was created. Format is a
    -- number expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    PlayerSession -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | Current status of the player session.
    --
    -- Possible player session statuses include the following:
    --
    -- -   __RESERVED__ -- The player session request has been received, but
    --     the player has not yet connected to the server process and\/or been
    --     validated.
    --
    -- -   __ACTIVE__ -- The player has been validated by the server process
    --     and is currently connected.
    --
    -- -   __COMPLETED__ -- The player connection has been dropped.
    --
    -- -   __TIMEDOUT__ -- A player session request was received, but the
    --     player did not connect and\/or was not validated within the timeout
    --     limit (60 seconds).
    PlayerSession -> Maybe PlayerSessionStatus
status :: Prelude.Maybe PlayerSessionStatus,
    -- | The IP address of the game session. To connect to a GameLift game
    -- server, an app needs both the IP address and port number.
    PlayerSession -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the game session that the player session is
    -- connected to.
    PlayerSession -> Maybe Text
gameSessionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- associated with the GameLift fleet that the player\'s game session is
    -- running on.
    PlayerSession -> Maybe Text
fleetArn :: Prelude.Maybe Prelude.Text,
    -- | A time stamp indicating when this data object was terminated. Format is
    -- a number expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    PlayerSession -> Maybe POSIX
terminationTime :: Prelude.Maybe Core.POSIX,
    -- | A unique identifier for a player session.
    PlayerSession -> Maybe Text
playerSessionId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the fleet that the player\'s game session is
    -- running on.
    PlayerSession -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | Developer-defined information related to a player. GameLift does not use
    -- this data, so it can be formatted as needed for use in the game.
    PlayerSession -> Maybe Text
playerData :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for a player that is associated with this player
    -- session.
    PlayerSession -> Maybe Text
playerId :: Prelude.Maybe Prelude.Text,
    -- | 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
    --     <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html#concepts-public-addresses 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.
    PlayerSession -> Maybe Text
dnsName :: Prelude.Maybe Prelude.Text,
    -- | Port number for the game session. To connect to a Amazon GameLift server
    -- process, an app needs both the IP address and port number.
    PlayerSession -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural
  }
  deriving (PlayerSession -> PlayerSession -> Bool
(PlayerSession -> PlayerSession -> Bool)
-> (PlayerSession -> PlayerSession -> Bool) -> Eq PlayerSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlayerSession -> PlayerSession -> Bool
$c/= :: PlayerSession -> PlayerSession -> Bool
== :: PlayerSession -> PlayerSession -> Bool
$c== :: PlayerSession -> PlayerSession -> Bool
Prelude.Eq, ReadPrec [PlayerSession]
ReadPrec PlayerSession
Int -> ReadS PlayerSession
ReadS [PlayerSession]
(Int -> ReadS PlayerSession)
-> ReadS [PlayerSession]
-> ReadPrec PlayerSession
-> ReadPrec [PlayerSession]
-> Read PlayerSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlayerSession]
$creadListPrec :: ReadPrec [PlayerSession]
readPrec :: ReadPrec PlayerSession
$creadPrec :: ReadPrec PlayerSession
readList :: ReadS [PlayerSession]
$creadList :: ReadS [PlayerSession]
readsPrec :: Int -> ReadS PlayerSession
$creadsPrec :: Int -> ReadS PlayerSession
Prelude.Read, Int -> PlayerSession -> ShowS
[PlayerSession] -> ShowS
PlayerSession -> String
(Int -> PlayerSession -> ShowS)
-> (PlayerSession -> String)
-> ([PlayerSession] -> ShowS)
-> Show PlayerSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlayerSession] -> ShowS
$cshowList :: [PlayerSession] -> ShowS
show :: PlayerSession -> String
$cshow :: PlayerSession -> String
showsPrec :: Int -> PlayerSession -> ShowS
$cshowsPrec :: Int -> PlayerSession -> ShowS
Prelude.Show, (forall x. PlayerSession -> Rep PlayerSession x)
-> (forall x. Rep PlayerSession x -> PlayerSession)
-> Generic PlayerSession
forall x. Rep PlayerSession x -> PlayerSession
forall x. PlayerSession -> Rep PlayerSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlayerSession x -> PlayerSession
$cfrom :: forall x. PlayerSession -> Rep PlayerSession x
Prelude.Generic)

-- |
-- Create a value of 'PlayerSession' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'creationTime', 'playerSession_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\"@).
--
-- 'status', 'playerSession_status' - Current status of the player session.
--
-- Possible player session statuses include the following:
--
-- -   __RESERVED__ -- The player session request has been received, but
--     the player has not yet connected to the server process and\/or been
--     validated.
--
-- -   __ACTIVE__ -- The player has been validated by the server process
--     and is currently connected.
--
-- -   __COMPLETED__ -- The player connection has been dropped.
--
-- -   __TIMEDOUT__ -- A player session request was received, but the
--     player did not connect and\/or was not validated within the timeout
--     limit (60 seconds).
--
-- 'ipAddress', 'playerSession_ipAddress' - The IP address of the game session. To connect to a GameLift game
-- server, an app needs both the IP address and port number.
--
-- 'gameSessionId', 'playerSession_gameSessionId' - A unique identifier for the game session that the player session is
-- connected to.
--
-- 'fleetArn', 'playerSession_fleetArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- associated with the GameLift fleet that the player\'s game session is
-- running on.
--
-- 'terminationTime', 'playerSession_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\"@).
--
-- 'playerSessionId', 'playerSession_playerSessionId' - A unique identifier for a player session.
--
-- 'fleetId', 'playerSession_fleetId' - A unique identifier for the fleet that the player\'s game session is
-- running on.
--
-- 'playerData', 'playerSession_playerData' - Developer-defined information related to a player. GameLift does not use
-- this data, so it can be formatted as needed for use in the game.
--
-- 'playerId', 'playerSession_playerId' - A unique identifier for a player that is associated with this player
-- session.
--
-- 'dnsName', 'playerSession_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
--     <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html#concepts-public-addresses 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', 'playerSession_port' - Port number for the game session. To connect to a Amazon GameLift server
-- process, an app needs both the IP address and port number.
newPlayerSession ::
  PlayerSession
newPlayerSession :: PlayerSession
newPlayerSession =
  PlayerSession' :: Maybe POSIX
-> Maybe PlayerSessionStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> PlayerSession
PlayerSession'
    { $sel:creationTime:PlayerSession' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:PlayerSession' :: Maybe PlayerSessionStatus
status = Maybe PlayerSessionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:PlayerSession' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gameSessionId:PlayerSession' :: Maybe Text
gameSessionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:PlayerSession' :: Maybe Text
fleetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:terminationTime:PlayerSession' :: Maybe POSIX
terminationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:playerSessionId:PlayerSession' :: Maybe Text
playerSessionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:PlayerSession' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:playerData:PlayerSession' :: Maybe Text
playerData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:playerId:PlayerSession' :: Maybe Text
playerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dnsName:PlayerSession' :: Maybe Text
dnsName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:port:PlayerSession' :: Maybe Natural
port = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A time stamp indicating when this data object was created. Format is a
-- number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
playerSession_creationTime :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.UTCTime)
playerSession_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PlayerSession -> f PlayerSession
playerSession_creationTime = (PlayerSession -> Maybe POSIX)
-> (PlayerSession -> Maybe POSIX -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:PlayerSession' :: PlayerSession -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: PlayerSession
s@PlayerSession' {} Maybe POSIX
a -> PlayerSession
s {$sel:creationTime:PlayerSession' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: PlayerSession) ((Maybe POSIX -> f (Maybe POSIX))
 -> PlayerSession -> f PlayerSession)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PlayerSession
-> f PlayerSession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Current status of the player session.
--
-- Possible player session statuses include the following:
--
-- -   __RESERVED__ -- The player session request has been received, but
--     the player has not yet connected to the server process and\/or been
--     validated.
--
-- -   __ACTIVE__ -- The player has been validated by the server process
--     and is currently connected.
--
-- -   __COMPLETED__ -- The player connection has been dropped.
--
-- -   __TIMEDOUT__ -- A player session request was received, but the
--     player did not connect and\/or was not validated within the timeout
--     limit (60 seconds).
playerSession_status :: Lens.Lens' PlayerSession (Prelude.Maybe PlayerSessionStatus)
playerSession_status :: (Maybe PlayerSessionStatus -> f (Maybe PlayerSessionStatus))
-> PlayerSession -> f PlayerSession
playerSession_status = (PlayerSession -> Maybe PlayerSessionStatus)
-> (PlayerSession -> Maybe PlayerSessionStatus -> PlayerSession)
-> Lens
     PlayerSession
     PlayerSession
     (Maybe PlayerSessionStatus)
     (Maybe PlayerSessionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe PlayerSessionStatus
status :: Maybe PlayerSessionStatus
$sel:status:PlayerSession' :: PlayerSession -> Maybe PlayerSessionStatus
status} -> Maybe PlayerSessionStatus
status) (\s :: PlayerSession
s@PlayerSession' {} Maybe PlayerSessionStatus
a -> PlayerSession
s {$sel:status:PlayerSession' :: Maybe PlayerSessionStatus
status = Maybe PlayerSessionStatus
a} :: PlayerSession)

-- | The IP address of the game session. To connect to a GameLift game
-- server, an app needs both the IP address and port number.
playerSession_ipAddress :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_ipAddress :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_ipAddress = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:PlayerSession' :: PlayerSession -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:ipAddress:PlayerSession' :: Maybe Text
ipAddress = Maybe Text
a} :: PlayerSession)

-- | A unique identifier for the game session that the player session is
-- connected to.
playerSession_gameSessionId :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_gameSessionId :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_gameSessionId = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
gameSessionId :: Maybe Text
$sel:gameSessionId:PlayerSession' :: PlayerSession -> Maybe Text
gameSessionId} -> Maybe Text
gameSessionId) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:gameSessionId:PlayerSession' :: Maybe Text
gameSessionId = Maybe Text
a} :: PlayerSession)

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- associated with the GameLift fleet that the player\'s game session is
-- running on.
playerSession_fleetArn :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_fleetArn :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_fleetArn = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
fleetArn :: Maybe Text
$sel:fleetArn:PlayerSession' :: PlayerSession -> Maybe Text
fleetArn} -> Maybe Text
fleetArn) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:fleetArn:PlayerSession' :: Maybe Text
fleetArn = Maybe Text
a} :: PlayerSession)

-- | A time stamp indicating when this data object was terminated. Format is
-- a number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
playerSession_terminationTime :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.UTCTime)
playerSession_terminationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PlayerSession -> f PlayerSession
playerSession_terminationTime = (PlayerSession -> Maybe POSIX)
-> (PlayerSession -> Maybe POSIX -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe POSIX
terminationTime :: Maybe POSIX
$sel:terminationTime:PlayerSession' :: PlayerSession -> Maybe POSIX
terminationTime} -> Maybe POSIX
terminationTime) (\s :: PlayerSession
s@PlayerSession' {} Maybe POSIX
a -> PlayerSession
s {$sel:terminationTime:PlayerSession' :: Maybe POSIX
terminationTime = Maybe POSIX
a} :: PlayerSession) ((Maybe POSIX -> f (Maybe POSIX))
 -> PlayerSession -> f PlayerSession)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PlayerSession
-> f PlayerSession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A unique identifier for a player session.
playerSession_playerSessionId :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_playerSessionId :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_playerSessionId = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
playerSessionId :: Maybe Text
$sel:playerSessionId:PlayerSession' :: PlayerSession -> Maybe Text
playerSessionId} -> Maybe Text
playerSessionId) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:playerSessionId:PlayerSession' :: Maybe Text
playerSessionId = Maybe Text
a} :: PlayerSession)

-- | A unique identifier for the fleet that the player\'s game session is
-- running on.
playerSession_fleetId :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_fleetId :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_fleetId = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:PlayerSession' :: PlayerSession -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:fleetId:PlayerSession' :: Maybe Text
fleetId = Maybe Text
a} :: PlayerSession)

-- | Developer-defined information related to a player. GameLift does not use
-- this data, so it can be formatted as needed for use in the game.
playerSession_playerData :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_playerData :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_playerData = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
playerData :: Maybe Text
$sel:playerData:PlayerSession' :: PlayerSession -> Maybe Text
playerData} -> Maybe Text
playerData) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:playerData:PlayerSession' :: Maybe Text
playerData = Maybe Text
a} :: PlayerSession)

-- | A unique identifier for a player that is associated with this player
-- session.
playerSession_playerId :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_playerId :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_playerId = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
playerId :: Maybe Text
$sel:playerId:PlayerSession' :: PlayerSession -> Maybe Text
playerId} -> Maybe Text
playerId) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:playerId:PlayerSession' :: Maybe Text
playerId = Maybe Text
a} :: PlayerSession)

-- | 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
--     <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html#concepts-public-addresses 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.
playerSession_dnsName :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Text)
playerSession_dnsName :: (Maybe Text -> f (Maybe Text)) -> PlayerSession -> f PlayerSession
playerSession_dnsName = (PlayerSession -> Maybe Text)
-> (PlayerSession -> Maybe Text -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Text
dnsName :: Maybe Text
$sel:dnsName:PlayerSession' :: PlayerSession -> Maybe Text
dnsName} -> Maybe Text
dnsName) (\s :: PlayerSession
s@PlayerSession' {} Maybe Text
a -> PlayerSession
s {$sel:dnsName:PlayerSession' :: Maybe Text
dnsName = Maybe Text
a} :: PlayerSession)

-- | Port number for the game session. To connect to a Amazon GameLift server
-- process, an app needs both the IP address and port number.
playerSession_port :: Lens.Lens' PlayerSession (Prelude.Maybe Prelude.Natural)
playerSession_port :: (Maybe Natural -> f (Maybe Natural))
-> PlayerSession -> f PlayerSession
playerSession_port = (PlayerSession -> Maybe Natural)
-> (PlayerSession -> Maybe Natural -> PlayerSession)
-> Lens PlayerSession PlayerSession (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerSession' {Maybe Natural
port :: Maybe Natural
$sel:port:PlayerSession' :: PlayerSession -> Maybe Natural
port} -> Maybe Natural
port) (\s :: PlayerSession
s@PlayerSession' {} Maybe Natural
a -> PlayerSession
s {$sel:port:PlayerSession' :: Maybe Natural
port = Maybe Natural
a} :: PlayerSession)

instance Core.FromJSON PlayerSession where
  parseJSON :: Value -> Parser PlayerSession
parseJSON =
    String
-> (Object -> Parser PlayerSession)
-> Value
-> Parser PlayerSession
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PlayerSession"
      ( \Object
x ->
          Maybe POSIX
-> Maybe PlayerSessionStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> PlayerSession
PlayerSession'
            (Maybe POSIX
 -> Maybe PlayerSessionStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Natural
 -> PlayerSession)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe PlayerSessionStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe PlayerSessionStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe PlayerSessionStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PlayerSessionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IpAddress")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GameSessionId")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FleetArn")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TerminationTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlayerSessionId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> PlayerSession)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Natural -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FleetId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Natural -> PlayerSession)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Natural -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlayerData")
            Parser (Maybe Text -> Maybe Text -> Maybe Natural -> PlayerSession)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Natural -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlayerId")
            Parser (Maybe Text -> Maybe Natural -> PlayerSession)
-> Parser (Maybe Text) -> Parser (Maybe Natural -> PlayerSession)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DnsName")
            Parser (Maybe Natural -> PlayerSession)
-> Parser (Maybe Natural) -> Parser PlayerSession
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Port")
      )

instance Prelude.Hashable PlayerSession

instance Prelude.NFData PlayerSession