{-# 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.AlarmState where
import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.AlarmStateName
import Amazonka.IoTEventsData.Types.CustomerAction
import Amazonka.IoTEventsData.Types.RuleEvaluation
import Amazonka.IoTEventsData.Types.SystemEvent
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AlarmState = AlarmState'
{
AlarmState -> Maybe CustomerAction
customerAction :: Prelude.Maybe CustomerAction,
AlarmState -> Maybe AlarmStateName
stateName :: Prelude.Maybe AlarmStateName,
AlarmState -> Maybe RuleEvaluation
ruleEvaluation :: Prelude.Maybe RuleEvaluation,
AlarmState -> Maybe SystemEvent
systemEvent :: Prelude.Maybe SystemEvent
}
deriving (AlarmState -> AlarmState -> Bool
(AlarmState -> AlarmState -> Bool)
-> (AlarmState -> AlarmState -> Bool) -> Eq AlarmState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlarmState -> AlarmState -> Bool
$c/= :: AlarmState -> AlarmState -> Bool
== :: AlarmState -> AlarmState -> Bool
$c== :: AlarmState -> AlarmState -> Bool
Prelude.Eq, ReadPrec [AlarmState]
ReadPrec AlarmState
Int -> ReadS AlarmState
ReadS [AlarmState]
(Int -> ReadS AlarmState)
-> ReadS [AlarmState]
-> ReadPrec AlarmState
-> ReadPrec [AlarmState]
-> Read AlarmState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlarmState]
$creadListPrec :: ReadPrec [AlarmState]
readPrec :: ReadPrec AlarmState
$creadPrec :: ReadPrec AlarmState
readList :: ReadS [AlarmState]
$creadList :: ReadS [AlarmState]
readsPrec :: Int -> ReadS AlarmState
$creadsPrec :: Int -> ReadS AlarmState
Prelude.Read, Int -> AlarmState -> ShowS
[AlarmState] -> ShowS
AlarmState -> String
(Int -> AlarmState -> ShowS)
-> (AlarmState -> String)
-> ([AlarmState] -> ShowS)
-> Show AlarmState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlarmState] -> ShowS
$cshowList :: [AlarmState] -> ShowS
show :: AlarmState -> String
$cshow :: AlarmState -> String
showsPrec :: Int -> AlarmState -> ShowS
$cshowsPrec :: Int -> AlarmState -> ShowS
Prelude.Show, (forall x. AlarmState -> Rep AlarmState x)
-> (forall x. Rep AlarmState x -> AlarmState) -> Generic AlarmState
forall x. Rep AlarmState x -> AlarmState
forall x. AlarmState -> Rep AlarmState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlarmState x -> AlarmState
$cfrom :: forall x. AlarmState -> Rep AlarmState x
Prelude.Generic)
newAlarmState ::
AlarmState
newAlarmState :: AlarmState
newAlarmState =
AlarmState' :: Maybe CustomerAction
-> Maybe AlarmStateName
-> Maybe RuleEvaluation
-> Maybe SystemEvent
-> AlarmState
AlarmState'
{ $sel:customerAction:AlarmState' :: Maybe CustomerAction
customerAction = Maybe CustomerAction
forall a. Maybe a
Prelude.Nothing,
$sel:stateName:AlarmState' :: Maybe AlarmStateName
stateName = Maybe AlarmStateName
forall a. Maybe a
Prelude.Nothing,
$sel:ruleEvaluation:AlarmState' :: Maybe RuleEvaluation
ruleEvaluation = Maybe RuleEvaluation
forall a. Maybe a
Prelude.Nothing,
$sel:systemEvent:AlarmState' :: Maybe SystemEvent
systemEvent = Maybe SystemEvent
forall a. Maybe a
Prelude.Nothing
}
alarmState_customerAction :: Lens.Lens' AlarmState (Prelude.Maybe CustomerAction)
alarmState_customerAction :: (Maybe CustomerAction -> f (Maybe CustomerAction))
-> AlarmState -> f AlarmState
alarmState_customerAction = (AlarmState -> Maybe CustomerAction)
-> (AlarmState -> Maybe CustomerAction -> AlarmState)
-> Lens
AlarmState AlarmState (Maybe CustomerAction) (Maybe CustomerAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmState' {Maybe CustomerAction
customerAction :: Maybe CustomerAction
$sel:customerAction:AlarmState' :: AlarmState -> Maybe CustomerAction
customerAction} -> Maybe CustomerAction
customerAction) (\s :: AlarmState
s@AlarmState' {} Maybe CustomerAction
a -> AlarmState
s {$sel:customerAction:AlarmState' :: Maybe CustomerAction
customerAction = Maybe CustomerAction
a} :: AlarmState)
alarmState_stateName :: Lens.Lens' AlarmState (Prelude.Maybe AlarmStateName)
alarmState_stateName :: (Maybe AlarmStateName -> f (Maybe AlarmStateName))
-> AlarmState -> f AlarmState
alarmState_stateName = (AlarmState -> Maybe AlarmStateName)
-> (AlarmState -> Maybe AlarmStateName -> AlarmState)
-> Lens
AlarmState AlarmState (Maybe AlarmStateName) (Maybe AlarmStateName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmState' {Maybe AlarmStateName
stateName :: Maybe AlarmStateName
$sel:stateName:AlarmState' :: AlarmState -> Maybe AlarmStateName
stateName} -> Maybe AlarmStateName
stateName) (\s :: AlarmState
s@AlarmState' {} Maybe AlarmStateName
a -> AlarmState
s {$sel:stateName:AlarmState' :: Maybe AlarmStateName
stateName = Maybe AlarmStateName
a} :: AlarmState)
alarmState_ruleEvaluation :: Lens.Lens' AlarmState (Prelude.Maybe RuleEvaluation)
alarmState_ruleEvaluation :: (Maybe RuleEvaluation -> f (Maybe RuleEvaluation))
-> AlarmState -> f AlarmState
alarmState_ruleEvaluation = (AlarmState -> Maybe RuleEvaluation)
-> (AlarmState -> Maybe RuleEvaluation -> AlarmState)
-> Lens
AlarmState AlarmState (Maybe RuleEvaluation) (Maybe RuleEvaluation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmState' {Maybe RuleEvaluation
ruleEvaluation :: Maybe RuleEvaluation
$sel:ruleEvaluation:AlarmState' :: AlarmState -> Maybe RuleEvaluation
ruleEvaluation} -> Maybe RuleEvaluation
ruleEvaluation) (\s :: AlarmState
s@AlarmState' {} Maybe RuleEvaluation
a -> AlarmState
s {$sel:ruleEvaluation:AlarmState' :: Maybe RuleEvaluation
ruleEvaluation = Maybe RuleEvaluation
a} :: AlarmState)
alarmState_systemEvent :: Lens.Lens' AlarmState (Prelude.Maybe SystemEvent)
alarmState_systemEvent :: (Maybe SystemEvent -> f (Maybe SystemEvent))
-> AlarmState -> f AlarmState
alarmState_systemEvent = (AlarmState -> Maybe SystemEvent)
-> (AlarmState -> Maybe SystemEvent -> AlarmState)
-> Lens
AlarmState AlarmState (Maybe SystemEvent) (Maybe SystemEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmState' {Maybe SystemEvent
systemEvent :: Maybe SystemEvent
$sel:systemEvent:AlarmState' :: AlarmState -> Maybe SystemEvent
systemEvent} -> Maybe SystemEvent
systemEvent) (\s :: AlarmState
s@AlarmState' {} Maybe SystemEvent
a -> AlarmState
s {$sel:systemEvent:AlarmState' :: Maybe SystemEvent
systemEvent = Maybe SystemEvent
a} :: AlarmState)
instance Core.FromJSON AlarmState where
parseJSON :: Value -> Parser AlarmState
parseJSON =
String
-> (Object -> Parser AlarmState) -> Value -> Parser AlarmState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AlarmState"
( \Object
x ->
Maybe CustomerAction
-> Maybe AlarmStateName
-> Maybe RuleEvaluation
-> Maybe SystemEvent
-> AlarmState
AlarmState'
(Maybe CustomerAction
-> Maybe AlarmStateName
-> Maybe RuleEvaluation
-> Maybe SystemEvent
-> AlarmState)
-> Parser (Maybe CustomerAction)
-> Parser
(Maybe AlarmStateName
-> Maybe RuleEvaluation -> Maybe SystemEvent -> AlarmState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CustomerAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"customerAction")
Parser
(Maybe AlarmStateName
-> Maybe RuleEvaluation -> Maybe SystemEvent -> AlarmState)
-> Parser (Maybe AlarmStateName)
-> Parser (Maybe RuleEvaluation -> Maybe SystemEvent -> AlarmState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AlarmStateName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stateName")
Parser (Maybe RuleEvaluation -> Maybe SystemEvent -> AlarmState)
-> Parser (Maybe RuleEvaluation)
-> Parser (Maybe SystemEvent -> AlarmState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RuleEvaluation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ruleEvaluation")
Parser (Maybe SystemEvent -> AlarmState)
-> Parser (Maybe SystemEvent) -> Parser AlarmState
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SystemEvent)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"systemEvent")
)
instance Prelude.Hashable AlarmState
instance Prelude.NFData AlarmState