{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.StartGameSessionPlacement
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Places a request for a new game session in a queue. When processing a
-- placement request, Amazon GameLift searches for available resources on
-- the queue\'s destinations, scanning each until it finds resources or the
-- placement request times out.
--
-- A game session placement request can also request player sessions. When
-- a new game session is successfully created, Amazon GameLift creates a
-- player session for each player included in the request.
--
-- When placing a game session, by default Amazon GameLift tries each fleet
-- in the order they are listed in the queue configuration. Ideally, a
-- queue\'s destinations are listed in preference order.
--
-- Alternatively, when requesting a game session with players, you can also
-- provide latency data for each player in relevant Regions. Latency data
-- indicates the performance lag a player experiences when connected to a
-- fleet in the Region. Amazon GameLift uses latency data to reorder the
-- list of destinations to place the game session in a Region with minimal
-- lag. If latency data is provided for multiple players, Amazon GameLift
-- calculates each Region\'s average lag for all players and reorders to
-- get the best game play across all players.
--
-- To place a new game session request, specify the following:
--
-- -   The queue name and a set of game session properties and settings
--
-- -   A unique ID (such as a UUID) for the placement. You use this ID to
--     track the status of the placement request
--
-- -   (Optional) A set of player data and a unique player ID for each
--     player that you are joining to the new game session (player data is
--     optional, but if you include it, you must also provide a unique ID
--     for each player)
--
-- -   Latency data for all players (if you want to optimize game play for
--     the players)
--
-- If successful, a new game session placement is created.
--
-- To track the status of a placement request, call
-- <https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeGameSessionPlacement.html DescribeGameSessionPlacement>
-- and check the request\'s status. If the status is @FULFILLED@, a new
-- game session has been created and a game session ARN and Region are
-- referenced. If the placement request times out, you can resubmit the
-- request or retry it with a different queue.
module Amazonka.GameLift.StartGameSessionPlacement
  ( -- * Creating a Request
    StartGameSessionPlacement (..),
    newStartGameSessionPlacement,

    -- * Request Lenses
    startGameSessionPlacement_desiredPlayerSessions,
    startGameSessionPlacement_gameProperties,
    startGameSessionPlacement_gameSessionData,
    startGameSessionPlacement_gameSessionName,
    startGameSessionPlacement_playerLatencies,
    startGameSessionPlacement_placementId,
    startGameSessionPlacement_gameSessionQueueName,
    startGameSessionPlacement_maximumPlayerSessionCount,

    -- * Destructuring the Response
    StartGameSessionPlacementResponse (..),
    newStartGameSessionPlacementResponse,

    -- * Response Lenses
    startGameSessionPlacementResponse_gameSessionPlacement,
    startGameSessionPlacementResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStartGameSessionPlacement' smart constructor.
data StartGameSessionPlacement = StartGameSessionPlacement'
  { -- | Set of information on each player to create a player session for.
    StartGameSessionPlacement -> Maybe [DesiredPlayerSession]
desiredPlayerSessions :: Prelude.Maybe [DesiredPlayerSession],
    -- | A set of custom properties for a game session, formatted as key:value
    -- pairs. These properties are passed to a game server process with a
    -- request to start a new game session (see
    -- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession Start a Game Session>).
    StartGameSessionPlacement -> Maybe [GameProperty]
gameProperties :: Prelude.Maybe [GameProperty],
    -- | A set of custom game session properties, formatted as a single string
    -- value. This data is passed to a game server process in the @GameSession@
    -- object with a request to start a new game session (see
    -- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession Start a Game Session>).
    StartGameSessionPlacement -> Maybe Text
gameSessionData :: Prelude.Maybe Prelude.Text,
    -- | A descriptive label that is associated with a game session. Session
    -- names do not need to be unique.
    StartGameSessionPlacement -> Maybe Text
gameSessionName :: Prelude.Maybe Prelude.Text,
    -- | A set of values, expressed in milliseconds, that indicates the amount of
    -- latency that a player experiences when connected to Amazon Web Services
    -- Regions. This information is used to try to place the new game session
    -- where it can offer the best possible gameplay experience for the
    -- players.
    StartGameSessionPlacement -> Maybe [PlayerLatency]
playerLatencies :: Prelude.Maybe [PlayerLatency],
    -- | A unique identifier to assign to the new game session placement. This
    -- value is developer-defined. The value must be unique across all Regions
    -- and cannot be reused.
    StartGameSessionPlacement -> Text
placementId :: Prelude.Text,
    -- | Name of the queue to use to place the new game session. You can use
    -- either the queue name or ARN value.
    StartGameSessionPlacement -> Text
gameSessionQueueName :: Prelude.Text,
    -- | The maximum number of players that can be connected simultaneously to
    -- the game session.
    StartGameSessionPlacement -> Natural
maximumPlayerSessionCount :: Prelude.Natural
  }
  deriving (StartGameSessionPlacement -> StartGameSessionPlacement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartGameSessionPlacement -> StartGameSessionPlacement -> Bool
$c/= :: StartGameSessionPlacement -> StartGameSessionPlacement -> Bool
== :: StartGameSessionPlacement -> StartGameSessionPlacement -> Bool
$c== :: StartGameSessionPlacement -> StartGameSessionPlacement -> Bool
Prelude.Eq, ReadPrec [StartGameSessionPlacement]
ReadPrec StartGameSessionPlacement
Int -> ReadS StartGameSessionPlacement
ReadS [StartGameSessionPlacement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartGameSessionPlacement]
$creadListPrec :: ReadPrec [StartGameSessionPlacement]
readPrec :: ReadPrec StartGameSessionPlacement
$creadPrec :: ReadPrec StartGameSessionPlacement
readList :: ReadS [StartGameSessionPlacement]
$creadList :: ReadS [StartGameSessionPlacement]
readsPrec :: Int -> ReadS StartGameSessionPlacement
$creadsPrec :: Int -> ReadS StartGameSessionPlacement
Prelude.Read, Int -> StartGameSessionPlacement -> ShowS
[StartGameSessionPlacement] -> ShowS
StartGameSessionPlacement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartGameSessionPlacement] -> ShowS
$cshowList :: [StartGameSessionPlacement] -> ShowS
show :: StartGameSessionPlacement -> String
$cshow :: StartGameSessionPlacement -> String
showsPrec :: Int -> StartGameSessionPlacement -> ShowS
$cshowsPrec :: Int -> StartGameSessionPlacement -> ShowS
Prelude.Show, forall x.
Rep StartGameSessionPlacement x -> StartGameSessionPlacement
forall x.
StartGameSessionPlacement -> Rep StartGameSessionPlacement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartGameSessionPlacement x -> StartGameSessionPlacement
$cfrom :: forall x.
StartGameSessionPlacement -> Rep StartGameSessionPlacement x
Prelude.Generic)

-- |
-- Create a value of 'StartGameSessionPlacement' 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:
--
-- 'desiredPlayerSessions', 'startGameSessionPlacement_desiredPlayerSessions' - Set of information on each player to create a player session for.
--
-- 'gameProperties', 'startGameSessionPlacement_gameProperties' - A set of custom properties for a game session, formatted as key:value
-- pairs. These properties are passed to a game server process with a
-- request to start a new game session (see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession Start a Game Session>).
--
-- 'gameSessionData', 'startGameSessionPlacement_gameSessionData' - A set of custom game session properties, formatted as a single string
-- value. This data is passed to a game server process in the @GameSession@
-- object with a request to start a new game session (see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession Start a Game Session>).
--
-- 'gameSessionName', 'startGameSessionPlacement_gameSessionName' - A descriptive label that is associated with a game session. Session
-- names do not need to be unique.
--
-- 'playerLatencies', 'startGameSessionPlacement_playerLatencies' - A set of values, expressed in milliseconds, that indicates the amount of
-- latency that a player experiences when connected to Amazon Web Services
-- Regions. This information is used to try to place the new game session
-- where it can offer the best possible gameplay experience for the
-- players.
--
-- 'placementId', 'startGameSessionPlacement_placementId' - A unique identifier to assign to the new game session placement. This
-- value is developer-defined. The value must be unique across all Regions
-- and cannot be reused.
--
-- 'gameSessionQueueName', 'startGameSessionPlacement_gameSessionQueueName' - Name of the queue to use to place the new game session. You can use
-- either the queue name or ARN value.
--
-- 'maximumPlayerSessionCount', 'startGameSessionPlacement_maximumPlayerSessionCount' - The maximum number of players that can be connected simultaneously to
-- the game session.
newStartGameSessionPlacement ::
  -- | 'placementId'
  Prelude.Text ->
  -- | 'gameSessionQueueName'
  Prelude.Text ->
  -- | 'maximumPlayerSessionCount'
  Prelude.Natural ->
  StartGameSessionPlacement
newStartGameSessionPlacement :: Text -> Text -> Natural -> StartGameSessionPlacement
newStartGameSessionPlacement
  Text
pPlacementId_
  Text
pGameSessionQueueName_
  Natural
pMaximumPlayerSessionCount_ =
    StartGameSessionPlacement'
      { $sel:desiredPlayerSessions:StartGameSessionPlacement' :: Maybe [DesiredPlayerSession]
desiredPlayerSessions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:gameProperties:StartGameSessionPlacement' :: Maybe [GameProperty]
gameProperties = forall a. Maybe a
Prelude.Nothing,
        $sel:gameSessionData:StartGameSessionPlacement' :: Maybe Text
gameSessionData = forall a. Maybe a
Prelude.Nothing,
        $sel:gameSessionName:StartGameSessionPlacement' :: Maybe Text
gameSessionName = forall a. Maybe a
Prelude.Nothing,
        $sel:playerLatencies:StartGameSessionPlacement' :: Maybe [PlayerLatency]
playerLatencies = forall a. Maybe a
Prelude.Nothing,
        $sel:placementId:StartGameSessionPlacement' :: Text
placementId = Text
pPlacementId_,
        $sel:gameSessionQueueName:StartGameSessionPlacement' :: Text
gameSessionQueueName = Text
pGameSessionQueueName_,
        $sel:maximumPlayerSessionCount:StartGameSessionPlacement' :: Natural
maximumPlayerSessionCount =
          Natural
pMaximumPlayerSessionCount_
      }

-- | Set of information on each player to create a player session for.
startGameSessionPlacement_desiredPlayerSessions :: Lens.Lens' StartGameSessionPlacement (Prelude.Maybe [DesiredPlayerSession])
startGameSessionPlacement_desiredPlayerSessions :: Lens' StartGameSessionPlacement (Maybe [DesiredPlayerSession])
startGameSessionPlacement_desiredPlayerSessions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Maybe [DesiredPlayerSession]
desiredPlayerSessions :: Maybe [DesiredPlayerSession]
$sel:desiredPlayerSessions:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [DesiredPlayerSession]
desiredPlayerSessions} -> Maybe [DesiredPlayerSession]
desiredPlayerSessions) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Maybe [DesiredPlayerSession]
a -> StartGameSessionPlacement
s {$sel:desiredPlayerSessions:StartGameSessionPlacement' :: Maybe [DesiredPlayerSession]
desiredPlayerSessions = Maybe [DesiredPlayerSession]
a} :: StartGameSessionPlacement) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A set of custom properties for a game session, formatted as key:value
-- pairs. These properties are passed to a game server process with a
-- request to start a new game session (see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession Start a Game Session>).
startGameSessionPlacement_gameProperties :: Lens.Lens' StartGameSessionPlacement (Prelude.Maybe [GameProperty])
startGameSessionPlacement_gameProperties :: Lens' StartGameSessionPlacement (Maybe [GameProperty])
startGameSessionPlacement_gameProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Maybe [GameProperty]
gameProperties :: Maybe [GameProperty]
$sel:gameProperties:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [GameProperty]
gameProperties} -> Maybe [GameProperty]
gameProperties) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Maybe [GameProperty]
a -> StartGameSessionPlacement
s {$sel:gameProperties:StartGameSessionPlacement' :: Maybe [GameProperty]
gameProperties = Maybe [GameProperty]
a} :: StartGameSessionPlacement) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A set of custom game session properties, formatted as a single string
-- value. This data is passed to a game server process in the @GameSession@
-- object with a request to start a new game session (see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession Start a Game Session>).
startGameSessionPlacement_gameSessionData :: Lens.Lens' StartGameSessionPlacement (Prelude.Maybe Prelude.Text)
startGameSessionPlacement_gameSessionData :: Lens' StartGameSessionPlacement (Maybe Text)
startGameSessionPlacement_gameSessionData = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Maybe Text
gameSessionData :: Maybe Text
$sel:gameSessionData:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
gameSessionData} -> Maybe Text
gameSessionData) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Maybe Text
a -> StartGameSessionPlacement
s {$sel:gameSessionData:StartGameSessionPlacement' :: Maybe Text
gameSessionData = Maybe Text
a} :: StartGameSessionPlacement)

-- | A descriptive label that is associated with a game session. Session
-- names do not need to be unique.
startGameSessionPlacement_gameSessionName :: Lens.Lens' StartGameSessionPlacement (Prelude.Maybe Prelude.Text)
startGameSessionPlacement_gameSessionName :: Lens' StartGameSessionPlacement (Maybe Text)
startGameSessionPlacement_gameSessionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Maybe Text
gameSessionName :: Maybe Text
$sel:gameSessionName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
gameSessionName} -> Maybe Text
gameSessionName) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Maybe Text
a -> StartGameSessionPlacement
s {$sel:gameSessionName:StartGameSessionPlacement' :: Maybe Text
gameSessionName = Maybe Text
a} :: StartGameSessionPlacement)

-- | A set of values, expressed in milliseconds, that indicates the amount of
-- latency that a player experiences when connected to Amazon Web Services
-- Regions. This information is used to try to place the new game session
-- where it can offer the best possible gameplay experience for the
-- players.
startGameSessionPlacement_playerLatencies :: Lens.Lens' StartGameSessionPlacement (Prelude.Maybe [PlayerLatency])
startGameSessionPlacement_playerLatencies :: Lens' StartGameSessionPlacement (Maybe [PlayerLatency])
startGameSessionPlacement_playerLatencies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Maybe [PlayerLatency]
playerLatencies :: Maybe [PlayerLatency]
$sel:playerLatencies:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [PlayerLatency]
playerLatencies} -> Maybe [PlayerLatency]
playerLatencies) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Maybe [PlayerLatency]
a -> StartGameSessionPlacement
s {$sel:playerLatencies:StartGameSessionPlacement' :: Maybe [PlayerLatency]
playerLatencies = Maybe [PlayerLatency]
a} :: StartGameSessionPlacement) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique identifier to assign to the new game session placement. This
-- value is developer-defined. The value must be unique across all Regions
-- and cannot be reused.
startGameSessionPlacement_placementId :: Lens.Lens' StartGameSessionPlacement Prelude.Text
startGameSessionPlacement_placementId :: Lens' StartGameSessionPlacement Text
startGameSessionPlacement_placementId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Text
placementId :: Text
$sel:placementId:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
placementId} -> Text
placementId) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Text
a -> StartGameSessionPlacement
s {$sel:placementId:StartGameSessionPlacement' :: Text
placementId = Text
a} :: StartGameSessionPlacement)

