{-# 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.EMR.Types.ScalingTrigger where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.CloudWatchAlarmDefinition
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ScalingTrigger = ScalingTrigger'
{
ScalingTrigger -> CloudWatchAlarmDefinition
cloudWatchAlarmDefinition :: CloudWatchAlarmDefinition
}
deriving (ScalingTrigger -> ScalingTrigger -> Bool
(ScalingTrigger -> ScalingTrigger -> Bool)
-> (ScalingTrigger -> ScalingTrigger -> Bool) -> Eq ScalingTrigger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingTrigger -> ScalingTrigger -> Bool
$c/= :: ScalingTrigger -> ScalingTrigger -> Bool
== :: ScalingTrigger -> ScalingTrigger -> Bool
$c== :: ScalingTrigger -> ScalingTrigger -> Bool
Prelude.Eq, ReadPrec [ScalingTrigger]
ReadPrec ScalingTrigger
Int -> ReadS ScalingTrigger
ReadS [ScalingTrigger]
(Int -> ReadS ScalingTrigger)
-> ReadS [ScalingTrigger]
-> ReadPrec ScalingTrigger
-> ReadPrec [ScalingTrigger]
-> Read ScalingTrigger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingTrigger]
$creadListPrec :: ReadPrec [ScalingTrigger]
readPrec :: ReadPrec ScalingTrigger
$creadPrec :: ReadPrec ScalingTrigger
readList :: ReadS [ScalingTrigger]
$creadList :: ReadS [ScalingTrigger]
readsPrec :: Int -> ReadS ScalingTrigger
$creadsPrec :: Int -> ReadS ScalingTrigger
Prelude.Read, Int -> ScalingTrigger -> ShowS
[ScalingTrigger] -> ShowS
ScalingTrigger -> String
(Int -> ScalingTrigger -> ShowS)
-> (ScalingTrigger -> String)
-> ([ScalingTrigger] -> ShowS)
-> Show ScalingTrigger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingTrigger] -> ShowS
$cshowList :: [ScalingTrigger] -> ShowS
show :: ScalingTrigger -> String
$cshow :: ScalingTrigger -> String
showsPrec :: Int -> ScalingTrigger -> ShowS
$cshowsPrec :: Int -> ScalingTrigger -> ShowS
Prelude.Show, (forall x. ScalingTrigger -> Rep ScalingTrigger x)
-> (forall x. Rep ScalingTrigger x -> ScalingTrigger)
-> Generic ScalingTrigger
forall x. Rep ScalingTrigger x -> ScalingTrigger
forall x. ScalingTrigger -> Rep ScalingTrigger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingTrigger x -> ScalingTrigger
$cfrom :: forall x. ScalingTrigger -> Rep ScalingTrigger x
Prelude.Generic)
newScalingTrigger ::
CloudWatchAlarmDefinition ->
ScalingTrigger
newScalingTrigger :: CloudWatchAlarmDefinition -> ScalingTrigger
newScalingTrigger CloudWatchAlarmDefinition
pCloudWatchAlarmDefinition_ =
ScalingTrigger' :: CloudWatchAlarmDefinition -> ScalingTrigger
ScalingTrigger'
{ $sel:cloudWatchAlarmDefinition:ScalingTrigger' :: CloudWatchAlarmDefinition
cloudWatchAlarmDefinition =
CloudWatchAlarmDefinition
pCloudWatchAlarmDefinition_
}
scalingTrigger_cloudWatchAlarmDefinition :: Lens.Lens' ScalingTrigger CloudWatchAlarmDefinition
scalingTrigger_cloudWatchAlarmDefinition :: (CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition)
-> ScalingTrigger -> f ScalingTrigger
scalingTrigger_cloudWatchAlarmDefinition = (ScalingTrigger -> CloudWatchAlarmDefinition)
-> (ScalingTrigger -> CloudWatchAlarmDefinition -> ScalingTrigger)
-> Lens
ScalingTrigger
ScalingTrigger
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingTrigger' {CloudWatchAlarmDefinition
cloudWatchAlarmDefinition :: CloudWatchAlarmDefinition
$sel:cloudWatchAlarmDefinition:ScalingTrigger' :: ScalingTrigger -> CloudWatchAlarmDefinition
cloudWatchAlarmDefinition} -> CloudWatchAlarmDefinition
cloudWatchAlarmDefinition) (\s :: ScalingTrigger
s@ScalingTrigger' {} CloudWatchAlarmDefinition
a -> ScalingTrigger
s {$sel:cloudWatchAlarmDefinition:ScalingTrigger' :: CloudWatchAlarmDefinition
cloudWatchAlarmDefinition = CloudWatchAlarmDefinition
a} :: ScalingTrigger)
instance Core.FromJSON ScalingTrigger where
parseJSON :: Value -> Parser ScalingTrigger
parseJSON =
String
-> (Object -> Parser ScalingTrigger)
-> Value
-> Parser ScalingTrigger
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ScalingTrigger"
( \Object
x ->
CloudWatchAlarmDefinition -> ScalingTrigger
ScalingTrigger'
(CloudWatchAlarmDefinition -> ScalingTrigger)
-> Parser CloudWatchAlarmDefinition -> Parser ScalingTrigger
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser CloudWatchAlarmDefinition
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CloudWatchAlarmDefinition")
)
instance Prelude.Hashable ScalingTrigger
instance Prelude.NFData ScalingTrigger
instance Core.ToJSON ScalingTrigger where
toJSON :: ScalingTrigger -> Value
toJSON ScalingTrigger' {CloudWatchAlarmDefinition
cloudWatchAlarmDefinition :: CloudWatchAlarmDefinition
$sel:cloudWatchAlarmDefinition:ScalingTrigger' :: ScalingTrigger -> CloudWatchAlarmDefinition
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"CloudWatchAlarmDefinition"
Text -> CloudWatchAlarmDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CloudWatchAlarmDefinition
cloudWatchAlarmDefinition
)
]
)