{-# 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.ResourceCreationLimitPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ResourceCreationLimitPolicy = ResourceCreationLimitPolicy'
{
ResourceCreationLimitPolicy -> Maybe Natural
newGameSessionsPerCreator' :: Prelude.Maybe Prelude.Natural,
ResourceCreationLimitPolicy -> Maybe Natural
policyPeriodInMinutes :: Prelude.Maybe Prelude.Natural
}
deriving (ResourceCreationLimitPolicy -> ResourceCreationLimitPolicy -> Bool
(ResourceCreationLimitPolicy
-> ResourceCreationLimitPolicy -> Bool)
-> (ResourceCreationLimitPolicy
-> ResourceCreationLimitPolicy -> Bool)
-> Eq ResourceCreationLimitPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceCreationLimitPolicy -> ResourceCreationLimitPolicy -> Bool
$c/= :: ResourceCreationLimitPolicy -> ResourceCreationLimitPolicy -> Bool
== :: ResourceCreationLimitPolicy -> ResourceCreationLimitPolicy -> Bool
$c== :: ResourceCreationLimitPolicy -> ResourceCreationLimitPolicy -> Bool
Prelude.Eq, ReadPrec [ResourceCreationLimitPolicy]
ReadPrec ResourceCreationLimitPolicy
Int -> ReadS ResourceCreationLimitPolicy
ReadS [ResourceCreationLimitPolicy]
(Int -> ReadS ResourceCreationLimitPolicy)
-> ReadS [ResourceCreationLimitPolicy]
-> ReadPrec ResourceCreationLimitPolicy
-> ReadPrec [ResourceCreationLimitPolicy]
-> Read ResourceCreationLimitPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceCreationLimitPolicy]
$creadListPrec :: ReadPrec [ResourceCreationLimitPolicy]
readPrec :: ReadPrec ResourceCreationLimitPolicy
$creadPrec :: ReadPrec ResourceCreationLimitPolicy
readList :: ReadS [ResourceCreationLimitPolicy]
$creadList :: ReadS [ResourceCreationLimitPolicy]
readsPrec :: Int -> ReadS ResourceCreationLimitPolicy
$creadsPrec :: Int -> ReadS ResourceCreationLimitPolicy
Prelude.Read, Int -> ResourceCreationLimitPolicy -> ShowS
[ResourceCreationLimitPolicy] -> ShowS
ResourceCreationLimitPolicy -> String
(Int -> ResourceCreationLimitPolicy -> ShowS)
-> (ResourceCreationLimitPolicy -> String)
-> ([ResourceCreationLimitPolicy] -> ShowS)
-> Show ResourceCreationLimitPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceCreationLimitPolicy] -> ShowS
$cshowList :: [ResourceCreationLimitPolicy] -> ShowS
show :: ResourceCreationLimitPolicy -> String
$cshow :: ResourceCreationLimitPolicy -> String
showsPrec :: Int -> ResourceCreationLimitPolicy -> ShowS
$cshowsPrec :: Int -> ResourceCreationLimitPolicy -> ShowS
Prelude.Show, (forall x.
ResourceCreationLimitPolicy -> Rep ResourceCreationLimitPolicy x)
-> (forall x.
Rep ResourceCreationLimitPolicy x -> ResourceCreationLimitPolicy)
-> Generic ResourceCreationLimitPolicy
forall x.
Rep ResourceCreationLimitPolicy x -> ResourceCreationLimitPolicy
forall x.
ResourceCreationLimitPolicy -> Rep ResourceCreationLimitPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResourceCreationLimitPolicy x -> ResourceCreationLimitPolicy
$cfrom :: forall x.
ResourceCreationLimitPolicy -> Rep ResourceCreationLimitPolicy x
Prelude.Generic)
newResourceCreationLimitPolicy ::
ResourceCreationLimitPolicy
newResourceCreationLimitPolicy :: ResourceCreationLimitPolicy
newResourceCreationLimitPolicy =
ResourceCreationLimitPolicy' :: Maybe Natural -> Maybe Natural -> ResourceCreationLimitPolicy
ResourceCreationLimitPolicy'
{ $sel:newGameSessionsPerCreator':ResourceCreationLimitPolicy' :: Maybe Natural
newGameSessionsPerCreator' =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:policyPeriodInMinutes:ResourceCreationLimitPolicy' :: Maybe Natural
policyPeriodInMinutes = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
resourceCreationLimitPolicy_newGameSessionsPerCreator :: Lens.Lens' ResourceCreationLimitPolicy (Prelude.Maybe Prelude.Natural)
resourceCreationLimitPolicy_newGameSessionsPerCreator :: (Maybe Natural -> f (Maybe Natural))
-> ResourceCreationLimitPolicy -> f ResourceCreationLimitPolicy
resourceCreationLimitPolicy_newGameSessionsPerCreator = (ResourceCreationLimitPolicy -> Maybe Natural)
-> (ResourceCreationLimitPolicy
-> Maybe Natural -> ResourceCreationLimitPolicy)
-> Lens
ResourceCreationLimitPolicy
ResourceCreationLimitPolicy
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceCreationLimitPolicy' {Maybe Natural
newGameSessionsPerCreator' :: Maybe Natural
$sel:newGameSessionsPerCreator':ResourceCreationLimitPolicy' :: ResourceCreationLimitPolicy -> Maybe Natural
newGameSessionsPerCreator'} -> Maybe Natural
newGameSessionsPerCreator') (\s :: ResourceCreationLimitPolicy
s@ResourceCreationLimitPolicy' {} Maybe Natural
a -> ResourceCreationLimitPolicy
s {$sel:newGameSessionsPerCreator':ResourceCreationLimitPolicy' :: Maybe Natural
newGameSessionsPerCreator' = Maybe Natural
a} :: ResourceCreationLimitPolicy)
resourceCreationLimitPolicy_policyPeriodInMinutes :: Lens.Lens' ResourceCreationLimitPolicy (Prelude.Maybe Prelude.Natural)
resourceCreationLimitPolicy_policyPeriodInMinutes :: (Maybe Natural -> f (Maybe Natural))
-> ResourceCreationLimitPolicy -> f ResourceCreationLimitPolicy
resourceCreationLimitPolicy_policyPeriodInMinutes = (ResourceCreationLimitPolicy -> Maybe Natural)
-> (ResourceCreationLimitPolicy
-> Maybe Natural -> ResourceCreationLimitPolicy)
-> Lens
ResourceCreationLimitPolicy
ResourceCreationLimitPolicy
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceCreationLimitPolicy' {Maybe Natural
policyPeriodInMinutes :: Maybe Natural
$sel:policyPeriodInMinutes:ResourceCreationLimitPolicy' :: ResourceCreationLimitPolicy -> Maybe Natural
policyPeriodInMinutes} -> Maybe Natural
policyPeriodInMinutes) (\s :: ResourceCreationLimitPolicy
s@ResourceCreationLimitPolicy' {} Maybe Natural
a -> ResourceCreationLimitPolicy
s {$sel:policyPeriodInMinutes:ResourceCreationLimitPolicy' :: Maybe Natural
policyPeriodInMinutes = Maybe Natural
a} :: ResourceCreationLimitPolicy)
instance Core.FromJSON ResourceCreationLimitPolicy where
parseJSON :: Value -> Parser ResourceCreationLimitPolicy
parseJSON =
String
-> (Object -> Parser ResourceCreationLimitPolicy)
-> Value
-> Parser ResourceCreationLimitPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ResourceCreationLimitPolicy"
( \Object
x ->
Maybe Natural -> Maybe Natural -> ResourceCreationLimitPolicy
ResourceCreationLimitPolicy'
(Maybe Natural -> Maybe Natural -> ResourceCreationLimitPolicy)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> ResourceCreationLimitPolicy)
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
"NewGameSessionsPerCreator")
Parser (Maybe Natural -> ResourceCreationLimitPolicy)
-> Parser (Maybe Natural) -> Parser ResourceCreationLimitPolicy
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
"PolicyPeriodInMinutes")
)
instance Prelude.Hashable ResourceCreationLimitPolicy
instance Prelude.NFData ResourceCreationLimitPolicy
instance Core.ToJSON ResourceCreationLimitPolicy where
toJSON :: ResourceCreationLimitPolicy -> Value
toJSON ResourceCreationLimitPolicy' {Maybe Natural
policyPeriodInMinutes :: Maybe Natural
newGameSessionsPerCreator' :: Maybe Natural
$sel:policyPeriodInMinutes:ResourceCreationLimitPolicy' :: ResourceCreationLimitPolicy -> Maybe Natural
$sel:newGameSessionsPerCreator':ResourceCreationLimitPolicy' :: ResourceCreationLimitPolicy -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NewGameSessionsPerCreator" 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
newGameSessionsPerCreator',
(Text
"PolicyPeriodInMinutes" 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
policyPeriodInMinutes
]
)