{-# 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 #-}
module Amazonka.GameLift.UpdateGameSession
(
UpdateGameSession (..),
newUpdateGameSession,
updateGameSession_maximumPlayerSessionCount,
updateGameSession_name,
updateGameSession_playerSessionCreationPolicy,
updateGameSession_protectionPolicy,
updateGameSession_gameSessionId,
UpdateGameSessionResponse (..),
newUpdateGameSessionResponse,
updateGameSessionResponse_gameSession,
updateGameSessionResponse_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
data UpdateGameSession = UpdateGameSession'
{
UpdateGameSession -> Maybe Natural
maximumPlayerSessionCount :: Prelude.Maybe Prelude.Natural,
UpdateGameSession -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateGameSession -> Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy :: Prelude.Maybe PlayerSessionCreationPolicy,
UpdateGameSession -> Maybe ProtectionPolicy
protectionPolicy :: Prelude.Maybe ProtectionPolicy,
UpdateGameSession -> Text
gameSessionId :: Prelude.Text
}
deriving (UpdateGameSession -> UpdateGameSession -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGameSession -> UpdateGameSession -> Bool
$c/= :: UpdateGameSession -> UpdateGameSession -> Bool
== :: UpdateGameSession -> UpdateGameSession -> Bool
$c== :: UpdateGameSession -> UpdateGameSession -> Bool
Prelude.Eq, ReadPrec [UpdateGameSession]
ReadPrec UpdateGameSession
Int -> ReadS UpdateGameSession
ReadS [UpdateGameSession]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGameSession]
$creadListPrec :: ReadPrec [UpdateGameSession]
readPrec :: ReadPrec UpdateGameSession
$creadPrec :: ReadPrec UpdateGameSession
readList :: ReadS [UpdateGameSession]
$creadList :: ReadS [UpdateGameSession]
readsPrec :: Int -> ReadS UpdateGameSession
$creadsPrec :: Int -> ReadS UpdateGameSession
Prelude.Read, Int -> UpdateGameSession -> ShowS
[UpdateGameSession] -> ShowS
UpdateGameSession -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGameSession] -> ShowS
$cshowList :: [UpdateGameSession] -> ShowS
show :: UpdateGameSession -> String
$cshow :: UpdateGameSession -> String
showsPrec :: Int -> UpdateGameSession -> ShowS
$cshowsPrec :: Int -> UpdateGameSession -> ShowS
Prelude.Show, forall x. Rep UpdateGameSession x -> UpdateGameSession
forall x. UpdateGameSession -> Rep UpdateGameSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGameSession x -> UpdateGameSession
$cfrom :: forall x. UpdateGameSession -> Rep UpdateGameSession x
Prelude.Generic)
newUpdateGameSession ::
Prelude.Text ->
UpdateGameSession
newUpdateGameSession :: Text -> UpdateGameSession
newUpdateGameSession Text
pGameSessionId_ =
UpdateGameSession'
{ $sel:maximumPlayerSessionCount:UpdateGameSession' :: Maybe Natural
maximumPlayerSessionCount =
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateGameSession' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:playerSessionCreationPolicy:UpdateGameSession' :: Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy = forall a. Maybe a
Prelude.Nothing,
$sel:protectionPolicy:UpdateGameSession' :: Maybe ProtectionPolicy
protectionPolicy = forall a. Maybe a
Prelude.Nothing,
$sel:gameSessionId:UpdateGameSession' :: Text
gameSessionId = Text
pGameSessionId_
}
updateGameSession_maximumPlayerSessionCount :: Lens.Lens' UpdateGameSession (Prelude.Maybe Prelude.Natural)
updateGameSession_maximumPlayerSessionCount :: Lens' UpdateGameSession (Maybe Natural)
updateGameSession_maximumPlayerSessionCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSession' {Maybe Natural
maximumPlayerSessionCount :: Maybe Natural
$sel:maximumPlayerSessionCount:UpdateGameSession' :: UpdateGameSession -> Maybe Natural
maximumPlayerSessionCount} -> Maybe Natural
maximumPlayerSessionCount) (\s :: UpdateGameSession
s@UpdateGameSession' {} Maybe Natural
a -> UpdateGameSession
s {$sel:maximumPlayerSessionCount:UpdateGameSession' :: Maybe Natural
maximumPlayerSessionCount = Maybe Natural
a} :: UpdateGameSession)
updateGameSession_name :: Lens.Lens' UpdateGameSession (Prelude.Maybe Prelude.Text)
updateGameSession_name :: Lens' UpdateGameSession (Maybe Text)
updateGameSession_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSession' {Maybe Text
name :: Maybe Text
$sel:name:UpdateGameSession' :: UpdateGameSession -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateGameSession
s@UpdateGameSession' {} Maybe Text
a -> UpdateGameSession
s {$sel:name:UpdateGameSession' :: Maybe Text
name = Maybe Text
a} :: UpdateGameSession)
updateGameSession_playerSessionCreationPolicy :: Lens.Lens' UpdateGameSession (Prelude.Maybe PlayerSessionCreationPolicy)
updateGameSession_playerSessionCreationPolicy :: Lens' UpdateGameSession (Maybe PlayerSessionCreationPolicy)
updateGameSession_playerSessionCreationPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSession' {Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy :: Maybe PlayerSessionCreationPolicy
$sel:playerSessionCreationPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy} -> Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy) (\s :: UpdateGameSession
s@UpdateGameSession' {} Maybe PlayerSessionCreationPolicy
a -> UpdateGameSession
s {$sel:playerSessionCreationPolicy:UpdateGameSession' :: Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy = Maybe PlayerSessionCreationPolicy
a} :: UpdateGameSession)
updateGameSession_protectionPolicy :: Lens.Lens' UpdateGameSession (Prelude.Maybe ProtectionPolicy)
updateGameSession_protectionPolicy :: Lens' UpdateGameSession (Maybe ProtectionPolicy)
updateGameSession_protectionPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSession' {Maybe ProtectionPolicy
protectionPolicy :: Maybe ProtectionPolicy
$sel:protectionPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe ProtectionPolicy
protectionPolicy} -> Maybe ProtectionPolicy
protectionPolicy) (\s :: UpdateGameSession
s@UpdateGameSession' {} Maybe ProtectionPolicy
a -> UpdateGameSession
s {$sel:protectionPolicy:UpdateGameSession' :: Maybe ProtectionPolicy
protectionPolicy = Maybe ProtectionPolicy
a} :: UpdateGameSession)
updateGameSession_gameSessionId :: Lens.Lens' UpdateGameSession Prelude.Text
updateGameSession_gameSessionId :: Lens' UpdateGameSession Text
updateGameSession_gameSessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSession' {Text
gameSessionId :: Text
$sel:gameSessionId:UpdateGameSession' :: UpdateGameSession -> Text
gameSessionId} -> Text
gameSessionId) (\s :: UpdateGameSession
s@UpdateGameSession' {} Text
a -> UpdateGameSession
s {$sel:gameSessionId:UpdateGameSession' :: Text
gameSessionId = Text
a} :: UpdateGameSession)
instance Core.AWSRequest UpdateGameSession where
type
AWSResponse UpdateGameSession =
UpdateGameSessionResponse
request :: (Service -> Service)
-> UpdateGameSession -> Request UpdateGameSession
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 UpdateGameSession
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateGameSession)))
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 GameSession -> Int -> UpdateGameSessionResponse
UpdateGameSessionResponse'
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
"GameSession")
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 UpdateGameSession where
hashWithSalt :: Int -> UpdateGameSession -> Int
hashWithSalt Int
_salt UpdateGameSession' {Maybe Natural
Maybe Text
Maybe PlayerSessionCreationPolicy
Maybe ProtectionPolicy
Text
gameSessionId :: Text
protectionPolicy :: Maybe ProtectionPolicy
playerSessionCreationPolicy :: Maybe PlayerSessionCreationPolicy
name :: Maybe Text
maximumPlayerSessionCount :: Maybe Natural
$sel:gameSessionId:UpdateGameSession' :: UpdateGameSession -> Text
$sel:protectionPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe ProtectionPolicy
$sel:playerSessionCreationPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe PlayerSessionCreationPolicy
$sel:name:UpdateGameSession' :: UpdateGameSession -> Maybe Text
$sel:maximumPlayerSessionCount:UpdateGameSession' :: UpdateGameSession -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maximumPlayerSessionCount
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProtectionPolicy
protectionPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameSessionId
instance Prelude.NFData UpdateGameSession where
rnf :: UpdateGameSession -> ()
rnf UpdateGameSession' {Maybe Natural
Maybe Text
Maybe PlayerSessionCreationPolicy
Maybe ProtectionPolicy
Text
gameSessionId :: Text
protectionPolicy :: Maybe ProtectionPolicy
playerSessionCreationPolicy :: Maybe PlayerSessionCreationPolicy
name :: Maybe Text
maximumPlayerSessionCount :: Maybe Natural
$sel:gameSessionId:UpdateGameSession' :: UpdateGameSession -> Text
$sel:protectionPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe ProtectionPolicy
$sel:playerSessionCreationPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe PlayerSessionCreationPolicy
$sel:name:UpdateGameSession' :: UpdateGameSession -> Maybe Text
$sel:maximumPlayerSessionCount:UpdateGameSession' :: UpdateGameSession -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maximumPlayerSessionCount
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PlayerSessionCreationPolicy
playerSessionCreationPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProtectionPolicy
protectionPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gameSessionId
instance Data.ToHeaders UpdateGameSession where
toHeaders :: UpdateGameSession -> 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.UpdateGameSession" :: 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 UpdateGameSession where
toJSON :: UpdateGameSession -> Value
toJSON UpdateGameSession' {Maybe Natural
Maybe Text
Maybe PlayerSessionCreationPolicy
Maybe ProtectionPolicy
Text
gameSessionId :: Text
protectionPolicy :: Maybe ProtectionPolicy
playerSessionCreationPolicy :: Maybe PlayerSessionCreationPolicy
name :: Maybe Text
maximumPlayerSessionCount :: Maybe Natural
$sel:gameSessionId:UpdateGameSession' :: UpdateGameSession -> Text
$sel:protectionPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe ProtectionPolicy
$sel:playerSessionCreationPolicy:UpdateGameSession' :: UpdateGameSession -> Maybe PlayerSessionCreationPolicy
$sel:name:UpdateGameSession' :: UpdateGameSession -> Maybe Text
$sel:maximumPlayerSessionCount:UpdateGameSession' :: UpdateGameSession -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaximumPlayerSessionCount" 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 Natural
maximumPlayerSessionCount,
(Key
"Name" 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
name,
(Key
"PlayerSessionCreationPolicy" 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 PlayerSessionCreationPolicy
playerSessionCreationPolicy,
(Key
"ProtectionPolicy" 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 ProtectionPolicy
protectionPolicy,
forall a. a -> Maybe a
Prelude.Just
(Key
"GameSessionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gameSessionId)
]
)
instance Data.ToPath UpdateGameSession where
toPath :: UpdateGameSession -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateGameSession where
toQuery :: UpdateGameSession -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateGameSessionResponse = UpdateGameSessionResponse'
{
UpdateGameSessionResponse -> Maybe GameSession
gameSession :: Prelude.Maybe GameSession,
UpdateGameSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateGameSessionResponse -> UpdateGameSessionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGameSessionResponse -> UpdateGameSessionResponse -> Bool
$c/= :: UpdateGameSessionResponse -> UpdateGameSessionResponse -> Bool
== :: UpdateGameSessionResponse -> UpdateGameSessionResponse -> Bool
$c== :: UpdateGameSessionResponse -> UpdateGameSessionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGameSessionResponse]
ReadPrec UpdateGameSessionResponse
Int -> ReadS UpdateGameSessionResponse
ReadS [UpdateGameSessionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGameSessionResponse]
$creadListPrec :: ReadPrec [UpdateGameSessionResponse]
readPrec :: ReadPrec UpdateGameSessionResponse
$creadPrec :: ReadPrec UpdateGameSessionResponse
readList :: ReadS [UpdateGameSessionResponse]
$creadList :: ReadS [UpdateGameSessionResponse]
readsPrec :: Int -> ReadS UpdateGameSessionResponse
$creadsPrec :: Int -> ReadS UpdateGameSessionResponse
Prelude.Read, Int -> UpdateGameSessionResponse -> ShowS
[UpdateGameSessionResponse] -> ShowS
UpdateGameSessionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGameSessionResponse] -> ShowS
$cshowList :: [UpdateGameSessionResponse] -> ShowS
show :: UpdateGameSessionResponse -> String
$cshow :: UpdateGameSessionResponse -> String
showsPrec :: Int -> UpdateGameSessionResponse -> ShowS
$cshowsPrec :: Int -> UpdateGameSessionResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateGameSessionResponse x -> UpdateGameSessionResponse
forall x.
UpdateGameSessionResponse -> Rep UpdateGameSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGameSessionResponse x -> UpdateGameSessionResponse
$cfrom :: forall x.
UpdateGameSessionResponse -> Rep UpdateGameSessionResponse x
Prelude.Generic)
newUpdateGameSessionResponse ::
Prelude.Int ->
UpdateGameSessionResponse
newUpdateGameSessionResponse :: Int -> UpdateGameSessionResponse
newUpdateGameSessionResponse Int
pHttpStatus_ =
UpdateGameSessionResponse'
{ $sel:gameSession:UpdateGameSessionResponse' :: Maybe GameSession
gameSession =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateGameSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateGameSessionResponse_gameSession :: Lens.Lens' UpdateGameSessionResponse (Prelude.Maybe GameSession)
updateGameSessionResponse_gameSession :: Lens' UpdateGameSessionResponse (Maybe GameSession)
updateGameSessionResponse_gameSession = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSessionResponse' {Maybe GameSession
gameSession :: Maybe GameSession
$sel:gameSession:UpdateGameSessionResponse' :: UpdateGameSessionResponse -> Maybe GameSession
gameSession} -> Maybe GameSession
gameSession) (\s :: UpdateGameSessionResponse
s@UpdateGameSessionResponse' {} Maybe GameSession
a -> UpdateGameSessionResponse
s {$sel:gameSession:UpdateGameSessionResponse' :: Maybe GameSession
gameSession = Maybe GameSession
a} :: UpdateGameSessionResponse)
updateGameSessionResponse_httpStatus :: Lens.Lens' UpdateGameSessionResponse Prelude.Int
updateGameSessionResponse_httpStatus :: Lens' UpdateGameSessionResponse Int
updateGameSessionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGameSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateGameSessionResponse' :: UpdateGameSessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateGameSessionResponse
s@UpdateGameSessionResponse' {} Int
a -> UpdateGameSessionResponse
s {$sel:httpStatus:UpdateGameSessionResponse' :: Int
httpStatus = Int
a} :: UpdateGameSessionResponse)
instance Prelude.NFData UpdateGameSessionResponse where
rnf :: UpdateGameSessionResponse -> ()
rnf UpdateGameSessionResponse' {Int
Maybe GameSession
httpStatus :: Int
gameSession :: Maybe GameSession
$sel:httpStatus:UpdateGameSessionResponse' :: UpdateGameSessionResponse -> Int
$sel:gameSession:UpdateGameSessionResponse' :: UpdateGameSessionResponse -> Maybe GameSession
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe GameSession
gameSession
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus