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