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