{-# 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.DMS.Types.Event where
import qualified Amazonka.Core as Core
import Amazonka.DMS.Types.SourceType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Event = Event'
{
Event -> Maybe SourceType
sourceType :: Prelude.Maybe SourceType,
Event -> Maybe Text
sourceIdentifier :: Prelude.Maybe Prelude.Text,
Event -> Maybe POSIX
date :: Prelude.Maybe Core.POSIX,
Event -> Maybe [Text]
eventCategories :: Prelude.Maybe [Prelude.Text],
Event -> Maybe Text
message :: Prelude.Maybe Prelude.Text
}
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 SourceType
-> Maybe Text -> Maybe POSIX -> Maybe [Text] -> Maybe Text -> Event
Event'
{ $sel:sourceType:Event' :: Maybe SourceType
sourceType = Maybe SourceType
forall a. Maybe a
Prelude.Nothing,
$sel:sourceIdentifier:Event' :: Maybe Text
sourceIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:date:Event' :: Maybe POSIX
date = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:eventCategories:Event' :: Maybe [Text]
eventCategories = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:message:Event' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
event_sourceType :: Lens.Lens' Event (Prelude.Maybe SourceType)
event_sourceType :: (Maybe SourceType -> f (Maybe SourceType)) -> Event -> f Event
event_sourceType = (Event -> Maybe SourceType)
-> (Event -> Maybe SourceType -> Event)
-> Lens Event Event (Maybe SourceType) (Maybe SourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe SourceType
sourceType :: Maybe SourceType
$sel:sourceType:Event' :: Event -> Maybe SourceType
sourceType} -> Maybe SourceType
sourceType) (\s :: Event
s@Event' {} Maybe SourceType
a -> Event
s {$sel:sourceType:Event' :: Maybe SourceType
sourceType = Maybe SourceType
a} :: Event)
event_sourceIdentifier :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_sourceIdentifier :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_sourceIdentifier = (Event -> Maybe Text)
-> (Event -> Maybe Text -> Event)
-> Lens Event Event (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe Text
sourceIdentifier :: Maybe Text
$sel:sourceIdentifier:Event' :: Event -> Maybe Text
sourceIdentifier} -> Maybe Text
sourceIdentifier) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:sourceIdentifier:Event' :: Maybe Text
sourceIdentifier = Maybe Text
a} :: Event)
event_date :: Lens.Lens' Event (Prelude.Maybe Prelude.UTCTime)
event_date :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Event -> f Event
event_date = (Event -> Maybe POSIX)
-> (Event -> Maybe POSIX -> Event)
-> Lens Event Event (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe POSIX
date :: Maybe POSIX
$sel:date:Event' :: Event -> Maybe POSIX
date} -> Maybe POSIX
date) (\s :: Event
s@Event' {} Maybe POSIX
a -> Event
s {$sel:date:Event' :: Maybe POSIX
date = Maybe POSIX
a} :: Event) ((Maybe POSIX -> f (Maybe POSIX)) -> Event -> f Event)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Event
-> f Event
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
event_eventCategories :: Lens.Lens' Event (Prelude.Maybe [Prelude.Text])
event_eventCategories :: (Maybe [Text] -> f (Maybe [Text])) -> Event -> f Event
event_eventCategories = (Event -> Maybe [Text])
-> (Event -> Maybe [Text] -> Event)
-> Lens Event Event (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe [Text]
eventCategories :: Maybe [Text]
$sel:eventCategories:Event' :: Event -> Maybe [Text]
eventCategories} -> Maybe [Text]
eventCategories) (\s :: Event
s@Event' {} Maybe [Text]
a -> Event
s {$sel:eventCategories:Event' :: Maybe [Text]
eventCategories = Maybe [Text]
a} :: Event) ((Maybe [Text] -> f (Maybe [Text])) -> Event -> f Event)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Event
-> f Event
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
event_message :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_message :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_message = (Event -> Maybe Text)
-> (Event -> Maybe Text -> Event)
-> Lens Event Event (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe Text
message :: Maybe Text
$sel:message:Event' :: Event -> Maybe Text
message} -> Maybe Text
message) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:message:Event' :: Maybe Text
message = Maybe Text
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 SourceType
-> Maybe Text -> Maybe POSIX -> Maybe [Text] -> Maybe Text -> Event
Event'
(Maybe SourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe [Text]
-> Maybe Text
-> Event)
-> Parser (Maybe SourceType)
-> Parser
(Maybe Text -> Maybe POSIX -> Maybe [Text] -> Maybe Text -> Event)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceType")
Parser
(Maybe Text -> Maybe POSIX -> Maybe [Text] -> Maybe Text -> Event)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe [Text] -> Maybe Text -> Event)
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
"SourceIdentifier")
Parser (Maybe POSIX -> Maybe [Text] -> Maybe Text -> Event)
-> Parser (Maybe POSIX)
-> Parser (Maybe [Text] -> Maybe Text -> Event)
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
"Date")
Parser (Maybe [Text] -> Maybe Text -> Event)
-> Parser (Maybe [Text]) -> Parser (Maybe Text -> Event)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventCategories"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Text -> Event) -> Parser (Maybe Text) -> Parser Event
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
"Message")
)
instance Prelude.Hashable Event
instance Prelude.NFData Event