{-# 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.IoT.GetTopicRuleDestination
(
GetTopicRuleDestination (..),
newGetTopicRuleDestination,
getTopicRuleDestination_arn,
GetTopicRuleDestinationResponse (..),
newGetTopicRuleDestinationResponse,
getTopicRuleDestinationResponse_topicRuleDestination,
getTopicRuleDestinationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 GetTopicRuleDestination = GetTopicRuleDestination'
{
GetTopicRuleDestination -> Text
arn :: Prelude.Text
}
deriving (GetTopicRuleDestination -> GetTopicRuleDestination -> Bool
(GetTopicRuleDestination -> GetTopicRuleDestination -> Bool)
-> (GetTopicRuleDestination -> GetTopicRuleDestination -> Bool)
-> Eq GetTopicRuleDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTopicRuleDestination -> GetTopicRuleDestination -> Bool
$c/= :: GetTopicRuleDestination -> GetTopicRuleDestination -> Bool
== :: GetTopicRuleDestination -> GetTopicRuleDestination -> Bool
$c== :: GetTopicRuleDestination -> GetTopicRuleDestination -> Bool
Prelude.Eq, ReadPrec [GetTopicRuleDestination]
ReadPrec GetTopicRuleDestination
Int -> ReadS GetTopicRuleDestination
ReadS [GetTopicRuleDestination]
(Int -> ReadS GetTopicRuleDestination)
-> ReadS [GetTopicRuleDestination]
-> ReadPrec GetTopicRuleDestination
-> ReadPrec [GetTopicRuleDestination]
-> Read GetTopicRuleDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTopicRuleDestination]
$creadListPrec :: ReadPrec [GetTopicRuleDestination]
readPrec :: ReadPrec GetTopicRuleDestination
$creadPrec :: ReadPrec GetTopicRuleDestination
readList :: ReadS [GetTopicRuleDestination]
$creadList :: ReadS [GetTopicRuleDestination]
readsPrec :: Int -> ReadS GetTopicRuleDestination
$creadsPrec :: Int -> ReadS GetTopicRuleDestination
Prelude.Read, Int -> GetTopicRuleDestination -> ShowS
[GetTopicRuleDestination] -> ShowS
GetTopicRuleDestination -> String
(Int -> GetTopicRuleDestination -> ShowS)
-> (GetTopicRuleDestination -> String)
-> ([GetTopicRuleDestination] -> ShowS)
-> Show GetTopicRuleDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTopicRuleDestination] -> ShowS
$cshowList :: [GetTopicRuleDestination] -> ShowS
show :: GetTopicRuleDestination -> String
$cshow :: GetTopicRuleDestination -> String
showsPrec :: Int -> GetTopicRuleDestination -> ShowS
$cshowsPrec :: Int -> GetTopicRuleDestination -> ShowS
Prelude.Show, (forall x.
GetTopicRuleDestination -> Rep GetTopicRuleDestination x)
-> (forall x.
Rep GetTopicRuleDestination x -> GetTopicRuleDestination)
-> Generic GetTopicRuleDestination
forall x. Rep GetTopicRuleDestination x -> GetTopicRuleDestination
forall x. GetTopicRuleDestination -> Rep GetTopicRuleDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTopicRuleDestination x -> GetTopicRuleDestination
$cfrom :: forall x. GetTopicRuleDestination -> Rep GetTopicRuleDestination x
Prelude.Generic)
newGetTopicRuleDestination ::
Prelude.Text ->
GetTopicRuleDestination
newGetTopicRuleDestination :: Text -> GetTopicRuleDestination
newGetTopicRuleDestination Text
pArn_ =
GetTopicRuleDestination' :: Text -> GetTopicRuleDestination
GetTopicRuleDestination' {$sel:arn:GetTopicRuleDestination' :: Text
arn = Text
pArn_}
getTopicRuleDestination_arn :: Lens.Lens' GetTopicRuleDestination Prelude.Text
getTopicRuleDestination_arn :: (Text -> f Text)
-> GetTopicRuleDestination -> f GetTopicRuleDestination
getTopicRuleDestination_arn = (GetTopicRuleDestination -> Text)
-> (GetTopicRuleDestination -> Text -> GetTopicRuleDestination)
-> Lens GetTopicRuleDestination GetTopicRuleDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTopicRuleDestination' {Text
arn :: Text
$sel:arn:GetTopicRuleDestination' :: GetTopicRuleDestination -> Text
arn} -> Text
arn) (\s :: GetTopicRuleDestination
s@GetTopicRuleDestination' {} Text
a -> GetTopicRuleDestination
s {$sel:arn:GetTopicRuleDestination' :: Text
arn = Text
a} :: GetTopicRuleDestination)
instance Core.AWSRequest GetTopicRuleDestination where
type
AWSResponse GetTopicRuleDestination =
GetTopicRuleDestinationResponse
request :: GetTopicRuleDestination -> Request GetTopicRuleDestination
request = Service
-> GetTopicRuleDestination -> Request GetTopicRuleDestination
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetTopicRuleDestination)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetTopicRuleDestination))
-> Logger
-> Service
-> Proxy GetTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetTopicRuleDestination)))
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 TopicRuleDestination
-> Int -> GetTopicRuleDestinationResponse
GetTopicRuleDestinationResponse'
(Maybe TopicRuleDestination
-> Int -> GetTopicRuleDestinationResponse)
-> Either String (Maybe TopicRuleDestination)
-> Either String (Int -> GetTopicRuleDestinationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TopicRuleDestination)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"topicRuleDestination")
Either String (Int -> GetTopicRuleDestinationResponse)
-> Either String Int
-> Either String GetTopicRuleDestinationResponse
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 GetTopicRuleDestination
instance Prelude.NFData GetTopicRuleDestination
instance Core.ToHeaders GetTopicRuleDestination where
toHeaders :: GetTopicRuleDestination -> ResponseHeaders
toHeaders = ResponseHeaders -> GetTopicRuleDestination -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetTopicRuleDestination where
toPath :: GetTopicRuleDestination -> ByteString
toPath GetTopicRuleDestination' {Text
arn :: Text
$sel:arn:GetTopicRuleDestination' :: GetTopicRuleDestination -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/destinations/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
arn]
instance Core.ToQuery GetTopicRuleDestination where
toQuery :: GetTopicRuleDestination -> QueryString
toQuery = QueryString -> GetTopicRuleDestination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetTopicRuleDestinationResponse = GetTopicRuleDestinationResponse'
{
GetTopicRuleDestinationResponse -> Maybe TopicRuleDestination
topicRuleDestination :: Prelude.Maybe TopicRuleDestination,
GetTopicRuleDestinationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool
(GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool)
-> (GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool)
-> Eq GetTopicRuleDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool
$c/= :: GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool
== :: GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool
$c== :: GetTopicRuleDestinationResponse
-> GetTopicRuleDestinationResponse -> Bool
Prelude.Eq, ReadPrec [GetTopicRuleDestinationResponse]
ReadPrec GetTopicRuleDestinationResponse
Int -> ReadS GetTopicRuleDestinationResponse
ReadS [GetTopicRuleDestinationResponse]
(Int -> ReadS GetTopicRuleDestinationResponse)
-> ReadS [GetTopicRuleDestinationResponse]
-> ReadPrec GetTopicRuleDestinationResponse
-> ReadPrec [GetTopicRuleDestinationResponse]
-> Read GetTopicRuleDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTopicRuleDestinationResponse]
$creadListPrec :: ReadPrec [GetTopicRuleDestinationResponse]
readPrec :: ReadPrec GetTopicRuleDestinationResponse
$creadPrec :: ReadPrec GetTopicRuleDestinationResponse
readList :: ReadS [GetTopicRuleDestinationResponse]
$creadList :: ReadS [GetTopicRuleDestinationResponse]
readsPrec :: Int -> ReadS GetTopicRuleDestinationResponse
$creadsPrec :: Int -> ReadS GetTopicRuleDestinationResponse
Prelude.Read, Int -> GetTopicRuleDestinationResponse -> ShowS
[GetTopicRuleDestinationResponse] -> ShowS
GetTopicRuleDestinationResponse -> String
(Int -> GetTopicRuleDestinationResponse -> ShowS)
-> (GetTopicRuleDestinationResponse -> String)
-> ([GetTopicRuleDestinationResponse] -> ShowS)
-> Show GetTopicRuleDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTopicRuleDestinationResponse] -> ShowS
$cshowList :: [GetTopicRuleDestinationResponse] -> ShowS
show :: GetTopicRuleDestinationResponse -> String
$cshow :: GetTopicRuleDestinationResponse -> String
showsPrec :: Int -> GetTopicRuleDestinationResponse -> ShowS
$cshowsPrec :: Int -> GetTopicRuleDestinationResponse -> ShowS
Prelude.Show, (forall x.
GetTopicRuleDestinationResponse
-> Rep GetTopicRuleDestinationResponse x)
-> (forall x.
Rep GetTopicRuleDestinationResponse x
-> GetTopicRuleDestinationResponse)
-> Generic GetTopicRuleDestinationResponse
forall x.
Rep GetTopicRuleDestinationResponse x
-> GetTopicRuleDestinationResponse
forall x.
GetTopicRuleDestinationResponse
-> Rep GetTopicRuleDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTopicRuleDestinationResponse x
-> GetTopicRuleDestinationResponse
$cfrom :: forall x.
GetTopicRuleDestinationResponse
-> Rep GetTopicRuleDestinationResponse x
Prelude.Generic)
newGetTopicRuleDestinationResponse ::
Prelude.Int ->
GetTopicRuleDestinationResponse
newGetTopicRuleDestinationResponse :: Int -> GetTopicRuleDestinationResponse
newGetTopicRuleDestinationResponse Int
pHttpStatus_ =
GetTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
-> Int -> GetTopicRuleDestinationResponse
GetTopicRuleDestinationResponse'
{ $sel:topicRuleDestination:GetTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
topicRuleDestination =
Maybe TopicRuleDestination
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTopicRuleDestinationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTopicRuleDestinationResponse_topicRuleDestination :: Lens.Lens' GetTopicRuleDestinationResponse (Prelude.Maybe TopicRuleDestination)
getTopicRuleDestinationResponse_topicRuleDestination :: (Maybe TopicRuleDestination -> f (Maybe TopicRuleDestination))
-> GetTopicRuleDestinationResponse
-> f GetTopicRuleDestinationResponse
getTopicRuleDestinationResponse_topicRuleDestination = (GetTopicRuleDestinationResponse -> Maybe TopicRuleDestination)
-> (GetTopicRuleDestinationResponse
-> Maybe TopicRuleDestination -> GetTopicRuleDestinationResponse)
-> Lens
GetTopicRuleDestinationResponse
GetTopicRuleDestinationResponse
(Maybe TopicRuleDestination)
(Maybe TopicRuleDestination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTopicRuleDestinationResponse' {Maybe TopicRuleDestination
topicRuleDestination :: Maybe TopicRuleDestination
$sel:topicRuleDestination:GetTopicRuleDestinationResponse' :: GetTopicRuleDestinationResponse -> Maybe TopicRuleDestination
topicRuleDestination} -> Maybe TopicRuleDestination
topicRuleDestination) (\s :: GetTopicRuleDestinationResponse
s@GetTopicRuleDestinationResponse' {} Maybe TopicRuleDestination
a -> GetTopicRuleDestinationResponse
s {$sel:topicRuleDestination:GetTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
topicRuleDestination = Maybe TopicRuleDestination
a} :: GetTopicRuleDestinationResponse)
getTopicRuleDestinationResponse_httpStatus :: Lens.Lens' GetTopicRuleDestinationResponse Prelude.Int
getTopicRuleDestinationResponse_httpStatus :: (Int -> f Int)
-> GetTopicRuleDestinationResponse
-> f GetTopicRuleDestinationResponse
getTopicRuleDestinationResponse_httpStatus = (GetTopicRuleDestinationResponse -> Int)
-> (GetTopicRuleDestinationResponse
-> Int -> GetTopicRuleDestinationResponse)
-> Lens
GetTopicRuleDestinationResponse
GetTopicRuleDestinationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTopicRuleDestinationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTopicRuleDestinationResponse' :: GetTopicRuleDestinationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTopicRuleDestinationResponse
s@GetTopicRuleDestinationResponse' {} Int
a -> GetTopicRuleDestinationResponse
s {$sel:httpStatus:GetTopicRuleDestinationResponse' :: Int
httpStatus = Int
a} :: GetTopicRuleDestinationResponse)
instance
Prelude.NFData
GetTopicRuleDestinationResponse