{-# 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.Lens as Lens
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
(CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool)
-> (CloudwatchAlarmAction -> CloudwatchAlarmAction -> Bool)
-> Eq CloudwatchAlarmAction
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]
(Int -> ReadS CloudwatchAlarmAction)
-> ReadS [CloudwatchAlarmAction]
-> ReadPrec CloudwatchAlarmAction
-> ReadPrec [CloudwatchAlarmAction]
-> Read 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
(Int -> CloudwatchAlarmAction -> ShowS)
-> (CloudwatchAlarmAction -> String)
-> ([CloudwatchAlarmAction] -> ShowS)
-> Show CloudwatchAlarmAction
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. CloudwatchAlarmAction -> Rep CloudwatchAlarmAction x)
-> (forall x. Rep CloudwatchAlarmAction x -> CloudwatchAlarmAction)
-> Generic CloudwatchAlarmAction
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' :: Text -> Text -> Text -> Text -> CloudwatchAlarmAction
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 :: (Text -> f Text)
-> CloudwatchAlarmAction -> f CloudwatchAlarmAction
cloudwatchAlarmAction_roleArn = (CloudwatchAlarmAction -> Text)
-> (CloudwatchAlarmAction -> Text -> CloudwatchAlarmAction)
-> Lens CloudwatchAlarmAction CloudwatchAlarmAction Text Text
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 :: (Text -> f Text)
-> CloudwatchAlarmAction -> f CloudwatchAlarmAction
cloudwatchAlarmAction_alarmName = (CloudwatchAlarmAction -> Text)
-> (CloudwatchAlarmAction -> Text -> CloudwatchAlarmAction)
-> Lens CloudwatchAlarmAction CloudwatchAlarmAction Text Text
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 :: (Text -> f Text)
-> CloudwatchAlarmAction -> f CloudwatchAlarmAction
cloudwatchAlarmAction_stateReason = (CloudwatchAlarmAction -> Text)
-> (CloudwatchAlarmAction -> Text -> CloudwatchAlarmAction)
-> Lens CloudwatchAlarmAction CloudwatchAlarmAction Text Text
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 :: (Text -> f Text)
-> CloudwatchAlarmAction -> f CloudwatchAlarmAction
cloudwatchAlarmAction_stateValue = (CloudwatchAlarmAction -> Text)
-> (CloudwatchAlarmAction -> Text -> CloudwatchAlarmAction)
-> Lens CloudwatchAlarmAction CloudwatchAlarmAction Text Text
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 Core.FromJSON CloudwatchAlarmAction where
parseJSON :: Value -> Parser CloudwatchAlarmAction
parseJSON =
String
-> (Object -> Parser CloudwatchAlarmAction)
-> Value
-> Parser CloudwatchAlarmAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CloudwatchAlarmAction"
( \Object
x ->
Text -> Text -> Text -> Text -> CloudwatchAlarmAction
CloudwatchAlarmAction'
(Text -> Text -> Text -> Text -> CloudwatchAlarmAction)
-> Parser Text
-> Parser (Text -> Text -> Text -> CloudwatchAlarmAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
Parser (Text -> Text -> Text -> CloudwatchAlarmAction)
-> Parser Text -> Parser (Text -> Text -> CloudwatchAlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"alarmName")
Parser (Text -> Text -> CloudwatchAlarmAction)
-> Parser Text -> Parser (Text -> CloudwatchAlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"stateReason")
Parser (Text -> CloudwatchAlarmAction)
-> Parser Text -> Parser CloudwatchAlarmAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"stateValue")
)
instance Prelude.Hashable CloudwatchAlarmAction
instance Prelude.NFData CloudwatchAlarmAction
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"alarmName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alarmName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"stateReason" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stateReason),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"stateValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stateValue)
]
)