{-# 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.CreatePlayerSessions
-- 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)
--
-- Reserves open slots in a game session for a group of players. New player
-- sessions can be created in any game session with an open slot that is in
-- @ACTIVE@ status and has a player creation policy of @ACCEPT_ALL@. To add
-- a single player to a game session, use CreatePlayerSession.
--
-- To create player sessions, specify a game session ID and a list of
-- player IDs. Optionally, provide a set of player data for each player ID.
--
-- If successful, a slot is reserved in the game session for each player,
-- and new PlayerSession objects are returned with player session IDs. Each
-- player references their player session ID when sending a connection
-- request to the game session, and the game server can use it to validate
-- the player reservation with the GameLift service. Player sessions cannot
-- be updated.
--
-- /Available in Amazon GameLift Local./
--
-- __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>
module Amazonka.GameLift.CreatePlayerSessions
  ( -- * Creating a Request
    CreatePlayerSessions (..),
    newCreatePlayerSessions,

    -- * Request Lenses
    createPlayerSessions_playerDataMap,
    createPlayerSessions_gameSessionId,
    createPlayerSessions_playerIds,

    -- * Destructuring the Response
    CreatePlayerSessionsResponse (..),
    newCreatePlayerSessionsResponse,

    -- * Response Lenses
    createPlayerSessionsResponse_playerSessions,
    createPlayerSessionsResponse_httpStatus,
  )
where

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

-- | Represents the input for a request operation.
--
-- /See:/ 'newCreatePlayerSessions' smart constructor.
data CreatePlayerSessions = CreatePlayerSessions'
  { -- | Map of string pairs, each specifying a player ID and a set of
    -- developer-defined information related to the player. Amazon GameLift
    -- does not use this data, so it can be formatted as needed for use in the
    -- game. Any player data strings for player IDs that are not included in
    -- the @PlayerIds@ parameter are ignored.
    CreatePlayerSessions -> Maybe (HashMap Text Text)
playerDataMap :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A unique identifier for the game session to add players to.
    CreatePlayerSessions -> Text
gameSessionId :: Prelude.Text,
    -- | List of unique identifiers for the players to be added.
    CreatePlayerSessions -> NonEmpty Text
playerIds :: Prelude.NonEmpty Prelude.Text
  }
  deriving (CreatePlayerSessions -> CreatePlayerSessions -> Bool
(CreatePlayerSessions -> CreatePlayerSessions -> Bool)
-> (CreatePlayerSessions -> CreatePlayerSessions -> Bool)
-> Eq CreatePlayerSessions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePlayerSessions -> CreatePlayerSessions -> Bool
$c/= :: CreatePlayerSessions -> CreatePlayerSessions -> Bool
== :: CreatePlayerSessions -> CreatePlayerSessions -> Bool
$c== :: CreatePlayerSessions -> CreatePlayerSessions -> Bool
Prelude.Eq, ReadPrec [CreatePlayerSessions]
ReadPrec CreatePlayerSessions
Int -> ReadS CreatePlayerSessions
ReadS [CreatePlayerSessions]
(Int -> ReadS CreatePlayerSessions)
-> ReadS [CreatePlayerSessions]
-> ReadPrec CreatePlayerSessions
-> ReadPrec [CreatePlayerSessions]
-> Read CreatePlayerSessions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePlayerSessions]
$creadListPrec :: ReadPrec [CreatePlayerSessions]
readPrec :: ReadPrec CreatePlayerSessions
$creadPrec :: ReadPrec CreatePlayerSessions
readList :: ReadS [CreatePlayerSessions]
$creadList :: ReadS [CreatePlayerSessions]
readsPrec :: Int -> ReadS CreatePlayerSessions
$creadsPrec :: Int -> ReadS CreatePlayerSessions
Prelude.Read, Int -> CreatePlayerSessions -> ShowS
[CreatePlayerSessions] -> ShowS
CreatePlayerSessions -> String
(Int -> CreatePlayerSessions -> ShowS)
-> (CreatePlayerSessions -> String)
-> ([CreatePlayerSessions] -> ShowS)
-> Show CreatePlayerSessions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePlayerSessions] -> ShowS
$cshowList :: [CreatePlayerSessions] -> ShowS
show :: CreatePlayerSessions -> String
$cshow :: CreatePlayerSessions -> String
showsPrec :: Int -> CreatePlayerSessions -> ShowS
$cshowsPrec :: Int -> CreatePlayerSessions -> ShowS
Prelude.Show, (forall x. CreatePlayerSessions -> Rep CreatePlayerSessions x)
-> (forall x. Rep CreatePlayerSessions x -> CreatePlayerSessions)
-> Generic CreatePlayerSessions
forall x. Rep CreatePlayerSessions x -> CreatePlayerSessions
forall x. CreatePlayerSessions -> Rep CreatePlayerSessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePlayerSessions x -> CreatePlayerSessions
$cfrom :: forall x. CreatePlayerSessions -> Rep CreatePlayerSessions x
Prelude.Generic)

