{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types.EventClass
import Amazonka.DevOpsGuru.Types.EventDataSource
import Amazonka.DevOpsGuru.Types.EventResource
import Amazonka.DevOpsGuru.Types.ResourceCollection
import qualified Amazonka.Prelude as Prelude
data Event = Event'
{
Event -> Maybe EventDataSource
dataSource :: Prelude.Maybe EventDataSource,
Event -> Maybe EventClass
eventClass :: Prelude.Maybe EventClass,
Event -> Maybe Text
eventSource :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Event -> Maybe ResourceCollection
resourceCollection :: Prelude.Maybe ResourceCollection,
Event -> Maybe [EventResource]
resources :: Prelude.Maybe [EventResource],
Event -> Maybe POSIX
time :: Prelude.Maybe Data.POSIX
}
deriving (Event -> Event -> Bool
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]
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
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. 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'
{ $sel:dataSource:Event' :: Maybe EventDataSource
dataSource = forall a. Maybe a
Prelude.Nothing,
$sel:eventClass:Event' :: Maybe EventClass
eventClass = forall a. Maybe a
Prelude.Nothing,
$sel:eventSource:Event' :: Maybe Text
eventSource = forall a. Maybe a
Prelude.Nothing,
$sel:id:Event' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
$sel:name:Event' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:resourceCollection:Event' :: Maybe ResourceCollection
resourceCollection = forall a. Maybe a
Prelude.Nothing,
$sel:resources:Event' :: Maybe [EventResource]
resources = forall a. Maybe a
Prelude.Nothing,
$sel:time:Event' :: Maybe POSIX
time = forall a. Maybe a
Prelude.Nothing
}
event_dataSource :: Lens.Lens' Event (Prelude.Maybe EventDataSource)
event_dataSource :: Lens' Event (Maybe EventDataSource)
event_dataSource = 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_eventClass :: Lens.Lens' Event (Prelude.Maybe EventClass)
event_eventClass :: Lens' Event (Maybe EventClass)
event_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_eventSource :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_eventSource :: Lens' Event (Maybe Text)
event_eventSource = 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)
event_id :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_id :: Lens' Event (Maybe Text)
event_id = 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_name :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_name :: Lens' Event (Maybe Text)
event_name = 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_resourceCollection :: Lens.Lens' Event (Prelude.Maybe ResourceCollection)
event_resourceCollection :: Lens' Event (Maybe ResourceCollection)
event_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_resources :: Lens.Lens' Event (Prelude.Maybe [EventResource])
event_resources :: Lens' Event (Maybe [EventResource])
event_resources = 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) 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
event_time :: Lens.Lens' Event (Prelude.Maybe Prelude.UTCTime)
event_time :: Lens' Event (Maybe UTCTime)
event_time = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time
instance Data.FromJSON Event where
parseJSON :: Value -> Parser Event
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Event"
( \Object
x ->
Maybe EventDataSource
-> Maybe EventClass
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ResourceCollection
-> Maybe [EventResource]
-> Maybe POSIX
-> Event
Event'
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
"DataSource")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventClass")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventSource")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ResourceCollection")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Resources" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Time")
)
instance Prelude.Hashable Event where
hashWithSalt :: Int -> Event -> Int
hashWithSalt Int
_salt Event' {Maybe [EventResource]
Maybe Text
Maybe POSIX
Maybe EventClass
Maybe EventDataSource
Maybe ResourceCollection
time :: Maybe POSIX
resources :: Maybe [EventResource]
resourceCollection :: Maybe ResourceCollection
name :: Maybe Text
id :: Maybe Text
eventSource :: Maybe Text
eventClass :: Maybe EventClass
dataSource :: Maybe EventDataSource
$sel:time:Event' :: Event -> Maybe POSIX
$sel:resources:Event' :: Event -> Maybe [EventResource]
$sel:resourceCollection:Event' :: Event -> Maybe ResourceCollection
$sel:name:Event' :: Event -> Maybe Text
$sel:id:Event' :: Event -> Maybe Text
$sel:eventSource:Event' :: Event -> Maybe Text
$sel:eventClass:Event' :: Event -> Maybe EventClass
$sel:dataSource:Event' :: Event -> Maybe EventDataSource
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventDataSource
dataSource
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventClass
eventClass
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventSource
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceCollection
resourceCollection
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EventResource]
resources
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
time
instance Prelude.NFData Event where
rnf :: Event -> ()
rnf Event' {Maybe [EventResource]
Maybe Text
Maybe POSIX
Maybe EventClass
Maybe EventDataSource
Maybe ResourceCollection
time :: Maybe POSIX
resources :: Maybe [EventResource]
resourceCollection :: Maybe ResourceCollection
name :: Maybe Text
id :: Maybe Text
eventSource :: Maybe Text
eventClass :: Maybe EventClass
dataSource :: Maybe EventDataSource
$sel:time:Event' :: Event -> Maybe POSIX
$sel:resources:Event' :: Event -> Maybe [EventResource]
$sel:resourceCollection:Event' :: Event -> Maybe ResourceCollection
$sel:name:Event' :: Event -> Maybe Text
$sel:id:Event' :: Event -> Maybe Text
$sel:eventSource:Event' :: Event -> Maybe Text
$sel:eventClass:Event' :: Event -> Maybe EventClass
$sel:dataSource:Event' :: Event -> Maybe EventDataSource
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe EventDataSource
dataSource
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventClass
eventClass
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventSource
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceCollection
resourceCollection
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EventResource]
resources
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
time