-- | Name of the queue to use to place the new game session. You can use
-- either the queue name or ARN value.
startGameSessionPlacement_gameSessionQueueName :: Lens.Lens' StartGameSessionPlacement Prelude.Text
startGameSessionPlacement_gameSessionQueueName :: Lens' StartGameSessionPlacement Text
startGameSessionPlacement_gameSessionQueueName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Text
gameSessionQueueName :: Text
$sel:gameSessionQueueName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
gameSessionQueueName} -> Text
gameSessionQueueName) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Text
a -> StartGameSessionPlacement
s {$sel:gameSessionQueueName:StartGameSessionPlacement' :: Text
gameSessionQueueName = Text
a} :: StartGameSessionPlacement)

-- | The maximum number of players that can be connected simultaneously to
-- the game session.
startGameSessionPlacement_maximumPlayerSessionCount :: Lens.Lens' StartGameSessionPlacement Prelude.Natural
startGameSessionPlacement_maximumPlayerSessionCount :: Lens' StartGameSessionPlacement Natural
startGameSessionPlacement_maximumPlayerSessionCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacement' {Natural
maximumPlayerSessionCount :: Natural
$sel:maximumPlayerSessionCount:StartGameSessionPlacement' :: StartGameSessionPlacement -> Natural
maximumPlayerSessionCount} -> Natural
maximumPlayerSessionCount) (\s :: StartGameSessionPlacement
s@StartGameSessionPlacement' {} Natural
a -> StartGameSessionPlacement
s {$sel:maximumPlayerSessionCount:StartGameSessionPlacement' :: Natural
maximumPlayerSessionCount = Natural
a} :: StartGameSessionPlacement)

instance Core.AWSRequest StartGameSessionPlacement where
  type
    AWSResponse StartGameSessionPlacement =
      StartGameSessionPlacementResponse
  request :: (Service -> Service)
-> StartGameSessionPlacement -> Request StartGameSessionPlacement
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartGameSessionPlacement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartGameSessionPlacement)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe GameSessionPlacement
-> Int -> StartGameSessionPlacementResponse
StartGameSessionPlacementResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"GameSessionPlacement")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartGameSessionPlacement where
  hashWithSalt :: Int -> StartGameSessionPlacement -> Int
hashWithSalt Int
_salt StartGameSessionPlacement' {Natural
Maybe [DesiredPlayerSession]
Maybe [GameProperty]
Maybe [PlayerLatency]
Maybe Text
Text
maximumPlayerSessionCount :: Natural
gameSessionQueueName :: Text
placementId :: Text
playerLatencies :: Maybe [PlayerLatency]
gameSessionName :: Maybe Text
gameSessionData :: Maybe Text
gameProperties :: Maybe [GameProperty]
desiredPlayerSessions :: Maybe [DesiredPlayerSession]
$sel:maximumPlayerSessionCount:StartGameSessionPlacement' :: StartGameSessionPlacement -> Natural
$sel:gameSessionQueueName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
$sel:placementId:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
$sel:playerLatencies:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [PlayerLatency]
$sel:gameSessionName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
$sel:gameSessionData:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
$sel:gameProperties:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [GameProperty]
$sel:desiredPlayerSessions:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [DesiredPlayerSession]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DesiredPlayerSession]
desiredPlayerSessions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GameProperty]
gameProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gameSessionData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gameSessionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PlayerLatency]
playerLatencies
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
placementId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameSessionQueueName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maximumPlayerSessionCount

instance Prelude.NFData StartGameSessionPlacement where
  rnf :: StartGameSessionPlacement -> ()
rnf StartGameSessionPlacement' {Natural
Maybe [DesiredPlayerSession]
Maybe [GameProperty]
Maybe [PlayerLatency]
Maybe Text
Text
maximumPlayerSessionCount :: Natural
gameSessionQueueName :: Text
placementId :: Text
playerLatencies :: Maybe [PlayerLatency]
gameSessionName :: Maybe Text
gameSessionData :: Maybe Text
gameProperties :: Maybe [GameProperty]
desiredPlayerSessions :: Maybe [DesiredPlayerSession]
$sel:maximumPlayerSessionCount:StartGameSessionPlacement' :: StartGameSessionPlacement -> Natural
$sel:gameSessionQueueName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
$sel:placementId:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
$sel:playerLatencies:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [PlayerLatency]
$sel:gameSessionName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
$sel:gameSessionData:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
$sel:gameProperties:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [GameProperty]
$sel:desiredPlayerSessions:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [DesiredPlayerSession]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DesiredPlayerSession]
desiredPlayerSessions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [GameProperty]
gameProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gameSessionData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gameSessionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PlayerLatency]
playerLatencies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
placementId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gameSessionQueueName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maximumPlayerSessionCount

instance Data.ToHeaders StartGameSessionPlacement where
  toHeaders :: StartGameSessionPlacement -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"GameLift.StartGameSessionPlacement" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StartGameSessionPlacement where
  toJSON :: StartGameSessionPlacement -> Value
