{-# 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.DevOpsGuru.Types.Event where
import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types.EventClass
import Amazonka.DevOpsGuru.Types.EventDataSource
import Amazonka.DevOpsGuru.Types.EventResource
import Amazonka.DevOpsGuru.Types.ResourceCollection
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Event = Event'
{ Event -> Maybe ResourceCollection
resourceCollection :: Prelude.Maybe ResourceCollection,
Event -> Maybe EventClass
eventClass :: Prelude.Maybe EventClass,
Event -> Maybe POSIX
time :: Prelude.Maybe Core.POSIX,
Event -> Maybe [EventResource]
resources :: Prelude.Maybe [EventResource],
Event -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Event -> Maybe EventDataSource
dataSource :: Prelude.Maybe EventDataSource,
Event -> Maybe Text
eventSource :: 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 ResourceCollection
-> Maybe EventClass
-> Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event
Event'
{ $sel:resourceCollection:Event' :: Maybe ResourceCollection
resourceCollection = Maybe ResourceCollection
forall a. Maybe a
Prelude.Nothing,
$sel:eventClass:Event' :: Maybe EventClass
eventClass = Maybe EventClass
forall a. Maybe a
Prelude.Nothing,
$sel:time:Event' :: Maybe POSIX
time = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:resources:Event' :: Maybe [EventResource]
resources = Maybe [EventResource]
forall a. Maybe a
Prelude.Nothing,
$sel:name:Event' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:Event' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dataSource:Event' :: Maybe EventDataSource
dataSource = Maybe EventDataSource
forall a. Maybe a
Prelude.Nothing,
$sel:eventSource:Event' :: Maybe Text
eventSource = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
event_resourceCollection :: Lens.Lens' Event (Prelude.Maybe ResourceCollection)
event_resourceCollection :: (Maybe ResourceCollection -> f (Maybe ResourceCollection))
-> Event -> f Event
event_resourceCollection = (Event -> Maybe ResourceCollection)
-> (Event -> Maybe ResourceCollection -> Event)
-> Lens
Event Event (Maybe ResourceCollection) (Maybe ResourceCollection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe ResourceCollection
resourceCollection :: Maybe ResourceCollection
$sel:resourceCollection:Event' :: Event -> Maybe ResourceCollection
resourceCollection} -> Maybe ResourceCollection
resourceCollection) (\s :: Event
s@Event' {} Maybe ResourceCollection
a -> Event
s {$sel:resourceCollection:Event' :: Maybe ResourceCollection
resourceCollection = Maybe ResourceCollection
a} :: Event)
event_eventClass :: Lens.Lens' Event (Prelude.Maybe EventClass)
event_eventClass :: (Maybe EventClass -> f (Maybe EventClass)) -> Event -> f Event
event_eventClass = (Event -> Maybe EventClass)
-> (Event -> Maybe EventClass -> Event)
-> Lens Event Event (Maybe EventClass) (Maybe EventClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe EventClass
eventClass :: Maybe EventClass
$sel:eventClass:Event' :: Event -> Maybe EventClass
eventClass} -> Maybe EventClass
eventClass) (\s :: Event
s@Event' {} Maybe EventClass
a -> Event
s {$sel:eventClass:Event' :: Maybe EventClass
eventClass = Maybe EventClass
a} :: Event)
event_time :: Lens.Lens' Event (Prelude.Maybe Prelude.UTCTime)
event_time :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Event -> f Event
event_time = (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
time :: Maybe POSIX
$sel:time:Event' :: Event -> Maybe POSIX
time} -> Maybe POSIX
time) (\s :: Event
s@Event' {} Maybe POSIX
a -> Event
s {$sel:time:Event' :: Maybe POSIX
time = 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_resources :: Lens.Lens' Event (Prelude.Maybe [EventResource])
event_resources :: (Maybe [EventResource] -> f (Maybe [EventResource]))
-> Event -> f Event
event_resources = (Event -> Maybe [EventResource])
-> (Event -> Maybe [EventResource] -> Event)
-> Lens Event Event (Maybe [EventResource]) (Maybe [EventResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe [EventResource]
resources :: Maybe [EventResource]
$sel:resources:Event' :: Event -> Maybe [EventResource]
resources} -> Maybe [EventResource]
resources) (\s :: Event
s@Event' {} Maybe [EventResource]
a -> Event
s {$sel:resources:Event' :: Maybe [EventResource]
resources = Maybe [EventResource]
a} :: Event) ((Maybe [EventResource] -> f (Maybe [EventResource]))
-> Event -> f Event)
-> ((Maybe [EventResource] -> f (Maybe [EventResource]))
-> Maybe [EventResource] -> f (Maybe [EventResource]))
-> (Maybe [EventResource] -> f (Maybe [EventResource]))
-> Event
-> f Event
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EventResource] [EventResource] [EventResource] [EventResource]
-> Iso
(Maybe [EventResource])
(Maybe [EventResource])
(Maybe [EventResource])
(Maybe [EventResource])
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
[EventResource] [EventResource] [EventResource] [EventResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
event_name :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_name :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_name = (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
name :: Maybe Text
$sel:name:Event' :: Event -> Maybe Text
name} -> Maybe Text
name) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:name:Event' :: Maybe Text
name = Maybe Text
a} :: Event)
event_id :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_id :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_id = (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
id :: Maybe Text
$sel:id:Event' :: Event -> Maybe Text
id} -> Maybe Text
id) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:id:Event' :: Maybe Text
id = Maybe Text
a} :: Event)
event_dataSource :: Lens.Lens' Event (Prelude.Maybe EventDataSource)
event_dataSource :: (Maybe EventDataSource -> f (Maybe EventDataSource))
-> Event -> f Event
event_dataSource = (Event -> Maybe EventDataSource)
-> (Event -> Maybe EventDataSource -> Event)
-> Lens Event Event (Maybe EventDataSource) (Maybe EventDataSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe EventDataSource
dataSource :: Maybe EventDataSource
$sel:dataSource:Event' :: Event -> Maybe EventDataSource
dataSource} -> Maybe EventDataSource
dataSource) (\s :: Event
s@Event' {} Maybe EventDataSource
a -> Event
s {$sel:dataSource:Event' :: Maybe EventDataSource
dataSource = Maybe EventDataSource
a} :: Event)
event_eventSource :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_eventSource :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_eventSource = (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
eventSource :: Maybe Text
$sel:eventSource:Event' :: Event -> Maybe Text
eventSource} -> Maybe Text
eventSource) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:eventSource:Event' :: Maybe Text
eventSource = 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 ResourceCollection
-> Maybe EventClass
-> Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event
Event'
(Maybe ResourceCollection
-> Maybe EventClass
-> Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event)
-> Parser (Maybe ResourceCollection)
-> Parser
(Maybe EventClass
-> Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResourceCollection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceCollection")
Parser
(Maybe EventClass
-> Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event)
-> Parser (Maybe EventClass)
-> Parser
(Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EventClass)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventClass")
Parser
(Maybe POSIX
-> Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event)
-> Parser (Maybe POSIX)
-> Parser
(Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> 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
"Time")
Parser
(Maybe [EventResource]
-> Maybe Text
-> Maybe Text
-> Maybe EventDataSource
-> Maybe Text
-> Event)
-> Parser (Maybe [EventResource])
-> Parser
(Maybe Text
-> Maybe Text -> Maybe EventDataSource -> Maybe Text -> Event)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [EventResource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Resources" Parser (Maybe (Maybe [EventResource]))
-> Maybe [EventResource] -> Parser (Maybe [EventResource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EventResource]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe Text -> Maybe EventDataSource -> Maybe Text -> Event)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe EventDataSource -> 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
"Name")
Parser (Maybe Text -> Maybe EventDataSource -> Maybe Text -> Event)
-> Parser (Maybe Text)
-> Parser (Maybe EventDataSource -> 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
"Id")
Parser (Maybe EventDataSource -> Maybe Text -> Event)
-> Parser (Maybe EventDataSource) -> Parser (Maybe Text -> Event)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EventDataSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataSource")
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
"EventSource")
)
instance Prelude.Hashable Event
instance Prelude.NFData Event