{-# 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.Budgets.Types.ActionThreshold where
import Amazonka.Budgets.Types.ThresholdType
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 ActionThreshold = ActionThreshold'
{ ActionThreshold -> Double
actionThresholdValue :: Prelude.Double,
ActionThreshold -> ThresholdType
actionThresholdType :: ThresholdType
}
deriving (ActionThreshold -> ActionThreshold -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionThreshold -> ActionThreshold -> Bool
$c/= :: ActionThreshold -> ActionThreshold -> Bool
== :: ActionThreshold -> ActionThreshold -> Bool
$c== :: ActionThreshold -> ActionThreshold -> Bool
Prelude.Eq, ReadPrec [ActionThreshold]
ReadPrec ActionThreshold
Int -> ReadS ActionThreshold
ReadS [ActionThreshold]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionThreshold]
$creadListPrec :: ReadPrec [ActionThreshold]
readPrec :: ReadPrec ActionThreshold
$creadPrec :: ReadPrec ActionThreshold
readList :: ReadS [ActionThreshold]
$creadList :: ReadS [ActionThreshold]
readsPrec :: Int -> ReadS ActionThreshold
$creadsPrec :: Int -> ReadS ActionThreshold
Prelude.Read, Int -> ActionThreshold -> ShowS
[ActionThreshold] -> ShowS
ActionThreshold -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionThreshold] -> ShowS
$cshowList :: [ActionThreshold] -> ShowS
show :: ActionThreshold -> String
$cshow :: ActionThreshold -> String
showsPrec :: Int -> ActionThreshold -> ShowS
$cshowsPrec :: Int -> ActionThreshold -> ShowS
Prelude.Show, forall x. Rep ActionThreshold x -> ActionThreshold
forall x. ActionThreshold -> Rep ActionThreshold x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionThreshold x -> ActionThreshold
$cfrom :: forall x. ActionThreshold -> Rep ActionThreshold x
Prelude.Generic)
newActionThreshold ::
Prelude.Double ->
ThresholdType ->
ActionThreshold
newActionThreshold :: Double -> ThresholdType -> ActionThreshold
newActionThreshold
Double
pActionThresholdValue_
ThresholdType
pActionThresholdType_ =
ActionThreshold'
{ $sel:actionThresholdValue:ActionThreshold' :: Double
actionThresholdValue =
Double
pActionThresholdValue_,
$sel:actionThresholdType:ActionThreshold' :: ThresholdType
actionThresholdType = ThresholdType
pActionThresholdType_
}
actionThreshold_actionThresholdValue :: Lens.Lens' ActionThreshold Prelude.Double
actionThreshold_actionThresholdValue :: Lens' ActionThreshold Double
actionThreshold_actionThresholdValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionThreshold' {Double
actionThresholdValue :: Double
$sel:actionThresholdValue:ActionThreshold' :: ActionThreshold -> Double
actionThresholdValue} -> Double
actionThresholdValue) (\s :: ActionThreshold
s@ActionThreshold' {} Double
a -> ActionThreshold
s {$sel:actionThresholdValue:ActionThreshold' :: Double
actionThresholdValue = Double
a} :: ActionThreshold)
actionThreshold_actionThresholdType :: Lens.Lens' ActionThreshold ThresholdType
actionThreshold_actionThresholdType :: Lens' ActionThreshold ThresholdType
actionThreshold_actionThresholdType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionThreshold' {ThresholdType
actionThresholdType :: ThresholdType
$sel:actionThresholdType:ActionThreshold' :: ActionThreshold -> ThresholdType
actionThresholdType} -> ThresholdType
actionThresholdType) (\s :: ActionThreshold
s@ActionThreshold' {} ThresholdType
a -> ActionThreshold
s {$sel:actionThresholdType:ActionThreshold' :: ThresholdType
actionThresholdType = ThresholdType
a} :: ActionThreshold)
instance Data.FromJSON ActionThreshold where
parseJSON :: Value -> Parser ActionThreshold
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ActionThreshold"
( \Object
x ->
Double -> ThresholdType -> ActionThreshold
ActionThreshold'
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
"ActionThresholdValue")
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
"ActionThresholdType")
)
instance Prelude.Hashable ActionThreshold where
hashWithSalt :: Int -> ActionThreshold -> Int
hashWithSalt Int
_salt ActionThreshold' {Double
ThresholdType
actionThresholdType :: ThresholdType
actionThresholdValue :: Double
$sel:actionThresholdType:ActionThreshold' :: ActionThreshold -> ThresholdType
$sel:actionThresholdValue:ActionThreshold' :: ActionThreshold -> Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
actionThresholdValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ThresholdType
actionThresholdType
instance Prelude.NFData ActionThreshold where
rnf :: ActionThreshold -> ()
rnf ActionThreshold' {Double
ThresholdType
actionThresholdType :: ThresholdType
actionThresholdValue :: Double
$sel:actionThresholdType:ActionThreshold' :: ActionThreshold -> ThresholdType
$sel:actionThresholdValue:ActionThreshold' :: ActionThreshold -> Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Double
actionThresholdValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ThresholdType
actionThresholdType
instance Data.ToJSON ActionThreshold where
toJSON :: ActionThreshold -> Value
toJSON ActionThreshold' {Double
ThresholdType
actionThresholdType :: ThresholdType
actionThresholdValue :: Double
$sel:actionThresholdType:ActionThreshold' :: ActionThreshold -> ThresholdType
$sel:actionThresholdValue:ActionThreshold' :: ActionThreshold -> Double
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"ActionThresholdValue"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
actionThresholdValue
),
forall a. a -> Maybe a
Prelude.Just
(Key
"ActionThresholdType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ThresholdType
actionThresholdType)
]
)