-- |
-- Create a value of 'CreatePlayerSessions' 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:
--
-- 'playerDataMap', 'createPlayerSessions_playerDataMap' - Map of string pairs, each specifying a player ID and a set of
-- developer-defined information related to the player. Amazon GameLift
-- does not use this data, so it can be formatted as needed for use in the
-- game. Any player data strings for player IDs that are not included in
-- the @PlayerIds@ parameter are ignored.
--
-- 'gameSessionId', 'createPlayerSessions_gameSessionId' - A unique identifier for the game session to add players to.
--
-- 'playerIds', 'createPlayerSessions_playerIds' - List of unique identifiers for the players to be added.
newCreatePlayerSessions ::
  -- | 'gameSessionId'
  Prelude.Text ->
  -- | 'playerIds'
  Prelude.NonEmpty Prelude.Text ->
  CreatePlayerSessions
newCreatePlayerSessions :: Text -> NonEmpty Text -> CreatePlayerSessions
newCreatePlayerSessions Text
pGameSessionId_ NonEmpty Text
pPlayerIds_ =
  CreatePlayerSessions' :: Maybe (HashMap Text Text)
-> Text -> NonEmpty Text -> CreatePlayerSessions
CreatePlayerSessions'
    { $sel:playerDataMap:CreatePlayerSessions' :: Maybe (HashMap Text Text)
playerDataMap =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:gameSessionId:CreatePlayerSessions' :: Text
gameSessionId = Text
pGameSessionId_,
      $sel:playerIds:CreatePlayerSessions' :: NonEmpty Text
playerIds = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pPlayerIds_
    }

-- | Map of string pairs, each specifying a player ID and a set of
-- developer-defined information related to the player. Amazon GameLift
-- does not use this data, so it can be formatted as needed for use in the
-- game. Any player data strings for player IDs that are not included in
-- the @PlayerIds@ parameter are ignored.
createPlayerSessions_playerDataMap :: Lens.Lens' CreatePlayerSessions (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createPlayerSessions_playerDataMap :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePlayerSessions -> f CreatePlayerSessions
createPlayerSessions_playerDataMap = (CreatePlayerSessions -> Maybe (HashMap Text Text))
-> (CreatePlayerSessions
    -> Maybe (HashMap Text Text) -> CreatePlayerSessions)
-> Lens
     CreatePlayerSessions
     CreatePlayerSessions
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlayerSessions' {Maybe (HashMap Text Text)
playerDataMap :: Maybe (HashMap Text Text)
$sel:playerDataMap:CreatePlayerSessions' :: CreatePlayerSessions -> Maybe (HashMap Text Text)
playerDataMap} -> Maybe (HashMap Text Text)
playerDataMap) (\s :: CreatePlayerSessions
s@CreatePlayerSessions' {} Maybe (HashMap Text Text)
a -> CreatePlayerSessions
s {$sel:playerDataMap:CreatePlayerSessions' :: Maybe (HashMap Text Text)
playerDataMap = Maybe (HashMap Text Text)
a} :: CreatePlayerSessions) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreatePlayerSessions -> f CreatePlayerSessions)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePlayerSessions
-> f CreatePlayerSessions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique identifier for the game session to add players to.
createPlayerSessions_gameSessionId :: Lens.Lens' CreatePlayerSessions Prelude.Text
createPlayerSessions_gameSessionId :: (Text -> f Text) -> CreatePlayerSessions -> f CreatePlayerSessions
createPlayerSessions_gameSessionId = (CreatePlayerSessions -> Text)
-> (CreatePlayerSessions -> Text -> CreatePlayerSessions)
-> Lens CreatePlayerSessions CreatePlayerSessions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlayerSessions' {Text
gameSessionId :: Text
$sel:gameSessionId:CreatePlayerSessions' :: CreatePlayerSessions -> Text
gameSessionId} -> Text
gameSessionId) (\s :: CreatePlayerSessions
s@CreatePlayerSessions' {} Text
a -> CreatePlayerSessions
s {$sel:gameSessionId:CreatePlayerSessions' :: Text
gameSessionId = Text
a} :: CreatePlayerSessions)

-- | List of unique identifiers for the players to be added.
createPlayerSessions_playerIds :: Lens.Lens' CreatePlayerSessions (Prelude.NonEmpty Prelude.Text)
createPlayerSessions_playerIds :: (NonEmpty Text -> f (NonEmpty Text))
-> CreatePlayerSessions -> f CreatePlayerSessions
createPlayerSessions_playerIds = (CreatePlayerSessions -> NonEmpty Text)
-> (CreatePlayerSessions -> NonEmpty Text -> CreatePlayerSessions)
-> Lens
     CreatePlayerSessions
     CreatePlayerSessions
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlayerSessions' {NonEmpty Text
playerIds :: NonEmpty Text
$sel:playerIds:CreatePlayerSessions' :: CreatePlayerSessions -> NonEmpty Text
playerIds} -> NonEmpty Text
playerIds) (\s :: CreatePlayerSessions
s@CreatePlayerSessions' {} NonEmpty Text
a -> CreatePlayerSessions
s {$sel:playerIds:CreatePlayerSessions' :: NonEmpty Text
playerIds = NonEmpty Text
a} :: CreatePlayerSessions) ((NonEmpty Text -> f (NonEmpty Text))
 -> CreatePlayerSessions -> f CreatePlayerSessions)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreatePlayerSessions
-> f CreatePlayerSessions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreatePlayerSessions where
  type
    AWSResponse CreatePlayerSessions =
      CreatePlayerSessionsResponse
  request :: CreatePlayerSessions -> Request CreatePlayerSessions
request = Service -> CreatePlayerSessions -> Request CreatePlayerSessions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreatePlayerSessions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePlayerSessions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreatePlayerSessions))
-> Logger
-> Service
-> Proxy CreatePlayerSessions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePlayerSessions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [PlayerSession] -> Int -> CreatePlayerSessionsResponse
CreatePlayerSessionsResponse'
            (Maybe [PlayerSession] -> Int -> CreatePlayerSessionsResponse)
-> Either String (Maybe [PlayerSession])
-> Either String (Int -> CreatePlayerSessionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [PlayerSession]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PlayerSessions" Either String (Maybe (Maybe [PlayerSession]))
-> Maybe [PlayerSession] -> Either String (Maybe [PlayerSession])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PlayerSession]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreatePlayerSessionsResponse)
-> Either String Int -> Either String CreatePlayerSessionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreatePlayerSessions

instance Prelude.NFData CreatePlayerSessions

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

