{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudWatchEvents.DescribeEventSource
(
DescribeEventSource (..),
newDescribeEventSource,
describeEventSource_name,
DescribeEventSourceResponse (..),
newDescribeEventSourceResponse,
describeEventSourceResponse_arn,
describeEventSourceResponse_createdBy,
describeEventSourceResponse_creationTime,
describeEventSourceResponse_expirationTime,
describeEventSourceResponse_name,
describeEventSourceResponse_state,
describeEventSourceResponse_httpStatus,
)
where
import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeEventSource = DescribeEventSource'
{
DescribeEventSource -> Text
name :: Prelude.Text
}
deriving (DescribeEventSource -> DescribeEventSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventSource -> DescribeEventSource -> Bool
$c/= :: DescribeEventSource -> DescribeEventSource -> Bool
== :: DescribeEventSource -> DescribeEventSource -> Bool
$c== :: DescribeEventSource -> DescribeEventSource -> Bool
Prelude.Eq, ReadPrec [DescribeEventSource]
ReadPrec DescribeEventSource
Int -> ReadS DescribeEventSource
ReadS [DescribeEventSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventSource]
$creadListPrec :: ReadPrec [DescribeEventSource]
readPrec :: ReadPrec DescribeEventSource
$creadPrec :: ReadPrec DescribeEventSource
readList :: ReadS [DescribeEventSource]
$creadList :: ReadS [DescribeEventSource]
readsPrec :: Int -> ReadS DescribeEventSource
$creadsPrec :: Int -> ReadS DescribeEventSource
Prelude.Read, Int -> DescribeEventSource -> ShowS
[DescribeEventSource] -> ShowS
DescribeEventSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventSource] -> ShowS
$cshowList :: [DescribeEventSource] -> ShowS
show :: DescribeEventSource -> String
$cshow :: DescribeEventSource -> String
showsPrec :: Int -> DescribeEventSource -> ShowS
$cshowsPrec :: Int -> DescribeEventSource -> ShowS
Prelude.Show, forall x. Rep DescribeEventSource x -> DescribeEventSource
forall x. DescribeEventSource -> Rep DescribeEventSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEventSource x -> DescribeEventSource
$cfrom :: forall x. DescribeEventSource -> Rep DescribeEventSource x
Prelude.Generic)
newDescribeEventSource ::
Prelude.Text ->
DescribeEventSource
newDescribeEventSource :: Text -> DescribeEventSource
newDescribeEventSource Text
pName_ =
DescribeEventSource' {$sel:name:DescribeEventSource' :: Text
name = Text
pName_}
describeEventSource_name :: Lens.Lens' DescribeEventSource Prelude.Text
describeEventSource_name :: Lens' DescribeEventSource Text
describeEventSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSource' {Text
name :: Text
$sel:name:DescribeEventSource' :: DescribeEventSource -> Text
name} -> Text
name) (\s :: DescribeEventSource
s@DescribeEventSource' {} Text
a -> DescribeEventSource
s {$sel:name:DescribeEventSource' :: Text
name = Text
a} :: DescribeEventSource)
instance Core.AWSRequest DescribeEventSource where
type
AWSResponse DescribeEventSource =
DescribeEventSourceResponse
request :: (Service -> Service)
-> DescribeEventSource -> Request DescribeEventSource
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeEventSource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeEventSource)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe EventSourceState
-> Int
-> DescribeEventSourceResponse
DescribeEventSourceResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreatedBy")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreationTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ExpirationTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (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 -> Either String (Maybe a)
Data..?> Key
"State")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeEventSource where
hashWithSalt :: Int -> DescribeEventSource -> Int
hashWithSalt Int
_salt DescribeEventSource' {Text
name :: Text
$sel:name:DescribeEventSource' :: DescribeEventSource -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData DescribeEventSource where
rnf :: DescribeEventSource -> ()
rnf DescribeEventSource' {Text
name :: Text
$sel:name:DescribeEventSource' :: DescribeEventSource -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders DescribeEventSource where
toHeaders :: DescribeEventSource -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSEvents.DescribeEventSource" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DescribeEventSource where
toJSON :: DescribeEventSource -> Value
toJSON DescribeEventSource' {Text
name :: Text
$sel:name:DescribeEventSource' :: DescribeEventSource -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
)
instance Data.ToPath DescribeEventSource where
toPath :: DescribeEventSource -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DescribeEventSource where
toQuery :: DescribeEventSource -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribeEventSourceResponse = DescribeEventSourceResponse'
{
DescribeEventSourceResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
DescribeEventSourceResponse -> Maybe Text
createdBy :: Prelude.Maybe Prelude.Text,
DescribeEventSourceResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
DescribeEventSourceResponse -> Maybe POSIX
expirationTime :: Prelude.Maybe Data.POSIX,
DescribeEventSourceResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
DescribeEventSourceResponse -> Maybe EventSourceState
state :: Prelude.Maybe EventSourceState,
DescribeEventSourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeEventSourceResponse -> DescribeEventSourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventSourceResponse -> DescribeEventSourceResponse -> Bool
$c/= :: DescribeEventSourceResponse -> DescribeEventSourceResponse -> Bool
== :: DescribeEventSourceResponse -> DescribeEventSourceResponse -> Bool
$c== :: DescribeEventSourceResponse -> DescribeEventSourceResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventSourceResponse]
ReadPrec DescribeEventSourceResponse
Int -> ReadS DescribeEventSourceResponse
ReadS [DescribeEventSourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventSourceResponse]
$creadListPrec :: ReadPrec [DescribeEventSourceResponse]
readPrec :: ReadPrec DescribeEventSourceResponse
$creadPrec :: ReadPrec DescribeEventSourceResponse
readList :: ReadS [DescribeEventSourceResponse]
$creadList :: ReadS [DescribeEventSourceResponse]
readsPrec :: Int -> ReadS DescribeEventSourceResponse
$creadsPrec :: Int -> ReadS DescribeEventSourceResponse
Prelude.Read, Int -> DescribeEventSourceResponse -> ShowS
[DescribeEventSourceResponse] -> ShowS
DescribeEventSourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventSourceResponse] -> ShowS
$cshowList :: [DescribeEventSourceResponse] -> ShowS
show :: DescribeEventSourceResponse -> String
$cshow :: DescribeEventSourceResponse -> String
showsPrec :: Int -> DescribeEventSourceResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventSourceResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeEventSourceResponse x -> DescribeEventSourceResponse
forall x.
DescribeEventSourceResponse -> Rep DescribeEventSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventSourceResponse x -> DescribeEventSourceResponse
$cfrom :: forall x.
DescribeEventSourceResponse -> Rep DescribeEventSourceResponse x
Prelude.Generic)
newDescribeEventSourceResponse ::
Prelude.Int ->
DescribeEventSourceResponse
newDescribeEventSourceResponse :: Int -> DescribeEventSourceResponse
newDescribeEventSourceResponse Int
pHttpStatus_ =
DescribeEventSourceResponse'
{ $sel:arn:DescribeEventSourceResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:createdBy:DescribeEventSourceResponse' :: Maybe Text
createdBy = forall a. Maybe a
Prelude.Nothing,
$sel:creationTime:DescribeEventSourceResponse' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
$sel:expirationTime:DescribeEventSourceResponse' :: Maybe POSIX
expirationTime = forall a. Maybe a
Prelude.Nothing,
$sel:name:DescribeEventSourceResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:state:DescribeEventSourceResponse' :: Maybe EventSourceState
state = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeEventSourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeEventSourceResponse_arn :: Lens.Lens' DescribeEventSourceResponse (Prelude.Maybe Prelude.Text)
describeEventSourceResponse_arn :: Lens' DescribeEventSourceResponse (Maybe Text)
describeEventSourceResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Maybe Text
a -> DescribeEventSourceResponse
s {$sel:arn:DescribeEventSourceResponse' :: Maybe Text
arn = Maybe Text
a} :: DescribeEventSourceResponse)
describeEventSourceResponse_createdBy :: Lens.Lens' DescribeEventSourceResponse (Prelude.Maybe Prelude.Text)
describeEventSourceResponse_createdBy :: Lens' DescribeEventSourceResponse (Maybe Text)
describeEventSourceResponse_createdBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Maybe Text
createdBy :: Maybe Text
$sel:createdBy:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe Text
createdBy} -> Maybe Text
createdBy) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Maybe Text
a -> DescribeEventSourceResponse
s {$sel:createdBy:DescribeEventSourceResponse' :: Maybe Text
createdBy = Maybe Text
a} :: DescribeEventSourceResponse)
describeEventSourceResponse_creationTime :: Lens.Lens' DescribeEventSourceResponse (Prelude.Maybe Prelude.UTCTime)
describeEventSourceResponse_creationTime :: Lens' DescribeEventSourceResponse (Maybe UTCTime)
describeEventSourceResponse_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Maybe POSIX
a -> DescribeEventSourceResponse
s {$sel:creationTime:DescribeEventSourceResponse' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: DescribeEventSourceResponse) 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
describeEventSourceResponse_expirationTime :: Lens.Lens' DescribeEventSourceResponse (Prelude.Maybe Prelude.UTCTime)
describeEventSourceResponse_expirationTime :: Lens' DescribeEventSourceResponse (Maybe UTCTime)
describeEventSourceResponse_expirationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Maybe POSIX
expirationTime :: Maybe POSIX
$sel:expirationTime:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe POSIX
expirationTime} -> Maybe POSIX
expirationTime) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Maybe POSIX
a -> DescribeEventSourceResponse
s {$sel:expirationTime:DescribeEventSourceResponse' :: Maybe POSIX
expirationTime = Maybe POSIX
a} :: DescribeEventSourceResponse) 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
describeEventSourceResponse_name :: Lens.Lens' DescribeEventSourceResponse (Prelude.Maybe Prelude.Text)
describeEventSourceResponse_name :: Lens' DescribeEventSourceResponse (Maybe Text)
describeEventSourceResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Maybe Text
name :: Maybe Text
$sel:name:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Maybe Text
a -> DescribeEventSourceResponse
s {$sel:name:DescribeEventSourceResponse' :: Maybe Text
name = Maybe Text
a} :: DescribeEventSourceResponse)
describeEventSourceResponse_state :: Lens.Lens' DescribeEventSourceResponse (Prelude.Maybe EventSourceState)
describeEventSourceResponse_state :: Lens' DescribeEventSourceResponse (Maybe EventSourceState)
describeEventSourceResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Maybe EventSourceState
state :: Maybe EventSourceState
$sel:state:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe EventSourceState
state} -> Maybe EventSourceState
state) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Maybe EventSourceState
a -> DescribeEventSourceResponse
s {$sel:state:DescribeEventSourceResponse' :: Maybe EventSourceState
state = Maybe EventSourceState
a} :: DescribeEventSourceResponse)
describeEventSourceResponse_httpStatus :: Lens.Lens' DescribeEventSourceResponse Prelude.Int
describeEventSourceResponse_httpStatus :: Lens' DescribeEventSourceResponse Int
describeEventSourceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeEventSourceResponse
s@DescribeEventSourceResponse' {} Int
a -> DescribeEventSourceResponse
s {$sel:httpStatus:DescribeEventSourceResponse' :: Int
httpStatus = Int
a} :: DescribeEventSourceResponse)
instance Prelude.NFData DescribeEventSourceResponse where
rnf :: DescribeEventSourceResponse -> ()
rnf DescribeEventSourceResponse' {Int
Maybe Text
Maybe POSIX
Maybe EventSourceState
httpStatus :: Int
state :: Maybe EventSourceState
name :: Maybe Text
expirationTime :: Maybe POSIX
creationTime :: Maybe POSIX
createdBy :: Maybe Text
arn :: Maybe Text
$sel:httpStatus:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Int
$sel:state:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe EventSourceState
$sel:name:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe Text
$sel:expirationTime:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe POSIX
$sel:creationTime:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe POSIX
$sel:createdBy:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe Text
$sel:arn:DescribeEventSourceResponse' :: DescribeEventSourceResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdBy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expirationTime
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 EventSourceState
state
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus