{-# 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.CampaignLimits where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CampaignLimits = CampaignLimits'
{
CampaignLimits -> Maybe Int
messagesPerSecond :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
daily :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
total :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
session :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
maximumDuration :: Prelude.Maybe Prelude.Int
}
deriving (CampaignLimits -> CampaignLimits -> Bool
(CampaignLimits -> CampaignLimits -> Bool)
-> (CampaignLimits -> CampaignLimits -> Bool) -> Eq CampaignLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CampaignLimits -> CampaignLimits -> Bool
$c/= :: CampaignLimits -> CampaignLimits -> Bool
== :: CampaignLimits -> CampaignLimits -> Bool
$c== :: CampaignLimits -> CampaignLimits -> Bool
Prelude.Eq, ReadPrec [CampaignLimits]
ReadPrec CampaignLimits
Int -> ReadS CampaignLimits
ReadS [CampaignLimits]
(Int -> ReadS CampaignLimits)
-> ReadS [CampaignLimits]
-> ReadPrec CampaignLimits
-> ReadPrec [CampaignLimits]
-> Read CampaignLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CampaignLimits]
$creadListPrec :: ReadPrec [CampaignLimits]
readPrec :: ReadPrec CampaignLimits
$creadPrec :: ReadPrec CampaignLimits
readList :: ReadS [CampaignLimits]
$creadList :: ReadS [CampaignLimits]
readsPrec :: Int -> ReadS CampaignLimits
$creadsPrec :: Int -> ReadS CampaignLimits
Prelude.Read, Int -> CampaignLimits -> ShowS
[CampaignLimits] -> ShowS
CampaignLimits -> String
(Int -> CampaignLimits -> ShowS)
-> (CampaignLimits -> String)
-> ([CampaignLimits] -> ShowS)
-> Show CampaignLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CampaignLimits] -> ShowS
$cshowList :: [CampaignLimits] -> ShowS
show :: CampaignLimits -> String
$cshow :: CampaignLimits -> String
showsPrec :: Int -> CampaignLimits -> ShowS
$cshowsPrec :: Int -> CampaignLimits -> ShowS
Prelude.Show, (forall x. CampaignLimits -> Rep CampaignLimits x)
-> (forall x. Rep CampaignLimits x -> CampaignLimits)
-> Generic CampaignLimits
forall x. Rep CampaignLimits x -> CampaignLimits
forall x. CampaignLimits -> Rep CampaignLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CampaignLimits x -> CampaignLimits
$cfrom :: forall x. CampaignLimits -> Rep CampaignLimits x
Prelude.Generic)
newCampaignLimits ::
CampaignLimits
newCampaignLimits :: CampaignLimits
newCampaignLimits =
CampaignLimits' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> CampaignLimits
CampaignLimits'
{ $sel:messagesPerSecond:CampaignLimits' :: Maybe Int
messagesPerSecond =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:daily:CampaignLimits' :: Maybe Int
daily = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:total:CampaignLimits' :: Maybe Int
total = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:session:CampaignLimits' :: Maybe Int
session = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:maximumDuration:CampaignLimits' :: Maybe Int
maximumDuration = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
campaignLimits_messagesPerSecond :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_messagesPerSecond :: (Maybe Int -> f (Maybe Int)) -> CampaignLimits -> f CampaignLimits
campaignLimits_messagesPerSecond = (CampaignLimits -> Maybe Int)
-> (CampaignLimits -> Maybe Int -> CampaignLimits)
-> Lens CampaignLimits CampaignLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignLimits' {Maybe Int
messagesPerSecond :: Maybe Int
$sel:messagesPerSecond:CampaignLimits' :: CampaignLimits -> Maybe Int
messagesPerSecond} -> Maybe Int
messagesPerSecond) (\s :: CampaignLimits
s@CampaignLimits' {} Maybe Int
a -> CampaignLimits
s {$sel:messagesPerSecond:CampaignLimits' :: Maybe Int
messagesPerSecond = Maybe Int
a} :: CampaignLimits)
campaignLimits_daily :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_daily :: (Maybe Int -> f (Maybe Int)) -> CampaignLimits -> f CampaignLimits
campaignLimits_daily = (CampaignLimits -> Maybe Int)
-> (CampaignLimits -> Maybe Int -> CampaignLimits)
-> Lens CampaignLimits CampaignLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignLimits' {Maybe Int
daily :: Maybe Int
$sel:daily:CampaignLimits' :: CampaignLimits -> Maybe Int
daily} -> Maybe Int
daily) (\s :: CampaignLimits
s@CampaignLimits' {} Maybe Int
a -> CampaignLimits
s {$sel:daily:CampaignLimits' :: Maybe Int
daily = Maybe Int
a} :: CampaignLimits)
campaignLimits_total :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_total :: (Maybe Int -> f (Maybe Int)) -> CampaignLimits -> f CampaignLimits
campaignLimits_total = (CampaignLimits -> Maybe Int)
-> (CampaignLimits -> Maybe Int -> CampaignLimits)
-> Lens CampaignLimits CampaignLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignLimits' {Maybe Int
total :: Maybe Int
$sel:total:CampaignLimits' :: CampaignLimits -> Maybe Int
total} -> Maybe Int
total) (\s :: CampaignLimits
s@CampaignLimits' {} Maybe Int
a -> CampaignLimits
s {$sel:total:CampaignLimits' :: Maybe Int
total = Maybe Int
a} :: CampaignLimits)
campaignLimits_session :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_session :: (Maybe Int -> f (Maybe Int)) -> CampaignLimits -> f CampaignLimits
campaignLimits_session = (CampaignLimits -> Maybe Int)
-> (CampaignLimits -> Maybe Int -> CampaignLimits)
-> Lens CampaignLimits CampaignLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignLimits' {Maybe Int
session :: Maybe Int
$sel:session:CampaignLimits' :: CampaignLimits -> Maybe Int
session} -> Maybe Int
session) (\s :: CampaignLimits
s@CampaignLimits' {} Maybe Int
a -> CampaignLimits
s {$sel:session:CampaignLimits' :: Maybe Int
session = Maybe Int
a} :: CampaignLimits)
campaignLimits_maximumDuration :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_maximumDuration :: (Maybe Int -> f (Maybe Int)) -> CampaignLimits -> f CampaignLimits
campaignLimits_maximumDuration = (CampaignLimits -> Maybe Int)
-> (CampaignLimits -> Maybe Int -> CampaignLimits)
-> Lens CampaignLimits CampaignLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignLimits' {Maybe Int
maximumDuration :: Maybe Int
$sel:maximumDuration:CampaignLimits' :: CampaignLimits -> Maybe Int
maximumDuration} -> Maybe Int
maximumDuration) (\s :: CampaignLimits
s@CampaignLimits' {} Maybe Int
a -> CampaignLimits
s {$sel:maximumDuration:CampaignLimits' :: Maybe Int
maximumDuration = Maybe Int
a} :: CampaignLimits)
instance Core.FromJSON CampaignLimits where
parseJSON :: Value -> Parser CampaignLimits
parseJSON =
String
-> (Object -> Parser CampaignLimits)
-> Value
-> Parser CampaignLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CampaignLimits"
( \Object
x ->
Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> CampaignLimits
CampaignLimits'
(Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> CampaignLimits)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Int -> Maybe Int -> Maybe Int -> CampaignLimits)
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 Int -> Maybe Int -> Maybe Int -> CampaignLimits)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> Maybe Int -> CampaignLimits)
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
"Daily")
Parser (Maybe Int -> Maybe Int -> Maybe Int -> CampaignLimits)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> CampaignLimits)
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
"Total")
Parser (Maybe Int -> Maybe Int -> CampaignLimits)
-> Parser (Maybe Int) -> Parser (Maybe Int -> CampaignLimits)
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
"Session")
Parser (Maybe Int -> CampaignLimits)
-> Parser (Maybe Int) -> Parser CampaignLimits
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
"MaximumDuration")
)
instance Prelude.Hashable CampaignLimits
instance Prelude.NFData CampaignLimits
instance Core.ToJSON CampaignLimits where
toJSON :: CampaignLimits -> Value
toJSON CampaignLimits' {Maybe Int
maximumDuration :: Maybe Int
session :: Maybe Int
total :: Maybe Int
daily :: Maybe Int
messagesPerSecond :: Maybe Int
$sel:maximumDuration:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:session:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:total:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:daily:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:messagesPerSecond:CampaignLimits' :: CampaignLimits -> 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
"Daily" 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
daily,
(Text
"Total" 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
total,
(Text
"Session" 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
session,
(Text
"MaximumDuration" 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
maximumDuration
]
)