instance Core.ToJSON CreatePlayerSessions where
  toJSON :: CreatePlayerSessions -> Value
toJSON CreatePlayerSessions' {Maybe (HashMap Text Text)
NonEmpty Text
Text
playerIds :: NonEmpty Text
gameSessionId :: Text
playerDataMap :: Maybe (HashMap Text Text)
$sel:playerIds:CreatePlayerSessions' :: CreatePlayerSessions -> NonEmpty Text
$sel:gameSessionId:CreatePlayerSessions' :: CreatePlayerSessions -> Text
$sel:playerDataMap:CreatePlayerSessions' :: CreatePlayerSessions -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PlayerDataMap" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
playerDataMap,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GameSessionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gameSessionId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PlayerIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
playerIds)
          ]
      )

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

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

-- | Represents the returned data in response to a request operation.
--
-- /See:/ 'newCreatePlayerSessionsResponse' smart constructor.
data CreatePlayerSessionsResponse = CreatePlayerSessionsResponse'
  { -- | A collection of player session objects created for the added players.
    CreatePlayerSessionsResponse -> Maybe [PlayerSession]
playerSessions :: Prelude.Maybe [PlayerSession],
    -- | The response's http status code.
    CreatePlayerSessionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreatePlayerSessionsResponse
-> CreatePlayerSessionsResponse -> Bool
(CreatePlayerSessionsResponse
 -> CreatePlayerSessionsResponse -> Bool)
-> (CreatePlayerSessionsResponse
    -> CreatePlayerSessionsResponse -> Bool)
-> Eq CreatePlayerSessionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePlayerSessionsResponse
-> CreatePlayerSessionsResponse -> Bool
$c/= :: CreatePlayerSessionsResponse
-> CreatePlayerSessionsResponse -> Bool
== :: CreatePlayerSessionsResponse
-> CreatePlayerSessionsResponse -> Bool
$c== :: CreatePlayerSessionsResponse
-> CreatePlayerSessionsResponse -> Bool
Prelude.Eq, ReadPrec [CreatePlayerSessionsResponse]
ReadPrec CreatePlayerSessionsResponse
Int -> ReadS CreatePlayerSessionsResponse
ReadS [CreatePlayerSessionsResponse]
(Int -> ReadS CreatePlayerSessionsResponse)
-> ReadS [CreatePlayerSessionsResponse]
-> ReadPrec CreatePlayerSessionsResponse
-> ReadPrec [CreatePlayerSessionsResponse]
-> Read CreatePlayerSessionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePlayerSessionsResponse]
$creadListPrec :: ReadPrec [CreatePlayerSessionsResponse]
readPrec :: ReadPrec CreatePlayerSessionsResponse
$creadPrec :: ReadPrec CreatePlayerSessionsResponse
readList :: ReadS [CreatePlayerSessionsResponse]
$creadList :: ReadS [CreatePlayerSessionsResponse]
readsPrec :: Int -> ReadS CreatePlayerSessionsResponse
$creadsPrec :: Int -> ReadS CreatePlayerSessionsResponse
Prelude.Read, Int -> CreatePlayerSessionsResponse -> ShowS
[CreatePlayerSessionsResponse] -> ShowS
CreatePlayerSessionsResponse -> String
(Int -> CreatePlayerSessionsResponse -> ShowS)
-> (CreatePlayerSessionsResponse -> String)
-> ([CreatePlayerSessionsResponse] -> ShowS)
-> Show CreatePlayerSessionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePlayerSessionsResponse] -> ShowS
$cshowList :: [CreatePlayerSessionsResponse] -> ShowS
show :: CreatePlayerSessionsResponse -> String
$cshow :: CreatePlayerSessionsResponse -> String
showsPrec :: Int -> CreatePlayerSessionsResponse -> ShowS
$cshowsPrec :: Int -> CreatePlayerSessionsResponse -> ShowS
Prelude.Show, (forall x.
 CreatePlayerSessionsResponse -> Rep CreatePlayerSessionsResponse x)
