{-# 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.CloudWatchEvents.Types.EventSource where
import Amazonka.CloudWatchEvents.Types.EventSourceState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EventSource = EventSource'
{
EventSource -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
EventSource -> Maybe EventSourceState
state :: Prelude.Maybe EventSourceState,
EventSource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
EventSource -> Maybe Text
createdBy :: Prelude.Maybe Prelude.Text,
EventSource -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
EventSource -> Maybe POSIX
expirationTime :: Prelude.Maybe Core.POSIX
}
deriving (EventSource -> EventSource -> Bool
(EventSource -> EventSource -> Bool)
-> (EventSource -> EventSource -> Bool) -> Eq EventSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventSource -> EventSource -> Bool
$c/= :: EventSource -> EventSource -> Bool
== :: EventSource -> EventSource -> Bool
$c== :: EventSource -> EventSource -> Bool
Prelude.Eq, ReadPrec [EventSource]
ReadPrec EventSource
Int -> ReadS EventSource
ReadS [EventSource]
(Int -> ReadS EventSource)
-> ReadS [EventSource]
-> ReadPrec EventSource
-> ReadPrec [EventSource]
-> Read EventSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventSource]
$creadListPrec :: ReadPrec [EventSource]
readPrec :: ReadPrec EventSource
$creadPrec :: ReadPrec EventSource
readList :: ReadS [EventSource]
$creadList :: ReadS [EventSource]
readsPrec :: Int -> ReadS EventSource
$creadsPrec :: Int -> ReadS EventSource
Prelude.Read, Int -> EventSource -> ShowS
[EventSource] -> ShowS
EventSource -> String
(Int -> EventSource -> ShowS)
-> (EventSource -> String)
-> ([EventSource] -> ShowS)
-> Show EventSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventSource] -> ShowS
$cshowList :: [EventSource] -> ShowS
show :: EventSource -> String
$cshow :: EventSource -> String
showsPrec :: Int -> EventSource -> ShowS
$cshowsPrec :: Int -> EventSource -> ShowS
Prelude.Show, (forall x. EventSource -> Rep EventSource x)
-> (forall x. Rep EventSource x -> EventSource)
-> Generic EventSource
forall x. Rep EventSource x -> EventSource
forall x. EventSource -> Rep EventSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventSource x -> EventSource
$cfrom :: forall x. EventSource -> Rep EventSource x
Prelude.Generic)
newEventSource ::
EventSource
newEventSource :: EventSource
newEventSource =
EventSource' :: Maybe POSIX
-> Maybe EventSourceState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> EventSource
EventSource'
{ $sel:creationTime:EventSource' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:state:EventSource' :: Maybe EventSourceState
state = Maybe EventSourceState
forall a. Maybe a
Prelude.Nothing,
$sel:arn:EventSource' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createdBy:EventSource' :: Maybe Text
createdBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:EventSource' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expirationTime:EventSource' :: Maybe POSIX
expirationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
eventSource_creationTime :: Lens.Lens' EventSource (Prelude.Maybe Prelude.UTCTime)
eventSource_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EventSource -> f EventSource
eventSource_creationTime = (EventSource -> Maybe POSIX)
-> (EventSource -> Maybe POSIX -> EventSource)
-> Lens EventSource EventSource (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSource' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:EventSource' :: EventSource -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: EventSource
s@EventSource' {} Maybe POSIX
a -> EventSource
s {$sel:creationTime:EventSource' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: EventSource) ((Maybe POSIX -> f (Maybe POSIX)) -> EventSource -> f EventSource)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EventSource
-> f EventSource
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
eventSource_state :: Lens.Lens' EventSource (Prelude.Maybe EventSourceState)
eventSource_state :: (Maybe EventSourceState -> f (Maybe EventSourceState))
-> EventSource -> f EventSource
eventSource_state = (EventSource -> Maybe EventSourceState)
-> (EventSource -> Maybe EventSourceState -> EventSource)
-> Lens
EventSource
EventSource
(Maybe EventSourceState)
(Maybe EventSourceState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSource' {Maybe EventSourceState
state :: Maybe EventSourceState
$sel:state:EventSource' :: EventSource -> Maybe EventSourceState
state} -> Maybe EventSourceState
state) (\s :: EventSource
s@EventSource' {} Maybe EventSourceState
a -> EventSource
s {$sel:state:EventSource' :: Maybe EventSourceState
state = Maybe EventSourceState
a} :: EventSource)
eventSource_arn :: Lens.Lens' EventSource (Prelude.Maybe Prelude.Text)
eventSource_arn :: (Maybe Text -> f (Maybe Text)) -> EventSource -> f EventSource
eventSource_arn = (EventSource -> Maybe Text)
-> (EventSource -> Maybe Text -> EventSource)
-> Lens EventSource EventSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSource' {Maybe Text
arn :: Maybe Text
$sel:arn:EventSource' :: EventSource -> Maybe Text
arn} -> Maybe Text
arn) (\s :: EventSource
s@EventSource' {} Maybe Text
a -> EventSource
s {$sel:arn:EventSource' :: Maybe Text
arn = Maybe Text
a} :: EventSource)
eventSource_createdBy :: Lens.Lens' EventSource (Prelude.Maybe Prelude.Text)
eventSource_createdBy :: (Maybe Text -> f (Maybe Text)) -> EventSource -> f EventSource
eventSource_createdBy = (EventSource -> Maybe Text)
-> (EventSource -> Maybe Text -> EventSource)
-> Lens EventSource EventSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSource' {Maybe Text
createdBy :: Maybe Text
$sel:createdBy:EventSource' :: EventSource -> Maybe Text
createdBy} -> Maybe Text
createdBy) (\s :: EventSource
s@EventSource' {} Maybe Text
a -> EventSource
s {$sel:createdBy:EventSource' :: Maybe Text
createdBy = Maybe Text
a} :: EventSource)
eventSource_name :: Lens.Lens' EventSource (Prelude.Maybe Prelude.Text)
eventSource_name :: (Maybe Text -> f (Maybe Text)) -> EventSource -> f EventSource
eventSource_name = (EventSource -> Maybe Text)
-> (EventSource -> Maybe Text -> EventSource)
-> Lens EventSource EventSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSource' {Maybe Text
name :: Maybe Text
$sel:name:EventSource' :: EventSource -> Maybe Text
name} -> Maybe Text
name) (\s :: EventSource
s@EventSource' {} Maybe Text
a -> EventSource
s {$sel:name:EventSource' :: Maybe Text
name = Maybe Text
a} :: EventSource)
eventSource_expirationTime :: Lens.Lens' EventSource (Prelude.Maybe Prelude.UTCTime)
eventSource_expirationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EventSource -> f EventSource
eventSource_expirationTime = (EventSource -> Maybe POSIX)
-> (EventSource -> Maybe POSIX -> EventSource)
-> Lens EventSource EventSource (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSource' {Maybe POSIX
expirationTime :: Maybe POSIX
$sel:expirationTime:EventSource' :: EventSource -> Maybe POSIX
expirationTime} -> Maybe POSIX
expirationTime) (\s :: EventSource
s@EventSource' {} Maybe POSIX
a -> EventSource
s {$sel:expirationTime:EventSource' :: Maybe POSIX
expirationTime = Maybe POSIX
a} :: EventSource) ((Maybe POSIX -> f (Maybe POSIX)) -> EventSource -> f EventSource)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EventSource
-> f EventSource
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
instance Core.FromJSON EventSource where
parseJSON :: Value -> Parser EventSource
parseJSON =
String
-> (Object -> Parser EventSource) -> Value -> Parser EventSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EventSource"
( \Object
x ->
Maybe POSIX
-> Maybe EventSourceState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> EventSource
EventSource'
(Maybe POSIX
-> Maybe EventSourceState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> EventSource)
-> Parser (Maybe POSIX)
-> Parser
(Maybe EventSourceState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> EventSource)
forall (f :: * -> *) a b. Functor 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
"CreationTime")
Parser
(Maybe EventSourceState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> EventSource)
-> Parser (Maybe EventSourceState)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe POSIX -> EventSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EventSourceState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe POSIX -> EventSource)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> EventSource)
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
"Arn")
Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> EventSource)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> EventSource)
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
"CreatedBy")
Parser (Maybe Text -> Maybe POSIX -> EventSource)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> EventSource)
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 POSIX -> EventSource)
-> Parser (Maybe POSIX) -> Parser EventSource
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
"ExpirationTime")
)
instance Prelude.Hashable EventSource
instance Prelude.NFData EventSource