{-# 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.IoTEventsData.Types.Alarm where
import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.AlarmState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Alarm = Alarm'
{
Alarm -> Maybe Text
keyValue :: Prelude.Maybe Prelude.Text,
Alarm -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
Alarm -> Maybe AlarmState
alarmState :: Prelude.Maybe AlarmState,
Alarm -> Maybe Text
alarmModelName :: Prelude.Maybe Prelude.Text,
Alarm -> Maybe Natural
severity :: Prelude.Maybe Prelude.Natural,
Alarm -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Core.POSIX,
Alarm -> Maybe Text
alarmModelVersion :: Prelude.Maybe Prelude.Text
}
deriving (Alarm -> Alarm -> Bool
(Alarm -> Alarm -> Bool) -> (Alarm -> Alarm -> Bool) -> Eq Alarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Alarm -> Alarm -> Bool
$c/= :: Alarm -> Alarm -> Bool
== :: Alarm -> Alarm -> Bool
$c== :: Alarm -> Alarm -> Bool
Prelude.Eq, ReadPrec [Alarm]
ReadPrec Alarm
Int -> ReadS Alarm
ReadS [Alarm]
(Int -> ReadS Alarm)
-> ReadS [Alarm]
-> ReadPrec Alarm
-> ReadPrec [Alarm]
-> Read Alarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Alarm]
$creadListPrec :: ReadPrec [Alarm]
readPrec :: ReadPrec Alarm
$creadPrec :: ReadPrec Alarm
readList :: ReadS [Alarm]
$creadList :: ReadS [Alarm]
readsPrec :: Int -> ReadS Alarm
$creadsPrec :: Int -> ReadS Alarm
Prelude.Read, Int -> Alarm -> ShowS
[Alarm] -> ShowS
Alarm -> String
(Int -> Alarm -> ShowS)
-> (Alarm -> String) -> ([Alarm] -> ShowS) -> Show Alarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Alarm] -> ShowS
$cshowList :: [Alarm] -> ShowS
show :: Alarm -> String
$cshow :: Alarm -> String
showsPrec :: Int -> Alarm -> ShowS
$cshowsPrec :: Int -> Alarm -> ShowS
Prelude.Show, (forall x. Alarm -> Rep Alarm x)
-> (forall x. Rep Alarm x -> Alarm) -> Generic Alarm
forall x. Rep Alarm x -> Alarm
forall x. Alarm -> Rep Alarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Alarm x -> Alarm
$cfrom :: forall x. Alarm -> Rep Alarm x
Prelude.Generic)
newAlarm ::
Alarm
newAlarm :: Alarm
newAlarm =
Alarm' :: Maybe Text
-> Maybe POSIX
-> Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm
Alarm'
{ $sel:keyValue:Alarm' :: Maybe Text
keyValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:creationTime:Alarm' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:alarmState:Alarm' :: Maybe AlarmState
alarmState = Maybe AlarmState
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelName:Alarm' :: Maybe Text
alarmModelName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:severity:Alarm' :: Maybe Natural
severity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdateTime:Alarm' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelVersion:Alarm' :: Maybe Text
alarmModelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
alarm_keyValue :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_keyValue :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_keyValue = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
keyValue :: Maybe Text
$sel:keyValue:Alarm' :: Alarm -> Maybe Text
keyValue} -> Maybe Text
keyValue) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:keyValue:Alarm' :: Maybe Text
keyValue = Maybe Text
a} :: Alarm)
alarm_creationTime :: Lens.Lens' Alarm (Prelude.Maybe Prelude.UTCTime)
alarm_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alarm -> f Alarm
alarm_creationTime = (Alarm -> Maybe POSIX)
-> (Alarm -> Maybe POSIX -> Alarm)
-> Lens Alarm Alarm (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Alarm' :: Alarm -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Alarm
s@Alarm' {} Maybe POSIX
a -> Alarm
s {$sel:creationTime:Alarm' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Alarm) ((Maybe POSIX -> f (Maybe POSIX)) -> Alarm -> f Alarm)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alarm
-> f Alarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
alarm_alarmState :: Lens.Lens' Alarm (Prelude.Maybe AlarmState)
alarm_alarmState :: (Maybe AlarmState -> f (Maybe AlarmState)) -> Alarm -> f Alarm
alarm_alarmState = (Alarm -> Maybe AlarmState)
-> (Alarm -> Maybe AlarmState -> Alarm)
-> Lens Alarm Alarm (Maybe AlarmState) (Maybe AlarmState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe AlarmState
alarmState :: Maybe AlarmState
$sel:alarmState:Alarm' :: Alarm -> Maybe AlarmState
alarmState} -> Maybe AlarmState
alarmState) (\s :: Alarm
s@Alarm' {} Maybe AlarmState
a -> Alarm
s {$sel:alarmState:Alarm' :: Maybe AlarmState
alarmState = Maybe AlarmState
a} :: Alarm)
alarm_alarmModelName :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_alarmModelName :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_alarmModelName = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
alarmModelName :: Maybe Text
$sel:alarmModelName:Alarm' :: Alarm -> Maybe Text
alarmModelName} -> Maybe Text
alarmModelName) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:alarmModelName:Alarm' :: Maybe Text
alarmModelName = Maybe Text
a} :: Alarm)
alarm_severity :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Natural)
alarm_severity :: (Maybe Natural -> f (Maybe Natural)) -> Alarm -> f Alarm
alarm_severity = (Alarm -> Maybe Natural)
-> (Alarm -> Maybe Natural -> Alarm)
-> Lens Alarm Alarm (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Natural
severity :: Maybe Natural
$sel:severity:Alarm' :: Alarm -> Maybe Natural
severity} -> Maybe Natural
severity) (\s :: Alarm
s@Alarm' {} Maybe Natural
a -> Alarm
s {$sel:severity:Alarm' :: Maybe Natural
severity = Maybe Natural
a} :: Alarm)
alarm_lastUpdateTime :: Lens.Lens' Alarm (Prelude.Maybe Prelude.UTCTime)
alarm_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alarm -> f Alarm
alarm_lastUpdateTime = (Alarm -> Maybe POSIX)
-> (Alarm -> Maybe POSIX -> Alarm)
-> Lens Alarm Alarm (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:Alarm' :: Alarm -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: Alarm
s@Alarm' {} Maybe POSIX
a -> Alarm
s {$sel:lastUpdateTime:Alarm' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: Alarm) ((Maybe POSIX -> f (Maybe POSIX)) -> Alarm -> f Alarm)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alarm
-> f Alarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
alarm_alarmModelVersion :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_alarmModelVersion :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_alarmModelVersion = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
alarmModelVersion :: Maybe Text
$sel:alarmModelVersion:Alarm' :: Alarm -> Maybe Text
alarmModelVersion} -> Maybe Text
alarmModelVersion) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:alarmModelVersion:Alarm' :: Maybe Text
alarmModelVersion = Maybe Text
a} :: Alarm)
instance Core.FromJSON Alarm where
parseJSON :: Value -> Parser Alarm
parseJSON =
String -> (Object -> Parser Alarm) -> Value -> Parser Alarm
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Alarm"
( \Object
x ->
Maybe Text
-> Maybe POSIX
-> Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm
Alarm'
(Maybe Text
-> Maybe POSIX
-> Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm)
-> Parser (Maybe Text)
-> Parser
(Maybe POSIX
-> Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm)
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
"keyValue")
Parser
(Maybe POSIX
-> Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm)
-> Parser (Maybe POSIX)
-> Parser
(Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationTime")
Parser
(Maybe AlarmState
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Alarm)
-> Parser (Maybe AlarmState)
-> Parser
(Maybe Text -> Maybe Natural -> Maybe POSIX -> Maybe Text -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AlarmState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"alarmState")
Parser
(Maybe Text -> Maybe Natural -> Maybe POSIX -> Maybe Text -> Alarm)
-> Parser (Maybe Text)
-> Parser (Maybe Natural -> Maybe POSIX -> Maybe Text -> Alarm)
forall (f :: * -> *) a b. Applicative f => 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
"alarmModelName")
Parser (Maybe Natural -> Maybe POSIX -> Maybe Text -> Alarm)
-> Parser (Maybe Natural)
-> Parser (Maybe POSIX -> Maybe Text -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"severity")
Parser (Maybe POSIX -> Maybe Text -> Alarm)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdateTime")
Parser (Maybe Text -> Alarm) -> Parser (Maybe Text) -> Parser Alarm
forall (f :: * -> *) a b. Applicative f => 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
"alarmModelVersion")
)
instance Prelude.Hashable Alarm
instance Prelude.NFData Alarm