{-# 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.DescribeEventBus
(
DescribeEventBus (..),
newDescribeEventBus,
describeEventBus_name,
DescribeEventBusResponse (..),
newDescribeEventBusResponse,
describeEventBusResponse_arn,
describeEventBusResponse_name,
describeEventBusResponse_policy,
describeEventBusResponse_httpStatus,
)
where
import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeEventBus = DescribeEventBus'
{
DescribeEventBus -> Maybe Text
name :: Prelude.Maybe Prelude.Text
}
deriving (DescribeEventBus -> DescribeEventBus -> Bool
(DescribeEventBus -> DescribeEventBus -> Bool)
-> (DescribeEventBus -> DescribeEventBus -> Bool)
-> Eq DescribeEventBus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventBus -> DescribeEventBus -> Bool
$c/= :: DescribeEventBus -> DescribeEventBus -> Bool
== :: DescribeEventBus -> DescribeEventBus -> Bool
$c== :: DescribeEventBus -> DescribeEventBus -> Bool
Prelude.Eq, ReadPrec [DescribeEventBus]
ReadPrec DescribeEventBus
Int -> ReadS DescribeEventBus
ReadS [DescribeEventBus]
(Int -> ReadS DescribeEventBus)
-> ReadS [DescribeEventBus]
-> ReadPrec DescribeEventBus
-> ReadPrec [DescribeEventBus]
-> Read DescribeEventBus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventBus]
$creadListPrec :: ReadPrec [DescribeEventBus]
readPrec :: ReadPrec DescribeEventBus
$creadPrec :: ReadPrec DescribeEventBus
readList :: ReadS [DescribeEventBus]
$creadList :: ReadS [DescribeEventBus]
readsPrec :: Int -> ReadS DescribeEventBus
$creadsPrec :: Int -> ReadS DescribeEventBus
Prelude.Read, Int -> DescribeEventBus -> ShowS
[DescribeEventBus] -> ShowS
DescribeEventBus -> String
(Int -> DescribeEventBus -> ShowS)
-> (DescribeEventBus -> String)
-> ([DescribeEventBus] -> ShowS)
-> Show DescribeEventBus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventBus] -> ShowS
$cshowList :: [DescribeEventBus] -> ShowS
show :: DescribeEventBus -> String
$cshow :: DescribeEventBus -> String
showsPrec :: Int -> DescribeEventBus -> ShowS
$cshowsPrec :: Int -> DescribeEventBus -> ShowS
Prelude.Show, (forall x. DescribeEventBus -> Rep DescribeEventBus x)
-> (forall x. Rep DescribeEventBus x -> DescribeEventBus)
-> Generic DescribeEventBus
forall x. Rep DescribeEventBus x -> DescribeEventBus
forall x. DescribeEventBus -> Rep DescribeEventBus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEventBus x -> DescribeEventBus
$cfrom :: forall x. DescribeEventBus -> Rep DescribeEventBus x
Prelude.Generic)
newDescribeEventBus ::
DescribeEventBus
newDescribeEventBus :: DescribeEventBus
newDescribeEventBus =
DescribeEventBus' :: Maybe Text -> DescribeEventBus
DescribeEventBus' {$sel:name:DescribeEventBus' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing}
describeEventBus_name :: Lens.Lens' DescribeEventBus (Prelude.Maybe Prelude.Text)
describeEventBus_name :: (Maybe Text -> f (Maybe Text))
-> DescribeEventBus -> f DescribeEventBus
describeEventBus_name = (DescribeEventBus -> Maybe Text)
-> (DescribeEventBus -> Maybe Text -> DescribeEventBus)
-> Lens DescribeEventBus DescribeEventBus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventBus' {Maybe Text
name :: Maybe Text
$sel:name:DescribeEventBus' :: DescribeEventBus -> Maybe Text
name} -> Maybe Text
name) (\s :: DescribeEventBus
s@DescribeEventBus' {} Maybe Text
a -> DescribeEventBus
s {$sel:name:DescribeEventBus' :: Maybe Text
name = Maybe Text
a} :: DescribeEventBus)
instance Core.AWSRequest DescribeEventBus where
type
AWSResponse DescribeEventBus =
DescribeEventBusResponse
request :: DescribeEventBus -> Request DescribeEventBus
request = Service -> DescribeEventBus -> Request DescribeEventBus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeEventBus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeEventBus))
-> Logger
-> Service
-> Proxy DescribeEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeEventBus)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DescribeEventBusResponse
DescribeEventBusResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DescribeEventBusResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text -> Maybe Text -> Int -> DescribeEventBusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Arn")
Either
String
(Maybe Text -> Maybe Text -> Int -> DescribeEventBusResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DescribeEventBusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
Either String (Maybe Text -> Int -> DescribeEventBusResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeEventBusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Policy")
Either String (Int -> DescribeEventBusResponse)
-> Either String Int -> Either String DescribeEventBusResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeEventBus
instance Prelude.NFData DescribeEventBus
instance Core.ToHeaders DescribeEventBus where
toHeaders :: DescribeEventBus -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeEventBus -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSEvents.DescribeEventBus" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DescribeEventBus where
toJSON :: DescribeEventBus -> Value
toJSON DescribeEventBus' {Maybe Text
name :: Maybe Text
$sel:name:DescribeEventBus' :: DescribeEventBus -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name]
)
instance Core.ToPath DescribeEventBus where
toPath :: DescribeEventBus -> ByteString
toPath = ByteString -> DescribeEventBus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeEventBus where
toQuery :: DescribeEventBus -> QueryString
toQuery = QueryString -> DescribeEventBus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeEventBusResponse = DescribeEventBusResponse'
{
DescribeEventBusResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
DescribeEventBusResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
DescribeEventBusResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
DescribeEventBusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeEventBusResponse -> DescribeEventBusResponse -> Bool
(DescribeEventBusResponse -> DescribeEventBusResponse -> Bool)
-> (DescribeEventBusResponse -> DescribeEventBusResponse -> Bool)
-> Eq DescribeEventBusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventBusResponse -> DescribeEventBusResponse -> Bool
$c/= :: DescribeEventBusResponse -> DescribeEventBusResponse -> Bool
== :: DescribeEventBusResponse -> DescribeEventBusResponse -> Bool
$c== :: DescribeEventBusResponse -> DescribeEventBusResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventBusResponse]
ReadPrec DescribeEventBusResponse
Int -> ReadS DescribeEventBusResponse
ReadS [DescribeEventBusResponse]
(Int -> ReadS DescribeEventBusResponse)
-> ReadS [DescribeEventBusResponse]
-> ReadPrec DescribeEventBusResponse
-> ReadPrec [DescribeEventBusResponse]
-> Read DescribeEventBusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventBusResponse]
$creadListPrec :: ReadPrec [DescribeEventBusResponse]
readPrec :: ReadPrec DescribeEventBusResponse
$creadPrec :: ReadPrec DescribeEventBusResponse
readList :: ReadS [DescribeEventBusResponse]
$creadList :: ReadS [DescribeEventBusResponse]
readsPrec :: Int -> ReadS DescribeEventBusResponse
$creadsPrec :: Int -> ReadS DescribeEventBusResponse
Prelude.Read, Int -> DescribeEventBusResponse -> ShowS
[DescribeEventBusResponse] -> ShowS
DescribeEventBusResponse -> String
(Int -> DescribeEventBusResponse -> ShowS)
-> (DescribeEventBusResponse -> String)
-> ([DescribeEventBusResponse] -> ShowS)
-> Show DescribeEventBusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventBusResponse] -> ShowS
$cshowList :: [DescribeEventBusResponse] -> ShowS
show :: DescribeEventBusResponse -> String
$cshow :: DescribeEventBusResponse -> String
showsPrec :: Int -> DescribeEventBusResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventBusResponse -> ShowS
Prelude.Show, (forall x.
DescribeEventBusResponse -> Rep DescribeEventBusResponse x)
-> (forall x.
Rep DescribeEventBusResponse x -> DescribeEventBusResponse)
-> Generic DescribeEventBusResponse
forall x.
Rep DescribeEventBusResponse x -> DescribeEventBusResponse
forall x.
DescribeEventBusResponse -> Rep DescribeEventBusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventBusResponse x -> DescribeEventBusResponse
$cfrom :: forall x.
DescribeEventBusResponse -> Rep DescribeEventBusResponse x
Prelude.Generic)
newDescribeEventBusResponse ::
Prelude.Int ->
DescribeEventBusResponse
newDescribeEventBusResponse :: Int -> DescribeEventBusResponse
newDescribeEventBusResponse Int
pHttpStatus_ =
DescribeEventBusResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DescribeEventBusResponse
DescribeEventBusResponse'
{ $sel:arn:DescribeEventBusResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DescribeEventBusResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policy:DescribeEventBusResponse' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeEventBusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeEventBusResponse_arn :: Lens.Lens' DescribeEventBusResponse (Prelude.Maybe Prelude.Text)
describeEventBusResponse_arn :: (Maybe Text -> f (Maybe Text))
-> DescribeEventBusResponse -> f DescribeEventBusResponse
describeEventBusResponse_arn = (DescribeEventBusResponse -> Maybe Text)
-> (DescribeEventBusResponse
-> Maybe Text -> DescribeEventBusResponse)
-> Lens
DescribeEventBusResponse
DescribeEventBusResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventBusResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DescribeEventBusResponse' :: DescribeEventBusResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DescribeEventBusResponse
s@DescribeEventBusResponse' {} Maybe Text
a -> DescribeEventBusResponse
s {$sel:arn:DescribeEventBusResponse' :: Maybe Text
arn = Maybe Text
a} :: DescribeEventBusResponse)
describeEventBusResponse_name :: Lens.Lens' DescribeEventBusResponse (Prelude.Maybe Prelude.Text)
describeEventBusResponse_name :: (Maybe Text -> f (Maybe Text))
-> DescribeEventBusResponse -> f DescribeEventBusResponse
describeEventBusResponse_name = (DescribeEventBusResponse -> Maybe Text)
-> (DescribeEventBusResponse
-> Maybe Text -> DescribeEventBusResponse)
-> Lens
DescribeEventBusResponse
DescribeEventBusResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventBusResponse' {Maybe Text
name :: Maybe Text
$sel:name:DescribeEventBusResponse' :: DescribeEventBusResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: DescribeEventBusResponse
s@DescribeEventBusResponse' {} Maybe Text
a -> DescribeEventBusResponse
s {$sel:name:DescribeEventBusResponse' :: Maybe Text
name = Maybe Text
a} :: DescribeEventBusResponse)
describeEventBusResponse_policy :: Lens.Lens' DescribeEventBusResponse (Prelude.Maybe Prelude.Text)
describeEventBusResponse_policy :: (Maybe Text -> f (Maybe Text))
-> DescribeEventBusResponse -> f DescribeEventBusResponse
describeEventBusResponse_policy = (DescribeEventBusResponse -> Maybe Text)
-> (DescribeEventBusResponse
-> Maybe Text -> DescribeEventBusResponse)
-> Lens
DescribeEventBusResponse
DescribeEventBusResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventBusResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:DescribeEventBusResponse' :: DescribeEventBusResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: DescribeEventBusResponse
s@DescribeEventBusResponse' {} Maybe Text
a -> DescribeEventBusResponse
s {$sel:policy:DescribeEventBusResponse' :: Maybe Text
policy = Maybe Text
a} :: DescribeEventBusResponse)
describeEventBusResponse_httpStatus :: Lens.Lens' DescribeEventBusResponse Prelude.Int
describeEventBusResponse_httpStatus :: (Int -> f Int)
-> DescribeEventBusResponse -> f DescribeEventBusResponse
describeEventBusResponse_httpStatus = (DescribeEventBusResponse -> Int)
-> (DescribeEventBusResponse -> Int -> DescribeEventBusResponse)
-> Lens DescribeEventBusResponse DescribeEventBusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventBusResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeEventBusResponse' :: DescribeEventBusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeEventBusResponse
s@DescribeEventBusResponse' {} Int
a -> DescribeEventBusResponse
s {$sel:httpStatus:DescribeEventBusResponse' :: Int
httpStatus = Int
a} :: DescribeEventBusResponse)
instance Prelude.NFData DescribeEventBusResponse