{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data CampaignLimits = CampaignLimits'
{
CampaignLimits -> Maybe Int
daily :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
maximumDuration :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
messagesPerSecond :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
session :: Prelude.Maybe Prelude.Int,
CampaignLimits -> Maybe Int
total :: Prelude.Maybe Prelude.Int
}
deriving (CampaignLimits -> CampaignLimits -> Bool
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]
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
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. 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'
{ $sel:daily:CampaignLimits' :: Maybe Int
daily = forall a. Maybe a
Prelude.Nothing,
$sel:maximumDuration:CampaignLimits' :: Maybe Int
maximumDuration = forall a. Maybe a
Prelude.Nothing,
$sel:messagesPerSecond:CampaignLimits' :: Maybe Int
messagesPerSecond = forall a. Maybe a
Prelude.Nothing,
$sel:session:CampaignLimits' :: Maybe Int
session = forall a. Maybe a
Prelude.Nothing,
$sel:total:CampaignLimits' :: Maybe Int
total = forall a. Maybe a
Prelude.Nothing
}
campaignLimits_daily :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_daily :: Lens' CampaignLimits (Maybe Int)
campaignLimits_daily = 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_maximumDuration :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_maximumDuration :: Lens' CampaignLimits (Maybe Int)
campaignLimits_maximumDuration = 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)
campaignLimits_messagesPerSecond :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_messagesPerSecond :: Lens' CampaignLimits (Maybe Int)
campaignLimits_messagesPerSecond = 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_session :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_session :: Lens' CampaignLimits (Maybe Int)
campaignLimits_session = 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_total :: Lens.Lens' CampaignLimits (Prelude.Maybe Prelude.Int)
campaignLimits_total :: Lens' CampaignLimits (Maybe Int)
campaignLimits_total = 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)
instance Data.FromJSON CampaignLimits where
parseJSON :: Value -> Parser CampaignLimits
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CampaignLimits"
( \Object
x ->
Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> CampaignLimits
CampaignLimits'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Daily")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MaximumDuration")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MessagesPerSecond")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Session")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Total")
)
instance Prelude.Hashable CampaignLimits where
hashWithSalt :: Int -> CampaignLimits -> Int
hashWithSalt Int
_salt CampaignLimits' {Maybe Int
total :: Maybe Int
session :: Maybe Int
messagesPerSecond :: Maybe Int
maximumDuration :: Maybe Int
daily :: Maybe Int
$sel:total:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:session:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:messagesPerSecond:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:maximumDuration:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:daily:CampaignLimits' :: CampaignLimits -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
daily
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maximumDuration
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
messagesPerSecond
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
session
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
total
instance Prelude.NFData CampaignLimits where
rnf :: CampaignLimits -> ()
rnf CampaignLimits' {Maybe Int
total :: Maybe Int
session :: Maybe Int
messagesPerSecond :: Maybe Int
maximumDuration :: Maybe Int
daily :: Maybe Int
$sel:total:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:session:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:messagesPerSecond:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:maximumDuration:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:daily:CampaignLimits' :: CampaignLimits -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
daily
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maximumDuration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
messagesPerSecond
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
session
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
total
instance Data.ToJSON CampaignLimits where
toJSON :: CampaignLimits -> Value
toJSON CampaignLimits' {Maybe Int
total :: Maybe Int
session :: Maybe Int
messagesPerSecond :: Maybe Int
maximumDuration :: Maybe Int
daily :: Maybe Int
$sel:total:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:session:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:messagesPerSecond:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:maximumDuration:CampaignLimits' :: CampaignLimits -> Maybe Int
$sel:daily:CampaignLimits' :: CampaignLimits -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Daily" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
daily,
(Key
"MaximumDuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maximumDuration,
(Key
"MessagesPerSecond" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
messagesPerSecond,
(Key
"Session" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
session,
(Key
"Total" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
total
]
)