{-# 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.DirectoryService.DescribeEventTopics
(
DescribeEventTopics (..),
newDescribeEventTopics,
describeEventTopics_directoryId,
describeEventTopics_topicNames,
DescribeEventTopicsResponse (..),
newDescribeEventTopicsResponse,
describeEventTopicsResponse_eventTopics,
describeEventTopicsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types
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 DescribeEventTopics = DescribeEventTopics'
{
DescribeEventTopics -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
DescribeEventTopics -> Maybe [Text]
topicNames :: Prelude.Maybe [Prelude.Text]
}
deriving (DescribeEventTopics -> DescribeEventTopics -> Bool
(DescribeEventTopics -> DescribeEventTopics -> Bool)
-> (DescribeEventTopics -> DescribeEventTopics -> Bool)
-> Eq DescribeEventTopics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventTopics -> DescribeEventTopics -> Bool
$c/= :: DescribeEventTopics -> DescribeEventTopics -> Bool
== :: DescribeEventTopics -> DescribeEventTopics -> Bool
$c== :: DescribeEventTopics -> DescribeEventTopics -> Bool
Prelude.Eq, ReadPrec [DescribeEventTopics]
ReadPrec DescribeEventTopics
Int -> ReadS DescribeEventTopics
ReadS [DescribeEventTopics]
(Int -> ReadS DescribeEventTopics)
-> ReadS [DescribeEventTopics]
-> ReadPrec DescribeEventTopics
-> ReadPrec [DescribeEventTopics]
-> Read DescribeEventTopics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventTopics]
$creadListPrec :: ReadPrec [DescribeEventTopics]
readPrec :: ReadPrec DescribeEventTopics
$creadPrec :: ReadPrec DescribeEventTopics
readList :: ReadS [DescribeEventTopics]
$creadList :: ReadS [DescribeEventTopics]
readsPrec :: Int -> ReadS DescribeEventTopics
$creadsPrec :: Int -> ReadS DescribeEventTopics
Prelude.Read, Int -> DescribeEventTopics -> ShowS
[DescribeEventTopics] -> ShowS
DescribeEventTopics -> String
(Int -> DescribeEventTopics -> ShowS)
-> (DescribeEventTopics -> String)
-> ([DescribeEventTopics] -> ShowS)
-> Show DescribeEventTopics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventTopics] -> ShowS
$cshowList :: [DescribeEventTopics] -> ShowS
show :: DescribeEventTopics -> String
$cshow :: DescribeEventTopics -> String
showsPrec :: Int -> DescribeEventTopics -> ShowS
$cshowsPrec :: Int -> DescribeEventTopics -> ShowS
Prelude.Show, (forall x. DescribeEventTopics -> Rep DescribeEventTopics x)
-> (forall x. Rep DescribeEventTopics x -> DescribeEventTopics)
-> Generic DescribeEventTopics
forall x. Rep DescribeEventTopics x -> DescribeEventTopics
forall x. DescribeEventTopics -> Rep DescribeEventTopics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEventTopics x -> DescribeEventTopics
$cfrom :: forall x. DescribeEventTopics -> Rep DescribeEventTopics x
Prelude.Generic)
newDescribeEventTopics ::
DescribeEventTopics
newDescribeEventTopics :: DescribeEventTopics
newDescribeEventTopics =
DescribeEventTopics' :: Maybe Text -> Maybe [Text] -> DescribeEventTopics
DescribeEventTopics'
{ $sel:directoryId:DescribeEventTopics' :: Maybe Text
directoryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:topicNames:DescribeEventTopics' :: Maybe [Text]
topicNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
describeEventTopics_directoryId :: Lens.Lens' DescribeEventTopics (Prelude.Maybe Prelude.Text)
describeEventTopics_directoryId :: (Maybe Text -> f (Maybe Text))
-> DescribeEventTopics -> f DescribeEventTopics
describeEventTopics_directoryId = (DescribeEventTopics -> Maybe Text)
-> (DescribeEventTopics -> Maybe Text -> DescribeEventTopics)
-> Lens
DescribeEventTopics DescribeEventTopics (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTopics' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:DescribeEventTopics' :: DescribeEventTopics -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: DescribeEventTopics
s@DescribeEventTopics' {} Maybe Text
a -> DescribeEventTopics
s {$sel:directoryId:DescribeEventTopics' :: Maybe Text
directoryId = Maybe Text
a} :: DescribeEventTopics)
describeEventTopics_topicNames :: Lens.Lens' DescribeEventTopics (Prelude.Maybe [Prelude.Text])
describeEventTopics_topicNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventTopics -> f DescribeEventTopics
describeEventTopics_topicNames = (DescribeEventTopics -> Maybe [Text])
-> (DescribeEventTopics -> Maybe [Text] -> DescribeEventTopics)
-> Lens
DescribeEventTopics
DescribeEventTopics
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTopics' {Maybe [Text]
topicNames :: Maybe [Text]
$sel:topicNames:DescribeEventTopics' :: DescribeEventTopics -> Maybe [Text]
topicNames} -> Maybe [Text]
topicNames) (\s :: DescribeEventTopics
s@DescribeEventTopics' {} Maybe [Text]
a -> DescribeEventTopics
s {$sel:topicNames:DescribeEventTopics' :: Maybe [Text]
topicNames = Maybe [Text]
a} :: DescribeEventTopics) ((Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventTopics -> f DescribeEventTopics)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventTopics
-> f DescribeEventTopics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeEventTopics where
type
AWSResponse DescribeEventTopics =
DescribeEventTopicsResponse
request :: DescribeEventTopics -> Request DescribeEventTopics
request = Service -> DescribeEventTopics -> Request DescribeEventTopics
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeEventTopics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeEventTopics)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeEventTopics))
-> Logger
-> Service
-> Proxy DescribeEventTopics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeEventTopics)))
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 [EventTopic] -> Int -> DescribeEventTopicsResponse
DescribeEventTopicsResponse'
(Maybe [EventTopic] -> Int -> DescribeEventTopicsResponse)
-> Either String (Maybe [EventTopic])
-> Either String (Int -> DescribeEventTopicsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [EventTopic]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventTopics" Either String (Maybe (Maybe [EventTopic]))
-> Maybe [EventTopic] -> Either String (Maybe [EventTopic])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EventTopic]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeEventTopicsResponse)
-> Either String Int -> Either String DescribeEventTopicsResponse
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 DescribeEventTopics
instance Prelude.NFData DescribeEventTopics
instance Core.ToHeaders DescribeEventTopics where
toHeaders :: DescribeEventTopics -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeEventTopics -> 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
"DirectoryService_20150416.DescribeEventTopics" ::
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 DescribeEventTopics where
toJSON :: DescribeEventTopics -> Value
toJSON DescribeEventTopics' {Maybe [Text]
Maybe Text
topicNames :: Maybe [Text]
directoryId :: Maybe Text
$sel:topicNames:DescribeEventTopics' :: DescribeEventTopics -> Maybe [Text]
$sel:directoryId:DescribeEventTopics' :: DescribeEventTopics -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DirectoryId" 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
directoryId,
(Text
"TopicNames" 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]
topicNames
]
)
instance Core.ToPath DescribeEventTopics where
toPath :: DescribeEventTopics -> ByteString
toPath = ByteString -> DescribeEventTopics -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeEventTopics where
toQuery :: DescribeEventTopics -> QueryString
toQuery = QueryString -> DescribeEventTopics -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeEventTopicsResponse = DescribeEventTopicsResponse'
{
DescribeEventTopicsResponse -> Maybe [EventTopic]
eventTopics :: Prelude.Maybe [EventTopic],
DescribeEventTopicsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeEventTopicsResponse -> DescribeEventTopicsResponse -> Bool
(DescribeEventTopicsResponse
-> DescribeEventTopicsResponse -> Bool)
-> (DescribeEventTopicsResponse
-> DescribeEventTopicsResponse -> Bool)
-> Eq DescribeEventTopicsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventTopicsResponse -> DescribeEventTopicsResponse -> Bool
$c/= :: DescribeEventTopicsResponse -> DescribeEventTopicsResponse -> Bool
== :: DescribeEventTopicsResponse -> DescribeEventTopicsResponse -> Bool
$c== :: DescribeEventTopicsResponse -> DescribeEventTopicsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventTopicsResponse]
ReadPrec DescribeEventTopicsResponse
Int -> ReadS DescribeEventTopicsResponse
ReadS [DescribeEventTopicsResponse]
(Int -> ReadS DescribeEventTopicsResponse)
-> ReadS [DescribeEventTopicsResponse]
-> ReadPrec DescribeEventTopicsResponse
-> ReadPrec [DescribeEventTopicsResponse]
-> Read DescribeEventTopicsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventTopicsResponse]
$creadListPrec :: ReadPrec [DescribeEventTopicsResponse]
readPrec :: ReadPrec DescribeEventTopicsResponse
$creadPrec :: ReadPrec DescribeEventTopicsResponse
readList :: ReadS [DescribeEventTopicsResponse]
$creadList :: ReadS [DescribeEventTopicsResponse]
readsPrec :: Int -> ReadS DescribeEventTopicsResponse
$creadsPrec :: Int -> ReadS DescribeEventTopicsResponse
Prelude.Read, Int -> DescribeEventTopicsResponse -> ShowS
[DescribeEventTopicsResponse] -> ShowS
DescribeEventTopicsResponse -> String
(Int -> DescribeEventTopicsResponse -> ShowS)
-> (DescribeEventTopicsResponse -> String)
-> ([DescribeEventTopicsResponse] -> ShowS)
-> Show DescribeEventTopicsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventTopicsResponse] -> ShowS
$cshowList :: [DescribeEventTopicsResponse] -> ShowS
show :: DescribeEventTopicsResponse -> String
$cshow :: DescribeEventTopicsResponse -> String
showsPrec :: Int -> DescribeEventTopicsResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventTopicsResponse -> ShowS
Prelude.Show, (forall x.
DescribeEventTopicsResponse -> Rep DescribeEventTopicsResponse x)
-> (forall x.
Rep DescribeEventTopicsResponse x -> DescribeEventTopicsResponse)
-> Generic DescribeEventTopicsResponse
forall x.
Rep DescribeEventTopicsResponse x -> DescribeEventTopicsResponse
forall x.
DescribeEventTopicsResponse -> Rep DescribeEventTopicsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventTopicsResponse x -> DescribeEventTopicsResponse
$cfrom :: forall x.
DescribeEventTopicsResponse -> Rep DescribeEventTopicsResponse x
Prelude.Generic)
newDescribeEventTopicsResponse ::
Prelude.Int ->
DescribeEventTopicsResponse
newDescribeEventTopicsResponse :: Int -> DescribeEventTopicsResponse
newDescribeEventTopicsResponse Int
pHttpStatus_ =
DescribeEventTopicsResponse' :: Maybe [EventTopic] -> Int -> DescribeEventTopicsResponse
DescribeEventTopicsResponse'
{ $sel:eventTopics:DescribeEventTopicsResponse' :: Maybe [EventTopic]
eventTopics =
Maybe [EventTopic]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeEventTopicsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeEventTopicsResponse_eventTopics :: Lens.Lens' DescribeEventTopicsResponse (Prelude.Maybe [EventTopic])
describeEventTopicsResponse_eventTopics :: (Maybe [EventTopic] -> f (Maybe [EventTopic]))
-> DescribeEventTopicsResponse -> f DescribeEventTopicsResponse
describeEventTopicsResponse_eventTopics = (DescribeEventTopicsResponse -> Maybe [EventTopic])
-> (DescribeEventTopicsResponse
-> Maybe [EventTopic] -> DescribeEventTopicsResponse)
-> Lens
DescribeEventTopicsResponse
DescribeEventTopicsResponse
(Maybe [EventTopic])
(Maybe [EventTopic])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTopicsResponse' {Maybe [EventTopic]
eventTopics :: Maybe [EventTopic]
$sel:eventTopics:DescribeEventTopicsResponse' :: DescribeEventTopicsResponse -> Maybe [EventTopic]
eventTopics} -> Maybe [EventTopic]
eventTopics) (\s :: DescribeEventTopicsResponse
s@DescribeEventTopicsResponse' {} Maybe [EventTopic]
a -> DescribeEventTopicsResponse
s {$sel:eventTopics:DescribeEventTopicsResponse' :: Maybe [EventTopic]
eventTopics = Maybe [EventTopic]
a} :: DescribeEventTopicsResponse) ((Maybe [EventTopic] -> f (Maybe [EventTopic]))
-> DescribeEventTopicsResponse -> f DescribeEventTopicsResponse)
-> ((Maybe [EventTopic] -> f (Maybe [EventTopic]))
-> Maybe [EventTopic] -> f (Maybe [EventTopic]))
-> (Maybe [EventTopic] -> f (Maybe [EventTopic]))
-> DescribeEventTopicsResponse
-> f DescribeEventTopicsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EventTopic] [EventTopic] [EventTopic] [EventTopic]
-> Iso
(Maybe [EventTopic])
(Maybe [EventTopic])
(Maybe [EventTopic])
(Maybe [EventTopic])
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 [EventTopic] [EventTopic] [EventTopic] [EventTopic]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeEventTopicsResponse_httpStatus :: Lens.Lens' DescribeEventTopicsResponse Prelude.Int
describeEventTopicsResponse_httpStatus :: (Int -> f Int)
-> DescribeEventTopicsResponse -> f DescribeEventTopicsResponse
describeEventTopicsResponse_httpStatus = (DescribeEventTopicsResponse -> Int)
-> (DescribeEventTopicsResponse
-> Int -> DescribeEventTopicsResponse)
-> Lens
DescribeEventTopicsResponse DescribeEventTopicsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTopicsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeEventTopicsResponse' :: DescribeEventTopicsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeEventTopicsResponse
s@DescribeEventTopicsResponse' {} Int
a -> DescribeEventTopicsResponse
s {$sel:httpStatus:DescribeEventTopicsResponse' :: Int
httpStatus = Int
a} :: DescribeEventTopicsResponse)
instance Prelude.NFData DescribeEventTopicsResponse