toJSON StartGameSessionPlacement' {Natural
Maybe [DesiredPlayerSession]
Maybe [GameProperty]
Maybe [PlayerLatency]
Maybe Text
Text
maximumPlayerSessionCount :: Natural
gameSessionQueueName :: Text
placementId :: Text
playerLatencies :: Maybe [PlayerLatency]
gameSessionName :: Maybe Text
gameSessionData :: Maybe Text
gameProperties :: Maybe [GameProperty]
desiredPlayerSessions :: Maybe [DesiredPlayerSession]
$sel:maximumPlayerSessionCount:StartGameSessionPlacement' :: StartGameSessionPlacement -> Natural
$sel:gameSessionQueueName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
$sel:placementId:StartGameSessionPlacement' :: StartGameSessionPlacement -> Text
$sel:playerLatencies:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [PlayerLatency]
$sel:gameSessionName:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
$sel:gameSessionData:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe Text
$sel:gameProperties:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [GameProperty]
$sel:desiredPlayerSessions:StartGameSessionPlacement' :: StartGameSessionPlacement -> Maybe [DesiredPlayerSession]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DesiredPlayerSessions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DesiredPlayerSession]
desiredPlayerSessions,
            (Key
"GameProperties" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GameProperty]
gameProperties,
            (Key
"GameSessionData" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
gameSessionData,
            (Key
"GameSessionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
gameSessionName,
            (Key
"PlayerLatencies" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PlayerLatency]
playerLatencies,
            forall a. a -> Maybe a
Prelude.Just (Key
"PlacementId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
placementId),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"GameSessionQueueName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gameSessionQueueName
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"MaximumPlayerSessionCount"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maximumPlayerSessionCount
              )
          ]
      )

instance Data.ToPath StartGameSessionPlacement where
  toPath :: StartGameSessionPlacement -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery StartGameSessionPlacement where
  toQuery :: StartGameSessionPlacement -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartGameSessionPlacementResponse' smart constructor.
data StartGameSessionPlacementResponse = StartGameSessionPlacementResponse'
  { -- | Object that describes the newly created game session placement. This
    -- object includes all the information provided in the request, as well as
    -- start\/end time stamps and placement status.
    StartGameSessionPlacementResponse -> Maybe GameSessionPlacement
gameSessionPlacement :: Prelude.Maybe GameSessionPlacement,
    -- | The response's http status code.
    StartGameSessionPlacementResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartGameSessionPlacementResponse
-> StartGameSessionPlacementResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartGameSessionPlacementResponse
-> StartGameSessionPlacementResponse -> Bool
$c/= :: StartGameSessionPlacementResponse
-> StartGameSessionPlacementResponse -> Bool
== :: StartGameSessionPlacementResponse
-> StartGameSessionPlacementResponse -> Bool
$c== :: StartGameSessionPlacementResponse
-> StartGameSessionPlacementResponse -> Bool
Prelude.Eq, ReadPrec [StartGameSessionPlacementResponse]
ReadPrec StartGameSessionPlacementResponse
Int -> ReadS StartGameSessionPlacementResponse
ReadS [StartGameSessionPlacementResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartGameSessionPlacementResponse]
$creadListPrec :: ReadPrec [StartGameSessionPlacementResponse]
readPrec :: ReadPrec StartGameSessionPlacementResponse
$creadPrec :: ReadPrec StartGameSessionPlacementResponse
readList :: ReadS [StartGameSessionPlacementResponse]
$creadList :: ReadS [StartGameSessionPlacementResponse]
readsPrec :: Int -> ReadS StartGameSessionPlacementResponse
$creadsPrec :: Int -> ReadS StartGameSessionPlacementResponse
Prelude.Read, Int -> StartGameSessionPlacementResponse -> ShowS
[StartGameSessionPlacementResponse] -> ShowS
StartGameSessionPlacementResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartGameSessionPlacementResponse] -> ShowS
$cshowList :: [StartGameSessionPlacementResponse] -> ShowS
show :: StartGameSessionPlacementResponse -> String
$cshow :: StartGameSessionPlacementResponse -> String
showsPrec :: Int -> StartGameSessionPlacementResponse -> ShowS
$cshowsPrec :: Int -> StartGameSessionPlacementResponse -> ShowS
Prelude.Show, forall x.
Rep StartGameSessionPlacementResponse x
-> StartGameSessionPlacementResponse
forall x.
StartGameSessionPlacementResponse
-> Rep StartGameSessionPlacementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartGameSessionPlacementResponse x
-> StartGameSessionPlacementResponse
$cfrom :: forall x.
StartGameSessionPlacementResponse
-> Rep StartGameSessionPlacementResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartGameSessionPlacementResponse' 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:
--
-- 'gameSessionPlacement', 'startGameSessionPlacementResponse_gameSessionPlacement' - Object that describes the newly created game session placement. This
-- object includes all the information provided in the request, as well as
-- start\/end time stamps and placement status.
--
-- 'httpStatus', 'startGameSessionPlacementResponse_httpStatus' - The response's http status code.
newStartGameSessionPlacementResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartGameSessionPlacementResponse
newStartGameSessionPlacementResponse :: Int -> StartGameSessionPlacementResponse
newStartGameSessionPlacementResponse Int
pHttpStatus_ =
  StartGameSessionPlacementResponse'
    { $sel:gameSessionPlacement:StartGameSessionPlacementResponse' :: Maybe GameSessionPlacement
gameSessionPlacement =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartGameSessionPlacementResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Object that describes the newly created game session placement. This
-- object includes all the information provided in the request, as well as
-- start\/end time stamps and placement status.
startGameSessionPlacementResponse_gameSessionPlacement :: Lens.Lens' StartGameSessionPlacementResponse (Prelude.Maybe GameSessionPlacement)
startGameSessionPlacementResponse_gameSessionPlacement :: Lens'
  StartGameSessionPlacementResponse (Maybe GameSessionPlacement)
startGameSessionPlacementResponse_gameSessionPlacement = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacementResponse' {Maybe GameSessionPlacement
gameSessionPlacement :: Maybe GameSessionPlacement
$sel:gameSessionPlacement:StartGameSessionPlacementResponse' :: StartGameSessionPlacementResponse -> Maybe GameSessionPlacement
gameSessionPlacement} -> Maybe GameSessionPlacement
gameSessionPlacement) (\s :: StartGameSessionPlacementResponse
s@StartGameSessionPlacementResponse' {} Maybe GameSessionPlacement
a -> StartGameSessionPlacementResponse
s {$sel:gameSessionPlacement:StartGameSessionPlacementResponse' :: Maybe GameSessionPlacement
gameSessionPlacement = Maybe GameSessionPlacement
a} :: StartGameSessionPlacementResponse)

-- | The response's http status code.
startGameSessionPlacementResponse_httpStatus :: Lens.Lens' StartGameSessionPlacementResponse Prelude.Int
startGameSessionPlacementResponse_httpStatus :: Lens' StartGameSessionPlacementResponse Int
startGameSessionPlacementResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartGameSessionPlacementResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartGameSessionPlacementResponse' :: StartGameSessionPlacementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartGameSessionPlacementResponse
s@StartGameSessionPlacementResponse' {} Int
a -> StartGameSessionPlacementResponse
s {$sel:httpStatus:StartGameSessionPlacementResponse' :: Int
httpStatus = Int
a} :: StartGameSessionPlacementResponse)

instance
  Prelude.NFData
    StartGameSessionPlacementResponse
  where
  rnf :: StartGameSessionPlacementResponse -> ()
rnf StartGameSessionPlacementResponse' {Int
Maybe GameSessionPlacement
httpStatus :: Int
gameSessionPlacement :: Maybe GameSessionPlacement
$sel:httpStatus:StartGameSessionPlacementResponse' :: StartGameSessionPlacementResponse -> Int
$sel:gameSessionPlacement:StartGameSessionPlacementResponse' :: StartGameSessionPlacementResponse -> Maybe GameSessionPlacement
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GameSessionPlacement
gameSessionPlacement
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus