{-# 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.PlayerLatency where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PlayerLatency = PlayerLatency'
{
PlayerLatency -> Maybe Double
latencyInMilliseconds :: Prelude.Maybe Prelude.Double,
PlayerLatency -> Maybe Text
regionIdentifier :: Prelude.Maybe Prelude.Text,
PlayerLatency -> Maybe Text
playerId :: Prelude.Maybe Prelude.Text
}
deriving (PlayerLatency -> PlayerLatency -> Bool
(PlayerLatency -> PlayerLatency -> Bool)
-> (PlayerLatency -> PlayerLatency -> Bool) -> Eq PlayerLatency
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlayerLatency -> PlayerLatency -> Bool
$c/= :: PlayerLatency -> PlayerLatency -> Bool
== :: PlayerLatency -> PlayerLatency -> Bool
$c== :: PlayerLatency -> PlayerLatency -> Bool
Prelude.Eq, ReadPrec [PlayerLatency]
ReadPrec PlayerLatency
Int -> ReadS PlayerLatency
ReadS [PlayerLatency]
(Int -> ReadS PlayerLatency)
-> ReadS [PlayerLatency]
-> ReadPrec PlayerLatency
-> ReadPrec [PlayerLatency]
-> Read PlayerLatency
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlayerLatency]
$creadListPrec :: ReadPrec [PlayerLatency]
readPrec :: ReadPrec PlayerLatency
$creadPrec :: ReadPrec PlayerLatency
readList :: ReadS [PlayerLatency]
$creadList :: ReadS [PlayerLatency]
readsPrec :: Int -> ReadS PlayerLatency
$creadsPrec :: Int -> ReadS PlayerLatency
Prelude.Read, Int -> PlayerLatency -> ShowS
[PlayerLatency] -> ShowS
PlayerLatency -> String
(Int -> PlayerLatency -> ShowS)
-> (PlayerLatency -> String)
-> ([PlayerLatency] -> ShowS)
-> Show PlayerLatency
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlayerLatency] -> ShowS
$cshowList :: [PlayerLatency] -> ShowS
show :: PlayerLatency -> String
$cshow :: PlayerLatency -> String
showsPrec :: Int -> PlayerLatency -> ShowS
$cshowsPrec :: Int -> PlayerLatency -> ShowS
Prelude.Show, (forall x. PlayerLatency -> Rep PlayerLatency x)
-> (forall x. Rep PlayerLatency x -> PlayerLatency)
-> Generic PlayerLatency
forall x. Rep PlayerLatency x -> PlayerLatency
forall x. PlayerLatency -> Rep PlayerLatency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlayerLatency x -> PlayerLatency
$cfrom :: forall x. PlayerLatency -> Rep PlayerLatency x
Prelude.Generic)
newPlayerLatency ::
PlayerLatency
newPlayerLatency :: PlayerLatency
newPlayerLatency =
PlayerLatency' :: Maybe Double -> Maybe Text -> Maybe Text -> PlayerLatency
PlayerLatency'
{ $sel:latencyInMilliseconds:PlayerLatency' :: Maybe Double
latencyInMilliseconds =
Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:regionIdentifier:PlayerLatency' :: Maybe Text
regionIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:playerId:PlayerLatency' :: Maybe Text
playerId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
playerLatency_latencyInMilliseconds :: Lens.Lens' PlayerLatency (Prelude.Maybe Prelude.Double)
playerLatency_latencyInMilliseconds :: (Maybe Double -> f (Maybe Double))
-> PlayerLatency -> f PlayerLatency
playerLatency_latencyInMilliseconds = (PlayerLatency -> Maybe Double)
-> (PlayerLatency -> Maybe Double -> PlayerLatency)
-> Lens PlayerLatency PlayerLatency (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerLatency' {Maybe Double
latencyInMilliseconds :: Maybe Double
$sel:latencyInMilliseconds:PlayerLatency' :: PlayerLatency -> Maybe Double
latencyInMilliseconds} -> Maybe Double
latencyInMilliseconds) (\s :: PlayerLatency
s@PlayerLatency' {} Maybe Double
a -> PlayerLatency
s {$sel:latencyInMilliseconds:PlayerLatency' :: Maybe Double
latencyInMilliseconds = Maybe Double
a} :: PlayerLatency)
playerLatency_regionIdentifier :: Lens.Lens' PlayerLatency (Prelude.Maybe Prelude.Text)
playerLatency_regionIdentifier :: (Maybe Text -> f (Maybe Text)) -> PlayerLatency -> f PlayerLatency
playerLatency_regionIdentifier = (PlayerLatency -> Maybe Text)
-> (PlayerLatency -> Maybe Text -> PlayerLatency)
-> Lens PlayerLatency PlayerLatency (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerLatency' {Maybe Text
regionIdentifier :: Maybe Text
$sel:regionIdentifier:PlayerLatency' :: PlayerLatency -> Maybe Text
regionIdentifier} -> Maybe Text
regionIdentifier) (\s :: PlayerLatency
s@PlayerLatency' {} Maybe Text
a -> PlayerLatency
s {$sel:regionIdentifier:PlayerLatency' :: Maybe Text
regionIdentifier = Maybe Text
a} :: PlayerLatency)
playerLatency_playerId :: Lens.Lens' PlayerLatency (Prelude.Maybe Prelude.Text)
playerLatency_playerId :: (Maybe Text -> f (Maybe Text)) -> PlayerLatency -> f PlayerLatency
playerLatency_playerId = (PlayerLatency -> Maybe Text)
-> (PlayerLatency -> Maybe Text -> PlayerLatency)
-> Lens PlayerLatency PlayerLatency (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlayerLatency' {Maybe Text
playerId :: Maybe Text
$sel:playerId:PlayerLatency' :: PlayerLatency -> Maybe Text
playerId} -> Maybe Text
playerId) (\s :: PlayerLatency
s@PlayerLatency' {} Maybe Text
a -> PlayerLatency
s {$sel:playerId:PlayerLatency' :: Maybe Text
playerId = Maybe Text
a} :: PlayerLatency)
instance Core.FromJSON PlayerLatency where
parseJSON :: Value -> Parser PlayerLatency
parseJSON =
String
-> (Object -> Parser PlayerLatency)
-> Value
-> Parser PlayerLatency
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PlayerLatency"
( \Object
x ->
Maybe Double -> Maybe Text -> Maybe Text -> PlayerLatency
PlayerLatency'
(Maybe Double -> Maybe Text -> Maybe Text -> PlayerLatency)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> Maybe Text -> PlayerLatency)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LatencyInMilliseconds")
Parser (Maybe Text -> Maybe Text -> PlayerLatency)
-> Parser (Maybe Text) -> Parser (Maybe Text -> PlayerLatency)
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
"RegionIdentifier")
Parser (Maybe Text -> PlayerLatency)
-> Parser (Maybe Text) -> Parser PlayerLatency
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")
)
instance Prelude.Hashable PlayerLatency
instance Prelude.NFData PlayerLatency
instance Core.ToJSON PlayerLatency where
toJSON :: PlayerLatency -> Value
toJSON PlayerLatency' {Maybe Double
Maybe Text
playerId :: Maybe Text
regionIdentifier :: Maybe Text
latencyInMilliseconds :: Maybe Double
$sel:playerId:PlayerLatency' :: PlayerLatency -> Maybe Text
$sel:regionIdentifier:PlayerLatency' :: PlayerLatency -> Maybe Text
$sel:latencyInMilliseconds:PlayerLatency' :: PlayerLatency -> Maybe Double
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LatencyInMilliseconds" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
latencyInMilliseconds,
(Text
"RegionIdentifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
regionIdentifier,
(Text
"PlayerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
playerId
]
)