{-# 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.RoutingStrategy 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.RoutingStrategyType
import qualified Amazonka.Prelude as Prelude
data RoutingStrategy = RoutingStrategy'
{
RoutingStrategy -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
RoutingStrategy -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
RoutingStrategy -> Maybe RoutingStrategyType
type' :: Prelude.Maybe RoutingStrategyType
}
deriving (RoutingStrategy -> RoutingStrategy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoutingStrategy -> RoutingStrategy -> Bool
$c/= :: RoutingStrategy -> RoutingStrategy -> Bool
== :: RoutingStrategy -> RoutingStrategy -> Bool
$c== :: RoutingStrategy -> RoutingStrategy -> Bool
Prelude.Eq, ReadPrec [RoutingStrategy]
ReadPrec RoutingStrategy
Int -> ReadS RoutingStrategy
ReadS [RoutingStrategy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoutingStrategy]
$creadListPrec :: ReadPrec [RoutingStrategy]
readPrec :: ReadPrec RoutingStrategy
$creadPrec :: ReadPrec RoutingStrategy
readList :: ReadS [RoutingStrategy]
$creadList :: ReadS [RoutingStrategy]
readsPrec :: Int -> ReadS RoutingStrategy
$creadsPrec :: Int -> ReadS RoutingStrategy
Prelude.Read, Int -> RoutingStrategy -> ShowS
[RoutingStrategy] -> ShowS
RoutingStrategy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoutingStrategy] -> ShowS
$cshowList :: [RoutingStrategy] -> ShowS
show :: RoutingStrategy -> String
$cshow :: RoutingStrategy -> String
showsPrec :: Int -> RoutingStrategy -> ShowS
$cshowsPrec :: Int -> RoutingStrategy -> ShowS
Prelude.Show, forall x. Rep RoutingStrategy x -> RoutingStrategy
forall x. RoutingStrategy -> Rep RoutingStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoutingStrategy x -> RoutingStrategy
$cfrom :: forall x. RoutingStrategy -> Rep RoutingStrategy x
Prelude.Generic)
newRoutingStrategy ::
RoutingStrategy
newRoutingStrategy :: RoutingStrategy
newRoutingStrategy =
RoutingStrategy'
{ $sel:fleetId:RoutingStrategy' :: Maybe Text
fleetId = forall a. Maybe a
Prelude.Nothing,
$sel:message:RoutingStrategy' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
$sel:type':RoutingStrategy' :: Maybe RoutingStrategyType
type' = forall a. Maybe a
Prelude.Nothing
}
routingStrategy_fleetId :: Lens.Lens' RoutingStrategy (Prelude.Maybe Prelude.Text)
routingStrategy_fleetId :: Lens' RoutingStrategy (Maybe Text)
routingStrategy_fleetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingStrategy' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:RoutingStrategy' :: RoutingStrategy -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: RoutingStrategy
s@RoutingStrategy' {} Maybe Text
a -> RoutingStrategy
s {$sel:fleetId:RoutingStrategy' :: Maybe Text
fleetId = Maybe Text
a} :: RoutingStrategy)
routingStrategy_message :: Lens.Lens' RoutingStrategy (Prelude.Maybe Prelude.Text)
routingStrategy_message :: Lens' RoutingStrategy (Maybe Text)
routingStrategy_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingStrategy' {Maybe Text
message :: Maybe Text
$sel:message:RoutingStrategy' :: RoutingStrategy -> Maybe Text
message} -> Maybe Text
message) (\s :: RoutingStrategy
s@RoutingStrategy' {} Maybe Text
a -> RoutingStrategy
s {$sel:message:RoutingStrategy' :: Maybe Text
message = Maybe Text
a} :: RoutingStrategy)
routingStrategy_type :: Lens.Lens' RoutingStrategy (Prelude.Maybe RoutingStrategyType)
routingStrategy_type :: Lens' RoutingStrategy (Maybe RoutingStrategyType)
routingStrategy_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingStrategy' {Maybe RoutingStrategyType
type' :: Maybe RoutingStrategyType
$sel:type':RoutingStrategy' :: RoutingStrategy -> Maybe RoutingStrategyType
type'} -> Maybe RoutingStrategyType
type') (\s :: RoutingStrategy
s@RoutingStrategy' {} Maybe RoutingStrategyType
a -> RoutingStrategy
s {$sel:type':RoutingStrategy' :: Maybe RoutingStrategyType
type' = Maybe RoutingStrategyType
a} :: RoutingStrategy)
instance Data.FromJSON RoutingStrategy where
parseJSON :: Value -> Parser RoutingStrategy
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RoutingStrategy"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe RoutingStrategyType -> RoutingStrategy
RoutingStrategy'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FleetId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Message")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
)
instance Prelude.Hashable RoutingStrategy where
hashWithSalt :: Int -> RoutingStrategy -> Int
hashWithSalt Int
_salt RoutingStrategy' {Maybe Text
Maybe RoutingStrategyType
type' :: Maybe RoutingStrategyType
message :: Maybe Text
fleetId :: Maybe Text
$sel:type':RoutingStrategy' :: RoutingStrategy -> Maybe RoutingStrategyType
$sel:message:RoutingStrategy' :: RoutingStrategy -> Maybe Text
$sel:fleetId:RoutingStrategy' :: RoutingStrategy -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fleetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RoutingStrategyType
type'
instance Prelude.NFData RoutingStrategy where
rnf :: RoutingStrategy -> ()
rnf RoutingStrategy' {Maybe Text
Maybe RoutingStrategyType
type' :: Maybe RoutingStrategyType
message :: Maybe Text
fleetId :: Maybe Text
$sel:type':RoutingStrategy' :: RoutingStrategy -> Maybe RoutingStrategyType
$sel:message:RoutingStrategy' :: RoutingStrategy -> Maybe Text
$sel:fleetId:RoutingStrategy' :: RoutingStrategy -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fleetId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RoutingStrategyType
type'
instance Data.ToJSON RoutingStrategy where
toJSON :: RoutingStrategy -> Value
toJSON RoutingStrategy' {Maybe Text
Maybe RoutingStrategyType
type' :: Maybe RoutingStrategyType
message :: Maybe Text
fleetId :: Maybe Text
$sel:type':RoutingStrategy' :: RoutingStrategy -> Maybe RoutingStrategyType
$sel:message:RoutingStrategy' :: RoutingStrategy -> Maybe Text
$sel:fleetId:RoutingStrategy' :: RoutingStrategy -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"FleetId" 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
fleetId,
(Key
"Message" 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
message,
(Key
"Type" 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 RoutingStrategyType
type'
]
)