{-# 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.RegisterEventTopic
(
RegisterEventTopic (..),
newRegisterEventTopic,
registerEventTopic_directoryId,
registerEventTopic_topicName,
RegisterEventTopicResponse (..),
newRegisterEventTopicResponse,
registerEventTopicResponse_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 RegisterEventTopic = RegisterEventTopic'
{
RegisterEventTopic -> Text
directoryId :: Prelude.Text,
RegisterEventTopic -> Text
topicName :: Prelude.Text
}
deriving (RegisterEventTopic -> RegisterEventTopic -> Bool
(RegisterEventTopic -> RegisterEventTopic -> Bool)
-> (RegisterEventTopic -> RegisterEventTopic -> Bool)
-> Eq RegisterEventTopic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterEventTopic -> RegisterEventTopic -> Bool
$c/= :: RegisterEventTopic -> RegisterEventTopic -> Bool
== :: RegisterEventTopic -> RegisterEventTopic -> Bool
$c== :: RegisterEventTopic -> RegisterEventTopic -> Bool
Prelude.Eq, ReadPrec [RegisterEventTopic]
ReadPrec RegisterEventTopic
Int -> ReadS RegisterEventTopic
ReadS [RegisterEventTopic]
(Int -> ReadS RegisterEventTopic)
-> ReadS [RegisterEventTopic]
-> ReadPrec RegisterEventTopic
-> ReadPrec [RegisterEventTopic]
-> Read RegisterEventTopic
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterEventTopic]
$creadListPrec :: ReadPrec [RegisterEventTopic]
readPrec :: ReadPrec RegisterEventTopic
$creadPrec :: ReadPrec RegisterEventTopic
readList :: ReadS [RegisterEventTopic]
$creadList :: ReadS [RegisterEventTopic]
readsPrec :: Int -> ReadS RegisterEventTopic
$creadsPrec :: Int -> ReadS RegisterEventTopic
Prelude.Read, Int -> RegisterEventTopic -> ShowS
[RegisterEventTopic] -> ShowS
RegisterEventTopic -> String
(Int -> RegisterEventTopic -> ShowS)
-> (RegisterEventTopic -> String)
-> ([RegisterEventTopic] -> ShowS)
-> Show RegisterEventTopic
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterEventTopic] -> ShowS
$cshowList :: [RegisterEventTopic] -> ShowS
show :: RegisterEventTopic -> String
$cshow :: RegisterEventTopic -> String
showsPrec :: Int -> RegisterEventTopic -> ShowS
$cshowsPrec :: Int -> RegisterEventTopic -> ShowS
Prelude.Show, (forall x. RegisterEventTopic -> Rep RegisterEventTopic x)
-> (forall x. Rep RegisterEventTopic x -> RegisterEventTopic)
-> Generic RegisterEventTopic
forall x. Rep RegisterEventTopic x -> RegisterEventTopic
forall x. RegisterEventTopic -> Rep RegisterEventTopic x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterEventTopic x -> RegisterEventTopic
$cfrom :: forall x. RegisterEventTopic -> Rep RegisterEventTopic x
Prelude.Generic)
newRegisterEventTopic ::
Prelude.Text ->
Prelude.Text ->
RegisterEventTopic
newRegisterEventTopic :: Text -> Text -> RegisterEventTopic
newRegisterEventTopic Text
pDirectoryId_ Text
pTopicName_ =
RegisterEventTopic' :: Text -> Text -> RegisterEventTopic
RegisterEventTopic'
{ $sel:directoryId:RegisterEventTopic' :: Text
directoryId = Text
pDirectoryId_,
$sel:topicName:RegisterEventTopic' :: Text
topicName = Text
pTopicName_
}
registerEventTopic_directoryId :: Lens.Lens' RegisterEventTopic Prelude.Text
registerEventTopic_directoryId :: (Text -> f Text) -> RegisterEventTopic -> f RegisterEventTopic
registerEventTopic_directoryId = (RegisterEventTopic -> Text)
-> (RegisterEventTopic -> Text -> RegisterEventTopic)
-> Lens RegisterEventTopic RegisterEventTopic Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEventTopic' {Text
directoryId :: Text
$sel:directoryId:RegisterEventTopic' :: RegisterEventTopic -> Text
directoryId} -> Text
directoryId) (\s :: RegisterEventTopic
s@RegisterEventTopic' {} Text
a -> RegisterEventTopic
s {$sel:directoryId:RegisterEventTopic' :: Text
directoryId = Text
a} :: RegisterEventTopic)
registerEventTopic_topicName :: Lens.Lens' RegisterEventTopic Prelude.Text
registerEventTopic_topicName :: (Text -> f Text) -> RegisterEventTopic -> f RegisterEventTopic
registerEventTopic_topicName = (RegisterEventTopic -> Text)
-> (RegisterEventTopic -> Text -> RegisterEventTopic)
-> Lens RegisterEventTopic RegisterEventTopic Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEventTopic' {Text
topicName :: Text
$sel:topicName:RegisterEventTopic' :: RegisterEventTopic -> Text
topicName} -> Text
topicName) (\s :: RegisterEventTopic
s@RegisterEventTopic' {} Text
a -> RegisterEventTopic
s {$sel:topicName:RegisterEventTopic' :: Text
topicName = Text
a} :: RegisterEventTopic)
instance Core.AWSRequest RegisterEventTopic where
type
AWSResponse RegisterEventTopic =
RegisterEventTopicResponse
request :: RegisterEventTopic -> Request RegisterEventTopic
request = Service -> RegisterEventTopic -> Request RegisterEventTopic
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterEventTopic
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterEventTopic)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RegisterEventTopic))
-> Logger
-> Service
-> Proxy RegisterEventTopic
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterEventTopic)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RegisterEventTopicResponse
RegisterEventTopicResponse'
(Int -> RegisterEventTopicResponse)
-> Either String Int -> Either String RegisterEventTopicResponse
forall (f :: * -> *) a b. Functor 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 RegisterEventTopic
instance Prelude.NFData RegisterEventTopic
instance Core.ToHeaders RegisterEventTopic where
toHeaders :: RegisterEventTopic -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterEventTopic -> 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.RegisterEventTopic" ::
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 RegisterEventTopic where
toJSON :: RegisterEventTopic -> Value
toJSON RegisterEventTopic' {Text
topicName :: Text
directoryId :: Text
$sel:topicName:RegisterEventTopic' :: RegisterEventTopic -> Text
$sel:directoryId:RegisterEventTopic' :: RegisterEventTopic -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TopicName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
topicName)
]
)
instance Core.ToPath RegisterEventTopic where
toPath :: RegisterEventTopic -> ByteString
toPath = ByteString -> RegisterEventTopic -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterEventTopic where
toQuery :: RegisterEventTopic -> QueryString
toQuery = QueryString -> RegisterEventTopic -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterEventTopicResponse = RegisterEventTopicResponse'
{
RegisterEventTopicResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterEventTopicResponse -> RegisterEventTopicResponse -> Bool
(RegisterEventTopicResponse -> RegisterEventTopicResponse -> Bool)
-> (RegisterEventTopicResponse
-> RegisterEventTopicResponse -> Bool)
-> Eq RegisterEventTopicResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterEventTopicResponse -> RegisterEventTopicResponse -> Bool
$c/= :: RegisterEventTopicResponse -> RegisterEventTopicResponse -> Bool
== :: RegisterEventTopicResponse -> RegisterEventTopicResponse -> Bool
$c== :: RegisterEventTopicResponse -> RegisterEventTopicResponse -> Bool
Prelude.Eq, ReadPrec [RegisterEventTopicResponse]
ReadPrec RegisterEventTopicResponse
Int -> ReadS RegisterEventTopicResponse
ReadS [RegisterEventTopicResponse]
(Int -> ReadS RegisterEventTopicResponse)
-> ReadS [RegisterEventTopicResponse]
-> ReadPrec RegisterEventTopicResponse
-> ReadPrec [RegisterEventTopicResponse]
-> Read RegisterEventTopicResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterEventTopicResponse]
$creadListPrec :: ReadPrec [RegisterEventTopicResponse]
readPrec :: ReadPrec RegisterEventTopicResponse
$creadPrec :: ReadPrec RegisterEventTopicResponse
readList :: ReadS [RegisterEventTopicResponse]
$creadList :: ReadS [RegisterEventTopicResponse]
readsPrec :: Int -> ReadS RegisterEventTopicResponse
$creadsPrec :: Int -> ReadS RegisterEventTopicResponse
Prelude.Read, Int -> RegisterEventTopicResponse -> ShowS
[RegisterEventTopicResponse] -> ShowS
RegisterEventTopicResponse -> String
(Int -> RegisterEventTopicResponse -> ShowS)
-> (RegisterEventTopicResponse -> String)
-> ([RegisterEventTopicResponse] -> ShowS)
-> Show RegisterEventTopicResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterEventTopicResponse] -> ShowS
$cshowList :: [RegisterEventTopicResponse] -> ShowS
show :: RegisterEventTopicResponse -> String
$cshow :: RegisterEventTopicResponse -> String
showsPrec :: Int -> RegisterEventTopicResponse -> ShowS
$cshowsPrec :: Int -> RegisterEventTopicResponse -> ShowS
Prelude.Show, (forall x.
RegisterEventTopicResponse -> Rep RegisterEventTopicResponse x)
-> (forall x.
Rep RegisterEventTopicResponse x -> RegisterEventTopicResponse)
-> Generic RegisterEventTopicResponse
forall x.
Rep RegisterEventTopicResponse x -> RegisterEventTopicResponse
forall x.
RegisterEventTopicResponse -> Rep RegisterEventTopicResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterEventTopicResponse x -> RegisterEventTopicResponse
$cfrom :: forall x.
RegisterEventTopicResponse -> Rep RegisterEventTopicResponse x
Prelude.Generic)
newRegisterEventTopicResponse ::
Prelude.Int ->
RegisterEventTopicResponse
newRegisterEventTopicResponse :: Int -> RegisterEventTopicResponse
newRegisterEventTopicResponse Int
pHttpStatus_ =
RegisterEventTopicResponse' :: Int -> RegisterEventTopicResponse
RegisterEventTopicResponse'
{ $sel:httpStatus:RegisterEventTopicResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
registerEventTopicResponse_httpStatus :: Lens.Lens' RegisterEventTopicResponse Prelude.Int
registerEventTopicResponse_httpStatus :: (Int -> f Int)
-> RegisterEventTopicResponse -> f RegisterEventTopicResponse
registerEventTopicResponse_httpStatus = (RegisterEventTopicResponse -> Int)
-> (RegisterEventTopicResponse
-> Int -> RegisterEventTopicResponse)
-> Lens
RegisterEventTopicResponse RegisterEventTopicResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEventTopicResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterEventTopicResponse' :: RegisterEventTopicResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterEventTopicResponse
s@RegisterEventTopicResponse' {} Int
a -> RegisterEventTopicResponse
s {$sel:httpStatus:RegisterEventTopicResponse' :: Int
httpStatus = Int
a} :: RegisterEventTopicResponse)
instance Prelude.NFData RegisterEventTopicResponse