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