{-# 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 Amazonka.GameLift.Types.RoutingStrategyType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RoutingStrategy = RoutingStrategy'
{
RoutingStrategy -> Maybe RoutingStrategyType
type' :: Prelude.Maybe RoutingStrategyType,
RoutingStrategy -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
RoutingStrategy -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text
}
deriving (RoutingStrategy -> RoutingStrategy -> Bool
(RoutingStrategy -> RoutingStrategy -> Bool)
-> (RoutingStrategy -> RoutingStrategy -> Bool)
-> Eq RoutingStrategy
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]
(Int -> ReadS RoutingStrategy)
-> ReadS [RoutingStrategy]
-> ReadPrec RoutingStrategy
-> ReadPrec [RoutingStrategy]
-> Read 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
(Int -> RoutingStrategy -> ShowS)
-> (RoutingStrategy -> String)
-> ([RoutingStrategy] -> ShowS)
-> Show RoutingStrategy
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. RoutingStrategy -> Rep RoutingStrategy x)
-> (forall x. Rep RoutingStrategy x -> RoutingStrategy)
-> Generic RoutingStrategy
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' :: Maybe RoutingStrategyType
-> Maybe Text -> Maybe Text -> RoutingStrategy
RoutingStrategy'
{ $sel:type':RoutingStrategy' :: Maybe RoutingStrategyType
type' = Maybe RoutingStrategyType
forall a. Maybe a
Prelude.Nothing,
$sel:message:RoutingStrategy' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fleetId:RoutingStrategy' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
routingStrategy_type :: Lens.Lens' RoutingStrategy (Prelude.Maybe RoutingStrategyType)
routingStrategy_type :: (Maybe RoutingStrategyType -> f (Maybe RoutingStrategyType))
-> RoutingStrategy -> f RoutingStrategy
routingStrategy_type = (RoutingStrategy -> Maybe RoutingStrategyType)
-> (RoutingStrategy
-> Maybe RoutingStrategyType -> RoutingStrategy)
-> Lens
RoutingStrategy
RoutingStrategy
(Maybe RoutingStrategyType)
(Maybe RoutingStrategyType)
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)
routingStrategy_message :: Lens.Lens' RoutingStrategy (Prelude.Maybe Prelude.Text)
routingStrategy_message :: (Maybe Text -> f (Maybe Text))
-> RoutingStrategy -> f RoutingStrategy
routingStrategy_message = (RoutingStrategy -> Maybe Text)
-> (RoutingStrategy -> Maybe Text -> RoutingStrategy)
-> Lens RoutingStrategy RoutingStrategy (Maybe Text) (Maybe Text)
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_fleetId :: Lens.Lens' RoutingStrategy (Prelude.Maybe Prelude.Text)
routingStrategy_fleetId :: (Maybe Text -> f (Maybe Text))
-> RoutingStrategy -> f RoutingStrategy
routingStrategy_fleetId = (RoutingStrategy -> Maybe Text)
-> (RoutingStrategy -> Maybe Text -> RoutingStrategy)
-> Lens RoutingStrategy RoutingStrategy (Maybe Text) (Maybe Text)
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)
instance Core.FromJSON RoutingStrategy where
parseJSON :: Value -> Parser RoutingStrategy
parseJSON =
String
-> (Object -> Parser RoutingStrategy)
-> Value
-> Parser RoutingStrategy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RoutingStrategy"
( \Object
x ->
Maybe RoutingStrategyType
-> Maybe Text -> Maybe Text -> RoutingStrategy
RoutingStrategy'
(Maybe RoutingStrategyType
-> Maybe Text -> Maybe Text -> RoutingStrategy)
-> Parser (Maybe RoutingStrategyType)
-> Parser (Maybe Text -> Maybe Text -> RoutingStrategy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RoutingStrategyType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
Parser (Maybe Text -> Maybe Text -> RoutingStrategy)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RoutingStrategy)
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
"Message")
Parser (Maybe Text -> RoutingStrategy)
-> Parser (Maybe Text) -> Parser RoutingStrategy
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
"FleetId")
)
instance Prelude.Hashable RoutingStrategy
instance Prelude.NFData RoutingStrategy
instance Core.ToJSON RoutingStrategy where
toJSON :: RoutingStrategy -> Value
toJSON RoutingStrategy' {Maybe Text
Maybe RoutingStrategyType
fleetId :: Maybe Text
message :: Maybe Text
type' :: Maybe RoutingStrategyType
$sel:fleetId:RoutingStrategy' :: RoutingStrategy -> Maybe Text
$sel:message:RoutingStrategy' :: RoutingStrategy -> Maybe Text
$sel:type':RoutingStrategy' :: RoutingStrategy -> Maybe RoutingStrategyType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Type" Text -> RoutingStrategyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RoutingStrategyType -> Pair)
-> Maybe RoutingStrategyType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RoutingStrategyType
type',
(Text
"Message" 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
message,
(Text
"FleetId" 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
fleetId
]
)