{-# 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.PriorityConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.PriorityType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PriorityConfiguration = PriorityConfiguration'
{
PriorityConfiguration -> Maybe (NonEmpty PriorityType)
priorityOrder :: Prelude.Maybe (Prelude.NonEmpty PriorityType),
PriorityConfiguration -> Maybe (NonEmpty Text)
locationOrder :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
}
deriving (PriorityConfiguration -> PriorityConfiguration -> Bool
(PriorityConfiguration -> PriorityConfiguration -> Bool)
-> (PriorityConfiguration -> PriorityConfiguration -> Bool)
-> Eq PriorityConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PriorityConfiguration -> PriorityConfiguration -> Bool
$c/= :: PriorityConfiguration -> PriorityConfiguration -> Bool
== :: PriorityConfiguration -> PriorityConfiguration -> Bool
$c== :: PriorityConfiguration -> PriorityConfiguration -> Bool
Prelude.Eq, ReadPrec [PriorityConfiguration]
ReadPrec PriorityConfiguration
Int -> ReadS PriorityConfiguration
ReadS [PriorityConfiguration]
(Int -> ReadS PriorityConfiguration)
-> ReadS [PriorityConfiguration]
-> ReadPrec PriorityConfiguration
-> ReadPrec [PriorityConfiguration]
-> Read PriorityConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PriorityConfiguration]
$creadListPrec :: ReadPrec [PriorityConfiguration]
readPrec :: ReadPrec PriorityConfiguration
$creadPrec :: ReadPrec PriorityConfiguration
readList :: ReadS [PriorityConfiguration]
$creadList :: ReadS [PriorityConfiguration]
readsPrec :: Int -> ReadS PriorityConfiguration
$creadsPrec :: Int -> ReadS PriorityConfiguration
Prelude.Read, Int -> PriorityConfiguration -> ShowS
[PriorityConfiguration] -> ShowS
PriorityConfiguration -> String
(Int -> PriorityConfiguration -> ShowS)
-> (PriorityConfiguration -> String)
-> ([PriorityConfiguration] -> ShowS)
-> Show PriorityConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PriorityConfiguration] -> ShowS
$cshowList :: [PriorityConfiguration] -> ShowS
show :: PriorityConfiguration -> String
$cshow :: PriorityConfiguration -> String
showsPrec :: Int -> PriorityConfiguration -> ShowS
$cshowsPrec :: Int -> PriorityConfiguration -> ShowS
Prelude.Show, (forall x. PriorityConfiguration -> Rep PriorityConfiguration x)
-> (forall x. Rep PriorityConfiguration x -> PriorityConfiguration)
-> Generic PriorityConfiguration
forall x. Rep PriorityConfiguration x -> PriorityConfiguration
forall x. PriorityConfiguration -> Rep PriorityConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PriorityConfiguration x -> PriorityConfiguration
$cfrom :: forall x. PriorityConfiguration -> Rep PriorityConfiguration x
Prelude.Generic)
newPriorityConfiguration ::
PriorityConfiguration
newPriorityConfiguration :: PriorityConfiguration
newPriorityConfiguration =
PriorityConfiguration' :: Maybe (NonEmpty PriorityType)
-> Maybe (NonEmpty Text) -> PriorityConfiguration
PriorityConfiguration'
{ $sel:priorityOrder:PriorityConfiguration' :: Maybe (NonEmpty PriorityType)
priorityOrder =
Maybe (NonEmpty PriorityType)
forall a. Maybe a
Prelude.Nothing,
$sel:locationOrder:PriorityConfiguration' :: Maybe (NonEmpty Text)
locationOrder = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing
}
priorityConfiguration_priorityOrder :: Lens.Lens' PriorityConfiguration (Prelude.Maybe (Prelude.NonEmpty PriorityType))
priorityConfiguration_priorityOrder :: (Maybe (NonEmpty PriorityType)
-> f (Maybe (NonEmpty PriorityType)))
-> PriorityConfiguration -> f PriorityConfiguration
priorityConfiguration_priorityOrder = (PriorityConfiguration -> Maybe (NonEmpty PriorityType))
-> (PriorityConfiguration
-> Maybe (NonEmpty PriorityType) -> PriorityConfiguration)
-> Lens
PriorityConfiguration
PriorityConfiguration
(Maybe (NonEmpty PriorityType))
(Maybe (NonEmpty PriorityType))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PriorityConfiguration' {Maybe (NonEmpty PriorityType)
priorityOrder :: Maybe (NonEmpty PriorityType)
$sel:priorityOrder:PriorityConfiguration' :: PriorityConfiguration -> Maybe (NonEmpty PriorityType)
priorityOrder} -> Maybe (NonEmpty PriorityType)
priorityOrder) (\s :: PriorityConfiguration
s@PriorityConfiguration' {} Maybe (NonEmpty PriorityType)
a -> PriorityConfiguration
s {$sel:priorityOrder:PriorityConfiguration' :: Maybe (NonEmpty PriorityType)
priorityOrder = Maybe (NonEmpty PriorityType)
a} :: PriorityConfiguration) ((Maybe (NonEmpty PriorityType)
-> f (Maybe (NonEmpty PriorityType)))
-> PriorityConfiguration -> f PriorityConfiguration)
-> ((Maybe (NonEmpty PriorityType)
-> f (Maybe (NonEmpty PriorityType)))
-> Maybe (NonEmpty PriorityType)
-> f (Maybe (NonEmpty PriorityType)))
-> (Maybe (NonEmpty PriorityType)
-> f (Maybe (NonEmpty PriorityType)))
-> PriorityConfiguration
-> f PriorityConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty PriorityType)
(NonEmpty PriorityType)
(NonEmpty PriorityType)
(NonEmpty PriorityType)
-> Iso
(Maybe (NonEmpty PriorityType))
(Maybe (NonEmpty PriorityType))
(Maybe (NonEmpty PriorityType))
(Maybe (NonEmpty PriorityType))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty PriorityType)
(NonEmpty PriorityType)
(NonEmpty PriorityType)
(NonEmpty PriorityType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
priorityConfiguration_locationOrder :: Lens.Lens' PriorityConfiguration (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
priorityConfiguration_locationOrder :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PriorityConfiguration -> f PriorityConfiguration
priorityConfiguration_locationOrder = (PriorityConfiguration -> Maybe (NonEmpty Text))
-> (PriorityConfiguration
-> Maybe (NonEmpty Text) -> PriorityConfiguration)
-> Lens
PriorityConfiguration
PriorityConfiguration
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PriorityConfiguration' {Maybe (NonEmpty Text)
locationOrder :: Maybe (NonEmpty Text)
$sel:locationOrder:PriorityConfiguration' :: PriorityConfiguration -> Maybe (NonEmpty Text)
locationOrder} -> Maybe (NonEmpty Text)
locationOrder) (\s :: PriorityConfiguration
s@PriorityConfiguration' {} Maybe (NonEmpty Text)
a -> PriorityConfiguration
s {$sel:locationOrder:PriorityConfiguration' :: Maybe (NonEmpty Text)
locationOrder = Maybe (NonEmpty Text)
a} :: PriorityConfiguration) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PriorityConfiguration -> f PriorityConfiguration)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PriorityConfiguration
-> f PriorityConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PriorityConfiguration where
parseJSON :: Value -> Parser PriorityConfiguration
parseJSON =
String
-> (Object -> Parser PriorityConfiguration)
-> Value
-> Parser PriorityConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PriorityConfiguration"
( \Object
x ->
Maybe (NonEmpty PriorityType)
-> Maybe (NonEmpty Text) -> PriorityConfiguration
PriorityConfiguration'
(Maybe (NonEmpty PriorityType)
-> Maybe (NonEmpty Text) -> PriorityConfiguration)
-> Parser (Maybe (NonEmpty PriorityType))
-> Parser (Maybe (NonEmpty Text) -> PriorityConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty PriorityType))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PriorityOrder")
Parser (Maybe (NonEmpty Text) -> PriorityConfiguration)
-> Parser (Maybe (NonEmpty Text)) -> Parser PriorityConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocationOrder")
)
instance Prelude.Hashable PriorityConfiguration
instance Prelude.NFData PriorityConfiguration
instance Core.ToJSON PriorityConfiguration where
toJSON :: PriorityConfiguration -> Value
toJSON PriorityConfiguration' {Maybe (NonEmpty Text)
Maybe (NonEmpty PriorityType)
locationOrder :: Maybe (NonEmpty Text)
priorityOrder :: Maybe (NonEmpty PriorityType)
$sel:locationOrder:PriorityConfiguration' :: PriorityConfiguration -> Maybe (NonEmpty Text)
$sel:priorityOrder:PriorityConfiguration' :: PriorityConfiguration -> Maybe (NonEmpty PriorityType)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PriorityOrder" Text -> NonEmpty PriorityType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty PriorityType -> Pair)
-> Maybe (NonEmpty PriorityType) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty PriorityType)
priorityOrder,
(Text
"LocationOrder" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
locationOrder
]
)