-> (forall x.
    Rep CreatePlayerSessionsResponse x -> CreatePlayerSessionsResponse)
-> Generic CreatePlayerSessionsResponse
forall x.
Rep CreatePlayerSessionsResponse x -> CreatePlayerSessionsResponse
forall x.
CreatePlayerSessionsResponse -> Rep CreatePlayerSessionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePlayerSessionsResponse x -> CreatePlayerSessionsResponse
$cfrom :: forall x.
CreatePlayerSessionsResponse -> Rep CreatePlayerSessionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePlayerSessionsResponse' 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:
--
-- 'playerSessions', 'createPlayerSessionsResponse_playerSessions' - A collection of player session objects created for the added players.
--
-- 'httpStatus', 'createPlayerSessionsResponse_httpStatus' - The response's http status code.
newCreatePlayerSessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreatePlayerSessionsResponse
newCreatePlayerSessionsResponse :: Int -> CreatePlayerSessionsResponse
newCreatePlayerSessionsResponse Int
pHttpStatus_ =
  CreatePlayerSessionsResponse' :: Maybe [PlayerSession] -> Int -> CreatePlayerSessionsResponse
CreatePlayerSessionsResponse'
    { $sel:playerSessions:CreatePlayerSessionsResponse' :: Maybe [PlayerSession]
playerSessions =
        Maybe [PlayerSession]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreatePlayerSessionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A collection of player session objects created for the added players.
createPlayerSessionsResponse_playerSessions :: Lens.Lens' CreatePlayerSessionsResponse (Prelude.Maybe [PlayerSession])
createPlayerSessionsResponse_playerSessions :: (Maybe [PlayerSession] -> f (Maybe [PlayerSession]))
-> CreatePlayerSessionsResponse -> f CreatePlayerSessionsResponse
createPlayerSessionsResponse_playerSessions = (CreatePlayerSessionsResponse -> Maybe [PlayerSession])
-> (CreatePlayerSessionsResponse
    -> Maybe [PlayerSession] -> CreatePlayerSessionsResponse)
-> Lens
     CreatePlayerSessionsResponse
     CreatePlayerSessionsResponse
     (Maybe [PlayerSession])
     (Maybe [PlayerSession])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlayerSessionsResponse' {Maybe [PlayerSession]
playerSessions :: Maybe [PlayerSession]
$sel:playerSessions:CreatePlayerSessionsResponse' :: CreatePlayerSessionsResponse -> Maybe [PlayerSession]
playerSessions} -> Maybe [PlayerSession]
playerSessions) (\s :: CreatePlayerSessionsResponse
s@CreatePlayerSessionsResponse' {} Maybe [PlayerSession]
a -> CreatePlayerSessionsResponse
s {$sel:playerSessions:CreatePlayerSessionsResponse' :: Maybe [PlayerSession]
playerSessions = Maybe [PlayerSession]
a} :: CreatePlayerSessionsResponse) ((Maybe [PlayerSession] -> f (Maybe [PlayerSession]))
 -> CreatePlayerSessionsResponse -> f CreatePlayerSessionsResponse)
-> ((Maybe [PlayerSession] -> f (Maybe [PlayerSession]))
    -> Maybe [PlayerSession] -> f (Maybe [PlayerSession]))
-> (Maybe [PlayerSession] -> f (Maybe [PlayerSession]))
-> CreatePlayerSessionsResponse
-> f CreatePlayerSessionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PlayerSession] [PlayerSession] [PlayerSession] [PlayerSession]
-> Iso
     (Maybe [PlayerSession])
     (Maybe [PlayerSession])
     (Maybe [PlayerSession])
     (Maybe [PlayerSession])
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
  [PlayerSession] [PlayerSession] [PlayerSession] [PlayerSession]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreatePlayerSessionsResponse