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