{-# 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.PinpointSmsVoiceV2.Types.SpendLimit where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types.SpendLimitName
import qualified Amazonka.Prelude as Prelude
data SpendLimit = SpendLimit'
{
SpendLimit -> SpendLimitName
name :: SpendLimitName,
SpendLimit -> Integer
enforcedLimit :: Prelude.Integer,
SpendLimit -> Integer
maxLimit :: Prelude.Integer,
SpendLimit -> Bool
overridden :: Prelude.Bool
}
deriving (SpendLimit -> SpendLimit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpendLimit -> SpendLimit -> Bool
$c/= :: SpendLimit -> SpendLimit -> Bool
== :: SpendLimit -> SpendLimit -> Bool
$c== :: SpendLimit -> SpendLimit -> Bool
Prelude.Eq, ReadPrec [SpendLimit]
ReadPrec SpendLimit
Int -> ReadS SpendLimit
ReadS [SpendLimit]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SpendLimit]
$creadListPrec :: ReadPrec [SpendLimit]
readPrec :: ReadPrec SpendLimit
$creadPrec :: ReadPrec SpendLimit
readList :: ReadS [SpendLimit]
$creadList :: ReadS [SpendLimit]
readsPrec :: Int -> ReadS SpendLimit
$creadsPrec :: Int -> ReadS SpendLimit
Prelude.Read, Int -> SpendLimit -> ShowS
[SpendLimit] -> ShowS
SpendLimit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpendLimit] -> ShowS
$cshowList :: [SpendLimit] -> ShowS
show :: SpendLimit -> String
$cshow :: SpendLimit -> String
showsPrec :: Int -> SpendLimit -> ShowS
$cshowsPrec :: Int -> SpendLimit -> ShowS
Prelude.Show, forall x. Rep SpendLimit x -> SpendLimit
forall x. SpendLimit -> Rep SpendLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SpendLimit x -> SpendLimit
$cfrom :: forall x. SpendLimit -> Rep SpendLimit x
Prelude.Generic)
newSpendLimit ::
SpendLimitName ->
Prelude.Integer ->
Prelude.Integer ->
Prelude.Bool ->
SpendLimit
newSpendLimit :: SpendLimitName -> Integer -> Integer -> Bool -> SpendLimit
newSpendLimit
SpendLimitName
pName_
Integer
pEnforcedLimit_
Integer
pMaxLimit_
Bool
pOverridden_ =
SpendLimit'
{ $sel:name:SpendLimit' :: SpendLimitName
name = SpendLimitName
pName_,
$sel:enforcedLimit:SpendLimit' :: Integer
enforcedLimit = Integer
pEnforcedLimit_,
$sel:maxLimit:SpendLimit' :: Integer
maxLimit = Integer
pMaxLimit_,
$sel:overridden:SpendLimit' :: Bool
overridden = Bool
pOverridden_
}
spendLimit_name :: Lens.Lens' SpendLimit SpendLimitName
spendLimit_name :: Lens' SpendLimit SpendLimitName
spendLimit_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpendLimit' {SpendLimitName
name :: SpendLimitName
$sel:name:SpendLimit' :: SpendLimit -> SpendLimitName
name} -> SpendLimitName
name) (\s :: SpendLimit
s@SpendLimit' {} SpendLimitName
a -> SpendLimit
s {$sel:name:SpendLimit' :: SpendLimitName
name = SpendLimitName
a} :: SpendLimit)
spendLimit_enforcedLimit :: Lens.Lens' SpendLimit Prelude.Integer
spendLimit_enforcedLimit :: Lens' SpendLimit Integer
spendLimit_enforcedLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpendLimit' {Integer
enforcedLimit :: Integer
$sel:enforcedLimit:SpendLimit' :: SpendLimit -> Integer
enforcedLimit} -> Integer
enforcedLimit) (\s :: SpendLimit
s@SpendLimit' {} Integer
a -> SpendLimit
s {$sel:enforcedLimit:SpendLimit' :: Integer
enforcedLimit = Integer
a} :: SpendLimit)
spendLimit_maxLimit :: Lens.Lens' SpendLimit Prelude.Integer
spendLimit_maxLimit :: Lens' SpendLimit Integer
spendLimit_maxLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpendLimit' {Integer
maxLimit :: Integer
$sel:maxLimit:SpendLimit' :: SpendLimit -> Integer
maxLimit} -> Integer
maxLimit) (\s :: SpendLimit
s@SpendLimit' {} Integer
a -> SpendLimit
s {$sel:maxLimit:SpendLimit' :: Integer
maxLimit = Integer
a} :: SpendLimit)
spendLimit_overridden :: Lens.Lens' SpendLimit Prelude.Bool
spendLimit_overridden :: Lens' SpendLimit Bool
spendLimit_overridden = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpendLimit' {Bool
overridden :: Bool
$sel:overridden:SpendLimit' :: SpendLimit -> Bool
overridden} -> Bool
overridden) (\s :: SpendLimit
s@SpendLimit' {} Bool
a -> SpendLimit
s {$sel:overridden:SpendLimit' :: Bool
overridden = Bool
a} :: SpendLimit)
instance Data.FromJSON SpendLimit where
parseJSON :: Value -> Parser SpendLimit
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SpendLimit"
( \Object
x ->
SpendLimitName -> Integer -> Integer -> Bool -> SpendLimit
SpendLimit'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EnforcedLimit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"MaxLimit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Overridden")
)
instance Prelude.Hashable SpendLimit where
hashWithSalt :: Int -> SpendLimit -> Int
hashWithSalt Int
_salt SpendLimit' {Bool
Integer
SpendLimitName
overridden :: Bool
maxLimit :: Integer
enforcedLimit :: Integer
name :: SpendLimitName
$sel:overridden:SpendLimit' :: SpendLimit -> Bool
$sel:maxLimit:SpendLimit' :: SpendLimit -> Integer
$sel:enforcedLimit:SpendLimit' :: SpendLimit -> Integer
$sel:name:SpendLimit' :: SpendLimit -> SpendLimitName
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SpendLimitName
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
enforcedLimit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
maxLimit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
overridden
instance Prelude.NFData SpendLimit where
rnf :: SpendLimit -> ()
rnf SpendLimit' {Bool
Integer
SpendLimitName
overridden :: Bool
maxLimit :: Integer
enforcedLimit :: Integer
name :: SpendLimitName
$sel:overridden:SpendLimit' :: SpendLimit -> Bool
$sel:maxLimit:SpendLimit' :: SpendLimit -> Integer
$sel:enforcedLimit:SpendLimit' :: SpendLimit -> Integer
$sel:name:SpendLimit' :: SpendLimit -> SpendLimitName
..} =
forall a. NFData a => a -> ()
Prelude.rnf SpendLimitName
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
enforcedLimit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
maxLimit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
overridden