{-# 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.IoT.Types.CloudwatchAlarmAction 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 CloudwatchAlarmAction = CloudwatchAlarmAction'
{
CloudwatchAlarmAction -> Text
roleArn :: Prelude.Text,
CloudwatchAlarmAction -> Text
alarmName :: Prelude.Text,
CloudwatchAlarmAction -> Text
stateReason :: Prelude.Text,
CloudwatchAlarmAction -> Text
stateValue :: Prelude.Text
}
deriving (CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool
$c/= :: CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool
== :: CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool
$c== :: CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool
Prelude.Eq, ReadPrec [CloudwatchAlarmAction]
ReadPrec CloudwatchAlarmAction
Int -> ReadS CloudwatchAlarmAction
ReadS [CloudwatchAlarmAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudwatchAlarmAction]
$creadListPrec :: ReadPrec [CloudwatchAlarmAction]
readPrec :: ReadPrec CloudwatchAlarmAction
$creadPrec :: ReadPrec CloudwatchAlarmAction
readList :: ReadS [CloudwatchAlarmAction]
$creadList :: ReadS [CloudwatchAlarmAction]
readsPrec :: Int -> ReadS CloudwatchAlarmAction
$creadsPrec :: Int -> ReadS CloudwatchAlarmAction
Prelude.Read, Int -> CloudwatchAlarmAction -> ShowS
[CloudwatchAlarmAction] -> ShowS
CloudwatchAlarmAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudwatchAlarmAction] -> ShowS
$cshowList :: [CloudwatchAlarmAction] -> ShowS
show :: CloudwatchAlarmAction -> String
$cshow :: CloudwatchAlarmAction -> String
showsPrec :: Int -> CloudwatchAlarmAction -> ShowS
$cshowsPrec :: Int -> CloudwatchAlarmAction -> ShowS
Prelude.Show, forall x. Rep CloudwatchAlarmAction x -> CloudwatchAlarmAction
forall x. CloudwatchAlarmAction -> Rep CloudwatchAlarmAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudwatchAlarmAction x -> CloudwatchAlarmAction
$cfrom :: forall x. CloudwatchAlarmAction -> Rep CloudwatchAlarmAction x
Prelude.Generic)
newCloudwatchAlarmAction ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CloudwatchAlarmAction
newCloudwatchAlarmAction :: Text -> Text -> Text -> Text -> CloudwatchAlarmAction
newCloudwatchAlarmAction
Text
pRoleArn_
Text
pAlarmName_
Text
pStateReason_
Text
pStateValue_ =
CloudwatchAlarmAction'
{ $sel:roleArn:CloudwatchAlarmAction' :: Text
roleArn = Text
pRoleArn_,
$sel:alarmName:CloudwatchAlarmAction' :: Text
alarmName = Text
pAlarmName_,
$sel:stateReason:CloudwatchAlarmAction' :: Text
stateReason = Text
pStateReason_,
$sel:stateValue:CloudwatchAlarmAction' :: Text
stateValue = Text
pStateValue_
}
cloudwatchAlarmAction_roleArn :: Lens.Lens' CloudwatchAlarmAction Prelude.Text
cloudwatchAlarmAction_roleArn :: Lens' CloudwatchAlarmAction Text
cloudwatchAlarmAction_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchAlarmAction' {Text
roleArn :: Text
$sel:roleArn:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
roleArn} -> Text
roleArn) (\s :: CloudwatchAlarmAction
s@CloudwatchAlarmAction' {} Text
a -> CloudwatchAlarmAction
s {$sel:roleArn:CloudwatchAlarmAction' :: Text
roleArn = Text
a} :: CloudwatchAlarmAction)
cloudwatchAlarmAction_alarmName :: Lens.Lens' CloudwatchAlarmAction Prelude.Text
cloudwatchAlarmAction_alarmName :: Lens' CloudwatchAlarmAction Text
cloudwatchAlarmAction_alarmName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchAlarmAction' {Text
alarmName :: Text
$sel:alarmName:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
alarmName} -> Text
alarmName) (\s :: CloudwatchAlarmAction
s@CloudwatchAlarmAction' {} Text
a -> CloudwatchAlarmAction
s {$sel:alarmName:CloudwatchAlarmAction' :: Text
alarmName = Text
a} :: CloudwatchAlarmAction)
cloudwatchAlarmAction_stateReason :: Lens.Lens' CloudwatchAlarmAction Prelude.Text
cloudwatchAlarmAction_stateReason :: Lens' CloudwatchAlarmAction Text
cloudwatchAlarmAction_stateReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchAlarmAction' {Text
stateReason :: Text
$sel:stateReason:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
stateReason} -> Text
stateReason) (\s :: CloudwatchAlarmAction
s@CloudwatchAlarmAction' {} Text
a -> CloudwatchAlarmAction
s {$sel:stateReason:CloudwatchAlarmAction' :: Text
stateReason = Text
a} :: CloudwatchAlarmAction)
cloudwatchAlarmAction_stateValue :: Lens.Lens' CloudwatchAlarmAction Prelude.Text
cloudwatchAlarmAction_stateValue :: Lens' CloudwatchAlarmAction Text
cloudwatchAlarmAction_stateValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchAlarmAction' {Text
stateValue :: Text
$sel:stateValue:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
stateValue} -> Text
stateValue) (\s :: CloudwatchAlarmAction
s@CloudwatchAlarmAction' {} Text
a -> CloudwatchAlarmAction
s {$sel:stateValue:CloudwatchAlarmAction' :: Text
stateValue = Text
a} :: CloudwatchAlarmAction)
instance Data.FromJSON CloudwatchAlarmAction where
parseJSON :: Value -> Parser CloudwatchAlarmAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CloudwatchAlarmAction"
( \Object
x ->
Text -> Text -> Text -> Text -> CloudwatchAlarmAction
CloudwatchAlarmAction'
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
"roleArn")
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
"alarmName")
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
"stateReason")
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
"stateValue")
)
instance Prelude.Hashable CloudwatchAlarmAction where
hashWithSalt :: Int -> CloudwatchAlarmAction -> Int
hashWithSalt Int
_salt CloudwatchAlarmAction' {Text
stateValue :: Text
stateReason :: Text
alarmName :: Text
roleArn :: Text
$sel:stateValue:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:stateReason:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:alarmName:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:roleArn:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alarmName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stateReason
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stateValue
instance Prelude.NFData CloudwatchAlarmAction where
rnf :: CloudwatchAlarmAction -> ()
rnf CloudwatchAlarmAction' {Text
stateValue :: Text
stateReason :: Text
alarmName :: Text
roleArn :: Text
$sel:stateValue:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:stateReason:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:alarmName:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:roleArn:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
alarmName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stateReason
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stateValue
instance Data.ToJSON CloudwatchAlarmAction where
toJSON :: CloudwatchAlarmAction -> Value
toJSON CloudwatchAlarmAction' {Text
stateValue :: Text
stateReason :: Text
alarmName :: Text
roleArn :: Text
$sel:stateValue:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:stateReason:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:alarmName:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
$sel:roleArn:CloudwatchAlarmAction' :: CloudwatchAlarmAction -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
forall a. a -> Maybe a
Prelude.Just (Key
"alarmName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alarmName),
forall a. a -> Maybe a
Prelude.Just (Key
"stateReason" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stateReason),
forall a. a -> Maybe a
Prelude.Just (Key
"stateValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stateValue)
]
)