{-# 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 #-}
module Amazonka.GameLift.Types.PlayerLatencyPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PlayerLatencyPolicy = PlayerLatencyPolicy'
{
PlayerLatencyPolicy -> Maybe Natural
policyDurationSeconds :: Prelude.Maybe Prelude.Natural,
PlayerLatencyPolicy -> Maybe Natural
maximumIndividualPlayerLatencyMilliseconds :: Prelude.Maybe Prelude.Natural
}
deriving (PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool
(PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool)
-> (PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool)
-> Eq PlayerLatencyPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool
$c/= :: PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool
== :: PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool
$c== :: PlayerLatencyPolicy -> PlayerLatencyPolicy -> Bool
Prelude.Eq, ReadPrec [PlayerLatencyPolicy]
ReadPrec PlayerLatencyPolicy
Int -> ReadS PlayerLatencyPolicy
ReadS [PlayerLatencyPolicy]
(Int -> ReadS PlayerLatencyPolicy)
-> ReadS [PlayerLatencyPolicy]
-> ReadPrec PlayerLatencyPolicy
-> ReadPrec [PlayerLatencyPolicy]
-> Read PlayerLatencyPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlayerLatencyPolicy]
$creadListPrec :: ReadPrec [PlayerLatencyPolicy]
readPrec :: ReadPrec PlayerLatencyPolicy
$creadPrec :: ReadPrec PlayerLatencyPolicy
readList :: ReadS [PlayerLatencyPolicy]
$creadList :: ReadS [PlayerLatencyPolicy]
readsPrec :: Int -> ReadS PlayerLatencyPolicy
$creadsPrec :: Int -> ReadS PlayerLatencyPolicy
Prelude.Read, Int -> PlayerLatencyPolicy -> ShowS
[PlayerLatencyPolicy] -> ShowS
PlayerLatencyPolicy -> String
(Int -> PlayerLatencyPolicy -> ShowS)
-> (PlayerLatencyPolicy -> String)
-> ([PlayerLatencyPolicy] -> ShowS)
-> Show PlayerLatencyPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlayerLatencyPolicy] -> ShowS
$cshowList :: [PlayerLatencyPolicy] -> ShowS
show :: PlayerLatencyPolicy -> String
$cshow :: PlayerLatencyPolicy -> String
showsPrec :: Int -> PlayerLatencyPolicy -> ShowS
$cshowsPrec :: Int -> PlayerLatencyPolicy -> ShowS
Prelude.Show, (forall x. PlayerLatencyPolicy -> Rep PlayerLatencyPolicy x)
-> (forall x. Rep PlayerLatencyPolicy x -> PlayerLatencyPolicy)
-> Generic PlayerLatencyPolicy
forall x. Rep PlayerLatencyPolicy x -> PlayerLatencyPolicy
forall x. PlayerLatencyPolicy -> Rep PlayerLatencyPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlayerLatencyPolicy x -> PlayerLatencyPolicy
$cfrom :: forall x. PlayerLatencyPolicy -> Rep PlayerLatencyPolicy x
Prelude.Generic)
newPlayerLatencyPolicy ::
PlayerLatencyPolicy
newPlayerLatencyPolicy :: PlayerLatencyPolicy
newPlayerLatencyPolicy =
PlayerLatencyPolicy' :: Maybe Natural -> Maybe Natural -> PlayerLatencyPolicy
PlayerLatencyPolicy'
{ $sel:policyDurationSeconds:PlayerLatencyPolicy' :: Maybe Natural
policyDurationSeconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:maximumIndividualPlayerLatencyMilliseconds:PlayerLatencyPolicy' :: Maybe Natural
maximumIndividualPlayerLatencyMilliseconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
playerLatencyPolicy_policyDurationSeconds :: Lens.Lens' PlayerLatencyPolicy (Prelude.Maybe Prelude.Natural)
playerLatencyPolicy_policyDurationSeconds :: (Maybe Natural -> f (Maybe Natural))
-> PlayerLatencyPolicy -> f PlayerLatencyPolicy
playerLatencyPolicy_policyDurationSeconds = (PlayerLatencyPolicy -> Maybe Natural)
-> (PlayerLatencyPolicy -> Maybe Natural -> PlayerLatencyPolicy)
-> Lens
PlayerLatencyPolicy
PlayerLatencyPolicy
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerLatencyPolicy' {Maybe Natural
policyDurationSeconds :: Maybe Natural
$sel:policyDurationSeconds:PlayerLatencyPolicy' :: PlayerLatencyPolicy -> Maybe Natural
policyDurationSeconds} -> Maybe Natural
policyDurationSeconds) (\s :: PlayerLatencyPolicy
s@PlayerLatencyPolicy' {} Maybe Natural
a -> PlayerLatencyPolicy
s {$sel:policyDurationSeconds:PlayerLatencyPolicy' :: Maybe Natural
policyDurationSeconds = Maybe Natural
a} :: PlayerLatencyPolicy)
playerLatencyPolicy_maximumIndividualPlayerLatencyMilliseconds :: Lens.Lens' PlayerLatencyPolicy (Prelude.Maybe Prelude.Natural)
playerLatencyPolicy_maximumIndividualPlayerLatencyMilliseconds :: (Maybe Natural -> f (Maybe Natural))
-> PlayerLatencyPolicy -> f PlayerLatencyPolicy
playerLatencyPolicy_maximumIndividualPlayerLatencyMilliseconds = (PlayerLatencyPolicy -> Maybe Natural)
-> (PlayerLatencyPolicy -> Maybe Natural -> PlayerLatencyPolicy)
-> Lens
PlayerLatencyPolicy
PlayerLatencyPolicy
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerLatencyPolicy' {Maybe Natural
maximumIndividualPlayerLatencyMilliseconds :: Maybe Natural
$sel:maximumIndividualPlayerLatencyMilliseconds:PlayerLatencyPolicy' :: PlayerLatencyPolicy -> Maybe Natural
maximumIndividualPlayerLatencyMilliseconds} -> Maybe Natural
maximumIndividualPlayerLatencyMilliseconds) (\s :: PlayerLatencyPolicy
s@PlayerLatencyPolicy' {} Maybe Natural
a -> PlayerLatencyPolicy
s {$sel:maximumIndividualPlayerLatencyMilliseconds:PlayerLatencyPolicy' :: Maybe Natural
maximumIndividualPlayerLatencyMilliseconds = Maybe Natural
a} :: PlayerLatencyPolicy)
instance Core.FromJSON PlayerLatencyPolicy where
parseJSON :: Value -> Parser PlayerLatencyPolicy
parseJSON =
String
-> (Object -> Parser PlayerLatencyPolicy)
-> Value
-> Parser PlayerLatencyPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PlayerLatencyPolicy"
( \Object
x ->
Maybe Natural -> Maybe Natural -> PlayerLatencyPolicy
PlayerLatencyPolicy'
(Maybe Natural -> Maybe Natural -> PlayerLatencyPolicy)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> PlayerLatencyPolicy)
forall (f :: * -> *) a b. Functor 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
"PolicyDurationSeconds")
Parser (Maybe Natural -> PlayerLatencyPolicy)
-> Parser (Maybe Natural) -> Parser PlayerLatencyPolicy
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
"MaximumIndividualPlayerLatencyMilliseconds"
)
)
instance Prelude.Hashable PlayerLatencyPolicy
instance Prelude.NFData PlayerLatencyPolicy
instance Core.ToJSON PlayerLatencyPolicy where
toJSON :: PlayerLatencyPolicy -> Value
toJSON PlayerLatencyPolicy' {Maybe Natural
maximumIndividualPlayerLatencyMilliseconds :: Maybe Natural
policyDurationSeconds :: Maybe Natural
$sel:maximumIndividualPlayerLatencyMilliseconds:PlayerLatencyPolicy' :: PlayerLatencyPolicy -> Maybe Natural
$sel:policyDurationSeconds:PlayerLatencyPolicy' :: PlayerLatencyPolicy -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PolicyDurationSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
policyDurationSeconds,
( Text
"MaximumIndividualPlayerLatencyMilliseconds"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=
)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumIndividualPlayerLatencyMilliseconds
]
)