{-# 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.CloudTrail.Types.Event where
import Amazonka.CloudTrail.Types.Resource
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Event = Event'
{
Event -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
Event -> Maybe [Resource]
resources :: Prelude.Maybe [Resource],
Event -> Maybe POSIX
eventTime :: Prelude.Maybe Core.POSIX,
Event -> Maybe Text
cloudTrailEvent :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
eventName :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
readOnly :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
accessKeyId :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
eventSource :: Prelude.Maybe Prelude.Text,
Event -> Maybe Text
eventId :: 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 Text
-> Maybe [Resource]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event
Event'
{ $sel:username:Event' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resources:Event' :: Maybe [Resource]
resources = Maybe [Resource]
forall a. Maybe a
Prelude.Nothing,
$sel:eventTime:Event' :: Maybe POSIX
eventTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:cloudTrailEvent:Event' :: Maybe Text
cloudTrailEvent = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventName:Event' :: Maybe Text
eventName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:readOnly:Event' :: Maybe Text
readOnly = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:accessKeyId:Event' :: Maybe Text
accessKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventSource:Event' :: Maybe Text
eventSource = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventId:Event' :: Maybe Text
eventId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
event_username :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_username :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_username = (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
username :: Maybe Text
$sel:username:Event' :: Event -> Maybe Text
username} -> Maybe Text
username) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:username:Event' :: Maybe Text
username = Maybe Text
a} :: Event)
event_resources :: Lens.Lens' Event (Prelude.Maybe [Resource])
event_resources :: (Maybe [Resource] -> f (Maybe [Resource])) -> Event -> f Event
event_resources = (Event -> Maybe [Resource])
-> (Event -> Maybe [Resource] -> Event)
-> Lens Event Event (Maybe [Resource]) (Maybe [Resource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe [Resource]
resources :: Maybe [Resource]
$sel:resources:Event' :: Event -> Maybe [Resource]
resources} -> Maybe [Resource]
resources) (\s :: Event
s@Event' {} Maybe [Resource]
a -> Event
s {$sel:resources:Event' :: Maybe [Resource]
resources = Maybe [Resource]
a} :: Event) ((Maybe [Resource] -> f (Maybe [Resource])) -> Event -> f Event)
-> ((Maybe [Resource] -> f (Maybe [Resource]))
-> Maybe [Resource] -> f (Maybe [Resource]))
-> (Maybe [Resource] -> f (Maybe [Resource]))
-> Event
-> f Event
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Resource] [Resource] [Resource] [Resource]
-> Iso
(Maybe [Resource])
(Maybe [Resource])
(Maybe [Resource])
(Maybe [Resource])
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 [Resource] [Resource] [Resource] [Resource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
event_eventTime :: Lens.Lens' Event (Prelude.Maybe Prelude.UTCTime)
event_eventTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Event -> f Event
event_eventTime = (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
eventTime :: Maybe POSIX
$sel:eventTime:Event' :: Event -> Maybe POSIX
eventTime} -> Maybe POSIX
eventTime) (\s :: Event
s@Event' {} Maybe POSIX
a -> Event
s {$sel:eventTime:Event' :: Maybe POSIX
eventTime = 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_cloudTrailEvent :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_cloudTrailEvent :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_cloudTrailEvent = (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
cloudTrailEvent :: Maybe Text
$sel:cloudTrailEvent:Event' :: Event -> Maybe Text
cloudTrailEvent} -> Maybe Text
cloudTrailEvent) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:cloudTrailEvent:Event' :: Maybe Text
cloudTrailEvent = Maybe Text
a} :: Event)
event_eventName :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_eventName :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_eventName = (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
eventName :: Maybe Text
$sel:eventName:Event' :: Event -> Maybe Text
eventName} -> Maybe Text
eventName) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:eventName:Event' :: Maybe Text
eventName = Maybe Text
a} :: Event)
event_readOnly :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_readOnly :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_readOnly = (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
readOnly :: Maybe Text
$sel:readOnly:Event' :: Event -> Maybe Text
readOnly} -> Maybe Text
readOnly) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:readOnly:Event' :: Maybe Text
readOnly = Maybe Text
a} :: Event)
event_accessKeyId :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_accessKeyId :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_accessKeyId = (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
accessKeyId :: Maybe Text
$sel:accessKeyId:Event' :: Event -> Maybe Text
accessKeyId} -> Maybe Text
accessKeyId) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:accessKeyId:Event' :: Maybe Text
accessKeyId = Maybe Text
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)
event_eventId :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_eventId :: (Maybe Text -> f (Maybe Text)) -> Event -> f Event
event_eventId = (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
eventId :: Maybe Text
$sel:eventId:Event' :: Event -> Maybe Text
eventId} -> Maybe Text
eventId) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:eventId:Event' :: Maybe Text
eventId = 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 Text
-> Maybe [Resource]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event
Event'
(Maybe Text
-> Maybe [Resource]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event)
-> Parser (Maybe Text)
-> Parser
(Maybe [Resource]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event)
forall (f :: * -> *) a b. Functor 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
"Username")
Parser
(Maybe [Resource]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event)
-> Parser (Maybe [Resource])
-> Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> 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 (Maybe [Resource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Resources" Parser (Maybe (Maybe [Resource]))
-> Maybe [Resource] -> Parser (Maybe [Resource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Resource]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> 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
"EventTime")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Event)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> 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
"CloudTrailEvent")
Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Event)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> 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
"EventName")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Event)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> 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
"ReadOnly")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> Event)
-> Parser (Maybe Text)
-> 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 Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AccessKeyId")
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 Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventSource")
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
"EventId")
)
instance Prelude.Hashable Event
instance Prelude.NFData Event