{-# 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.Pinpoint.Types.JourneyLimits where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data JourneyLimits = JourneyLimits'
{
JourneyLimits -> Maybe Int
messagesPerSecond :: Prelude.Maybe Prelude.Int,
JourneyLimits -> Maybe Int
endpointReentryCap :: Prelude.Maybe Prelude.Int,
JourneyLimits -> Maybe Text
endpointReentryInterval :: Prelude.Maybe Prelude.Text,
JourneyLimits -> Maybe Int
dailyCap :: Prelude.Maybe Prelude.Int
}
deriving (JourneyLimits -> JourneyLimits -> Bool
(JourneyLimits -> JourneyLimits -> Bool)
-> (JourneyLimits -> JourneyLimits -> Bool) -> Eq JourneyLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneyLimits -> JourneyLimits -> Bool
$c/= :: JourneyLimits -> JourneyLimits -> Bool
== :: JourneyLimits -> JourneyLimits -> Bool
$c== :: JourneyLimits -> JourneyLimits -> Bool
Prelude.Eq, ReadPrec [JourneyLimits]
ReadPrec JourneyLimits
Int -> ReadS JourneyLimits
ReadS [JourneyLimits]
(Int -> ReadS JourneyLimits)
-> ReadS [JourneyLimits]
-> ReadPrec JourneyLimits
-> ReadPrec [JourneyLimits]
-> Read JourneyLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneyLimits]
$creadListPrec :: ReadPrec [JourneyLimits]
readPrec :: ReadPrec JourneyLimits
$creadPrec :: ReadPrec JourneyLimits
readList :: ReadS [JourneyLimits]
$creadList :: ReadS [JourneyLimits]
readsPrec :: Int -> ReadS JourneyLimits
$creadsPrec :: Int -> ReadS JourneyLimits
Prelude.Read, Int -> JourneyLimits -> ShowS
[JourneyLimits] -> ShowS
JourneyLimits -> String
(Int -> JourneyLimits -> ShowS)
-> (JourneyLimits -> String)
-> ([JourneyLimits] -> ShowS)
-> Show JourneyLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneyLimits] -> ShowS
$cshowList :: [JourneyLimits] -> ShowS
show :: JourneyLimits -> String
$cshow :: JourneyLimits -> String
showsPrec :: Int -> JourneyLimits -> ShowS
$cshowsPrec :: Int -> JourneyLimits -> ShowS
Prelude.Show, (forall x. JourneyLimits -> Rep JourneyLimits x)
-> (forall x. Rep JourneyLimits x -> JourneyLimits)
-> Generic JourneyLimits
forall x. Rep JourneyLimits x -> JourneyLimits
forall x. JourneyLimits -> Rep JourneyLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JourneyLimits x -> JourneyLimits
$cfrom :: forall x. JourneyLimits -> Rep JourneyLimits x
Prelude.Generic)
newJourneyLimits ::
JourneyLimits
newJourneyLimits :: JourneyLimits
newJourneyLimits =
JourneyLimits' :: Maybe Int -> Maybe Int -> Maybe Text -> Maybe Int -> JourneyLimits
JourneyLimits'
{ $sel:messagesPerSecond:JourneyLimits' :: Maybe Int
messagesPerSecond = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:endpointReentryCap:JourneyLimits' :: Maybe Int
endpointReentryCap = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:endpointReentryInterval:JourneyLimits' :: Maybe Text
endpointReentryInterval = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dailyCap:JourneyLimits' :: Maybe Int
dailyCap = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
journeyLimits_messagesPerSecond :: Lens.Lens' JourneyLimits (Prelude.Maybe Prelude.Int)
journeyLimits_messagesPerSecond :: (Maybe Int -> f (Maybe Int)) -> JourneyLimits -> f JourneyLimits
journeyLimits_messagesPerSecond = (JourneyLimits -> Maybe Int)
-> (JourneyLimits -> Maybe Int -> JourneyLimits)
-> Lens JourneyLimits JourneyLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyLimits' {Maybe Int
messagesPerSecond :: Maybe Int
$sel:messagesPerSecond:JourneyLimits' :: JourneyLimits -> Maybe Int
messagesPerSecond} -> Maybe Int
messagesPerSecond) (\s :: JourneyLimits
s@JourneyLimits' {} Maybe Int
a -> JourneyLimits
s {$sel:messagesPerSecond:JourneyLimits' :: Maybe Int
messagesPerSecond = Maybe Int
a} :: JourneyLimits)
journeyLimits_endpointReentryCap :: Lens.Lens' JourneyLimits (Prelude.Maybe Prelude.Int)
journeyLimits_endpointReentryCap :: (Maybe Int -> f (Maybe Int)) -> JourneyLimits -> f JourneyLimits
journeyLimits_endpointReentryCap = (JourneyLimits -> Maybe Int)
-> (JourneyLimits -> Maybe Int -> JourneyLimits)
-> Lens JourneyLimits JourneyLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyLimits' {Maybe Int
endpointReentryCap :: Maybe Int
$sel:endpointReentryCap:JourneyLimits' :: JourneyLimits -> Maybe Int
endpointReentryCap} -> Maybe Int
endpointReentryCap) (\s :: JourneyLimits
s@JourneyLimits' {} Maybe Int
a -> JourneyLimits
s {$sel:endpointReentryCap:JourneyLimits' :: Maybe Int
endpointReentryCap = Maybe Int
a} :: JourneyLimits)
journeyLimits_endpointReentryInterval :: Lens.Lens' JourneyLimits (Prelude.Maybe Prelude.Text)
journeyLimits_endpointReentryInterval :: (Maybe Text -> f (Maybe Text)) -> JourneyLimits -> f JourneyLimits
journeyLimits_endpointReentryInterval = (JourneyLimits -> Maybe Text)
-> (JourneyLimits -> Maybe Text -> JourneyLimits)
-> Lens JourneyLimits JourneyLimits (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyLimits' {Maybe Text
endpointReentryInterval :: Maybe Text
$sel:endpointReentryInterval:JourneyLimits' :: JourneyLimits -> Maybe Text
endpointReentryInterval} -> Maybe Text
endpointReentryInterval) (\s :: JourneyLimits
s@JourneyLimits' {} Maybe Text
a -> JourneyLimits
s {$sel:endpointReentryInterval:JourneyLimits' :: Maybe Text
endpointReentryInterval = Maybe Text
a} :: JourneyLimits)
journeyLimits_dailyCap :: Lens.Lens' JourneyLimits (Prelude.Maybe Prelude.Int)
journeyLimits_dailyCap :: (Maybe Int -> f (Maybe Int)) -> JourneyLimits -> f JourneyLimits
journeyLimits_dailyCap = (JourneyLimits -> Maybe Int)
-> (JourneyLimits -> Maybe Int -> JourneyLimits)
-> Lens JourneyLimits JourneyLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyLimits' {Maybe Int
dailyCap :: Maybe Int
$sel:dailyCap:JourneyLimits' :: JourneyLimits -> Maybe Int
dailyCap} -> Maybe Int
dailyCap) (\s :: JourneyLimits
s@JourneyLimits' {} Maybe Int
a -> JourneyLimits
s {$sel:dailyCap:JourneyLimits' :: Maybe Int
dailyCap = Maybe Int
a} :: JourneyLimits)
instance Core.FromJSON JourneyLimits where
parseJSON :: Value -> Parser JourneyLimits
parseJSON =
String
-> (Object -> Parser JourneyLimits)
-> Value
-> Parser JourneyLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"JourneyLimits"
( \Object
x ->
Maybe Int -> Maybe Int -> Maybe Text -> Maybe Int -> JourneyLimits
JourneyLimits'
(Maybe Int
-> Maybe Int -> Maybe Text -> Maybe Int -> JourneyLimits)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Text -> Maybe Int -> JourneyLimits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessagesPerSecond")
Parser (Maybe Int -> Maybe Text -> Maybe Int -> JourneyLimits)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Int -> JourneyLimits)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndpointReentryCap")
Parser (Maybe Text -> Maybe Int -> JourneyLimits)
-> Parser (Maybe Text) -> Parser (Maybe Int -> JourneyLimits)
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
"EndpointReentryInterval")
Parser (Maybe Int -> JourneyLimits)
-> Parser (Maybe Int) -> Parser JourneyLimits
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DailyCap")
)
instance Prelude.Hashable JourneyLimits
instance Prelude.NFData JourneyLimits
instance Core.ToJSON JourneyLimits where
toJSON :: JourneyLimits -> Value
toJSON JourneyLimits' {Maybe Int
Maybe Text
dailyCap :: Maybe Int
endpointReentryInterval :: Maybe Text
endpointReentryCap :: Maybe Int
messagesPerSecond :: Maybe Int
$sel:dailyCap:JourneyLimits' :: JourneyLimits -> Maybe Int
$sel:endpointReentryInterval:JourneyLimits' :: JourneyLimits -> Maybe Text
$sel:endpointReentryCap:JourneyLimits' :: JourneyLimits -> Maybe Int
$sel:messagesPerSecond:JourneyLimits' :: JourneyLimits -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MessagesPerSecond" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
messagesPerSecond,
(Text
"EndpointReentryCap" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
endpointReentryCap,
(Text
"EndpointReentryInterval" 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
endpointReentryInterval,
(Text
"DailyCap" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
dailyCap
]
)