{-# 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.CreateTopicRuleDestination
(
CreateTopicRuleDestination (..),
newCreateTopicRuleDestination,
createTopicRuleDestination_destinationConfiguration,
CreateTopicRuleDestinationResponse (..),
newCreateTopicRuleDestinationResponse,
createTopicRuleDestinationResponse_topicRuleDestination,
createTopicRuleDestinationResponse_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 CreateTopicRuleDestination = CreateTopicRuleDestination'
{
CreateTopicRuleDestination -> TopicRuleDestinationConfiguration
destinationConfiguration :: TopicRuleDestinationConfiguration
}
deriving (CreateTopicRuleDestination -> CreateTopicRuleDestination -> Bool
(CreateTopicRuleDestination -> CreateTopicRuleDestination -> Bool)
-> (CreateTopicRuleDestination
-> CreateTopicRuleDestination -> Bool)
-> Eq CreateTopicRuleDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTopicRuleDestination -> CreateTopicRuleDestination -> Bool
$c/= :: CreateTopicRuleDestination -> CreateTopicRuleDestination -> Bool
== :: CreateTopicRuleDestination -> CreateTopicRuleDestination -> Bool
$c== :: CreateTopicRuleDestination -> CreateTopicRuleDestination -> Bool
Prelude.Eq, ReadPrec [CreateTopicRuleDestination]
ReadPrec CreateTopicRuleDestination
Int -> ReadS CreateTopicRuleDestination
ReadS [CreateTopicRuleDestination]
(Int -> ReadS CreateTopicRuleDestination)
-> ReadS [CreateTopicRuleDestination]
-> ReadPrec CreateTopicRuleDestination
-> ReadPrec [CreateTopicRuleDestination]
-> Read CreateTopicRuleDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTopicRuleDestination]
$creadListPrec :: ReadPrec [CreateTopicRuleDestination]
readPrec :: ReadPrec CreateTopicRuleDestination
$creadPrec :: ReadPrec CreateTopicRuleDestination
readList :: ReadS [CreateTopicRuleDestination]
$creadList :: ReadS [CreateTopicRuleDestination]
readsPrec :: Int -> ReadS CreateTopicRuleDestination
$creadsPrec :: Int -> ReadS CreateTopicRuleDestination
Prelude.Read, Int -> CreateTopicRuleDestination -> ShowS
[CreateTopicRuleDestination] -> ShowS
CreateTopicRuleDestination -> String
(Int -> CreateTopicRuleDestination -> ShowS)
-> (CreateTopicRuleDestination -> String)
-> ([CreateTopicRuleDestination] -> ShowS)
-> Show CreateTopicRuleDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTopicRuleDestination] -> ShowS
$cshowList :: [CreateTopicRuleDestination] -> ShowS
show :: CreateTopicRuleDestination -> String
$cshow :: CreateTopicRuleDestination -> String
showsPrec :: Int -> CreateTopicRuleDestination -> ShowS
$cshowsPrec :: Int -> CreateTopicRuleDestination -> ShowS
Prelude.Show, (forall x.
CreateTopicRuleDestination -> Rep CreateTopicRuleDestination x)
-> (forall x.
Rep CreateTopicRuleDestination x -> CreateTopicRuleDestination)
-> Generic CreateTopicRuleDestination
forall x.
Rep CreateTopicRuleDestination x -> CreateTopicRuleDestination
forall x.
CreateTopicRuleDestination -> Rep CreateTopicRuleDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTopicRuleDestination x -> CreateTopicRuleDestination
$cfrom :: forall x.
CreateTopicRuleDestination -> Rep CreateTopicRuleDestination x
Prelude.Generic)
newCreateTopicRuleDestination ::
TopicRuleDestinationConfiguration ->
CreateTopicRuleDestination
newCreateTopicRuleDestination :: TopicRuleDestinationConfiguration -> CreateTopicRuleDestination
newCreateTopicRuleDestination
TopicRuleDestinationConfiguration
pDestinationConfiguration_ =
CreateTopicRuleDestination' :: TopicRuleDestinationConfiguration -> CreateTopicRuleDestination
CreateTopicRuleDestination'
{ $sel:destinationConfiguration:CreateTopicRuleDestination' :: TopicRuleDestinationConfiguration
destinationConfiguration =
TopicRuleDestinationConfiguration
pDestinationConfiguration_
}
createTopicRuleDestination_destinationConfiguration :: Lens.Lens' CreateTopicRuleDestination TopicRuleDestinationConfiguration
createTopicRuleDestination_destinationConfiguration :: (TopicRuleDestinationConfiguration
-> f TopicRuleDestinationConfiguration)
-> CreateTopicRuleDestination -> f CreateTopicRuleDestination
createTopicRuleDestination_destinationConfiguration = (CreateTopicRuleDestination -> TopicRuleDestinationConfiguration)
-> (CreateTopicRuleDestination
-> TopicRuleDestinationConfiguration -> CreateTopicRuleDestination)
-> Lens
CreateTopicRuleDestination
CreateTopicRuleDestination
TopicRuleDestinationConfiguration
TopicRuleDestinationConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTopicRuleDestination' {TopicRuleDestinationConfiguration
destinationConfiguration :: TopicRuleDestinationConfiguration
$sel:destinationConfiguration:CreateTopicRuleDestination' :: CreateTopicRuleDestination -> TopicRuleDestinationConfiguration
destinationConfiguration} -> TopicRuleDestinationConfiguration
destinationConfiguration) (\s :: CreateTopicRuleDestination
s@CreateTopicRuleDestination' {} TopicRuleDestinationConfiguration
a -> CreateTopicRuleDestination
s {$sel:destinationConfiguration:CreateTopicRuleDestination' :: TopicRuleDestinationConfiguration
destinationConfiguration = TopicRuleDestinationConfiguration
a} :: CreateTopicRuleDestination)
instance Core.AWSRequest CreateTopicRuleDestination where
type
AWSResponse CreateTopicRuleDestination =
CreateTopicRuleDestinationResponse
request :: CreateTopicRuleDestination -> Request CreateTopicRuleDestination
request = Service
-> CreateTopicRuleDestination -> Request CreateTopicRuleDestination
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTopicRuleDestination)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateTopicRuleDestination))
-> Logger
-> Service
-> Proxy CreateTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTopicRuleDestination)))
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 -> CreateTopicRuleDestinationResponse
CreateTopicRuleDestinationResponse'
(Maybe TopicRuleDestination
-> Int -> CreateTopicRuleDestinationResponse)
-> Either String (Maybe TopicRuleDestination)
-> Either String (Int -> CreateTopicRuleDestinationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe TopicRuleDestination)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"topicRuleDestination")
Either String (Int -> CreateTopicRuleDestinationResponse)
-> Either String Int
-> Either String CreateTopicRuleDestinationResponse
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 CreateTopicRuleDestination
instance Prelude.NFData CreateTopicRuleDestination
instance Core.ToHeaders CreateTopicRuleDestination where
toHeaders :: CreateTopicRuleDestination -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateTopicRuleDestination -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateTopicRuleDestination where
toJSON :: CreateTopicRuleDestination -> Value
toJSON CreateTopicRuleDestination' {TopicRuleDestinationConfiguration
destinationConfiguration :: TopicRuleDestinationConfiguration
$sel:destinationConfiguration:CreateTopicRuleDestination' :: CreateTopicRuleDestination -> TopicRuleDestinationConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Key
"destinationConfiguration"
Key -> TopicRuleDestinationConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= TopicRuleDestinationConfiguration
destinationConfiguration
)
]
)
instance Core.ToPath CreateTopicRuleDestination where
toPath :: CreateTopicRuleDestination -> ByteString
toPath = ByteString -> CreateTopicRuleDestination -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/destinations"
instance Core.ToQuery CreateTopicRuleDestination where
toQuery :: CreateTopicRuleDestination -> QueryString
toQuery = QueryString -> CreateTopicRuleDestination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateTopicRuleDestinationResponse = CreateTopicRuleDestinationResponse'
{
CreateTopicRuleDestinationResponse -> Maybe TopicRuleDestination
topicRuleDestination :: Prelude.Maybe TopicRuleDestination,
CreateTopicRuleDestinationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool
(CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool)
-> (CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool)
-> Eq CreateTopicRuleDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool
$c/= :: CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool
== :: CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool
$c== :: CreateTopicRuleDestinationResponse
-> CreateTopicRuleDestinationResponse -> Bool
Prelude.Eq, ReadPrec [CreateTopicRuleDestinationResponse]
ReadPrec CreateTopicRuleDestinationResponse
Int -> ReadS CreateTopicRuleDestinationResponse
ReadS [CreateTopicRuleDestinationResponse]
(Int -> ReadS CreateTopicRuleDestinationResponse)
-> ReadS [CreateTopicRuleDestinationResponse]
-> ReadPrec CreateTopicRuleDestinationResponse
-> ReadPrec [CreateTopicRuleDestinationResponse]
-> Read CreateTopicRuleDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTopicRuleDestinationResponse]
$creadListPrec :: ReadPrec [CreateTopicRuleDestinationResponse]
readPrec :: ReadPrec CreateTopicRuleDestinationResponse
$creadPrec :: ReadPrec CreateTopicRuleDestinationResponse
readList :: ReadS [CreateTopicRuleDestinationResponse]
$creadList :: ReadS [CreateTopicRuleDestinationResponse]
readsPrec :: Int -> ReadS CreateTopicRuleDestinationResponse
$creadsPrec :: Int -> ReadS CreateTopicRuleDestinationResponse
Prelude.Read, Int -> CreateTopicRuleDestinationResponse -> ShowS
[CreateTopicRuleDestinationResponse] -> ShowS
CreateTopicRuleDestinationResponse -> String
(Int -> CreateTopicRuleDestinationResponse -> ShowS)
-> (CreateTopicRuleDestinationResponse -> String)
-> ([CreateTopicRuleDestinationResponse] -> ShowS)
-> Show CreateTopicRuleDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTopicRuleDestinationResponse] -> ShowS
$cshowList :: [CreateTopicRuleDestinationResponse] -> ShowS
show :: CreateTopicRuleDestinationResponse -> String
$cshow :: CreateTopicRuleDestinationResponse -> String
showsPrec :: Int -> CreateTopicRuleDestinationResponse -> ShowS
$cshowsPrec :: Int -> CreateTopicRuleDestinationResponse -> ShowS
Prelude.Show, (forall x.
CreateTopicRuleDestinationResponse
-> Rep CreateTopicRuleDestinationResponse x)
-> (forall x.
Rep CreateTopicRuleDestinationResponse x
-> CreateTopicRuleDestinationResponse)
-> Generic CreateTopicRuleDestinationResponse
forall x.
Rep CreateTopicRuleDestinationResponse x
-> CreateTopicRuleDestinationResponse
forall x.
CreateTopicRuleDestinationResponse
-> Rep CreateTopicRuleDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTopicRuleDestinationResponse x
-> CreateTopicRuleDestinationResponse
$cfrom :: forall x.
CreateTopicRuleDestinationResponse
-> Rep CreateTopicRuleDestinationResponse x
Prelude.Generic)
newCreateTopicRuleDestinationResponse ::
Prelude.Int ->
CreateTopicRuleDestinationResponse
newCreateTopicRuleDestinationResponse :: Int -> CreateTopicRuleDestinationResponse
newCreateTopicRuleDestinationResponse Int
pHttpStatus_ =
CreateTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
-> Int -> CreateTopicRuleDestinationResponse
CreateTopicRuleDestinationResponse'
{ $sel:topicRuleDestination:CreateTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
topicRuleDestination =
Maybe TopicRuleDestination
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTopicRuleDestinationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTopicRuleDestinationResponse_topicRuleDestination :: Lens.Lens' CreateTopicRuleDestinationResponse (Prelude.Maybe TopicRuleDestination)
createTopicRuleDestinationResponse_topicRuleDestination :: (Maybe TopicRuleDestination -> f (Maybe TopicRuleDestination))
-> CreateTopicRuleDestinationResponse
-> f CreateTopicRuleDestinationResponse
createTopicRuleDestinationResponse_topicRuleDestination = (CreateTopicRuleDestinationResponse -> Maybe TopicRuleDestination)
-> (CreateTopicRuleDestinationResponse
-> Maybe TopicRuleDestination
-> CreateTopicRuleDestinationResponse)
-> Lens
CreateTopicRuleDestinationResponse
CreateTopicRuleDestinationResponse
(Maybe TopicRuleDestination)
(Maybe TopicRuleDestination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTopicRuleDestinationResponse' {Maybe TopicRuleDestination
topicRuleDestination :: Maybe TopicRuleDestination
$sel:topicRuleDestination:CreateTopicRuleDestinationResponse' :: CreateTopicRuleDestinationResponse -> Maybe TopicRuleDestination
topicRuleDestination} -> Maybe TopicRuleDestination
topicRuleDestination) (\s :: CreateTopicRuleDestinationResponse
s@CreateTopicRuleDestinationResponse' {} Maybe TopicRuleDestination
a -> CreateTopicRuleDestinationResponse
s {$sel:topicRuleDestination:CreateTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
topicRuleDestination = Maybe TopicRuleDestination
a} :: CreateTopicRuleDestinationResponse)
createTopicRuleDestinationResponse_httpStatus :: Lens.Lens' CreateTopicRuleDestinationResponse Prelude.Int
createTopicRuleDestinationResponse_httpStatus :: (Int -> f Int)
-> CreateTopicRuleDestinationResponse
-> f CreateTopicRuleDestinationResponse
createTopicRuleDestinationResponse_httpStatus = (CreateTopicRuleDestinationResponse -> Int)
-> (CreateTopicRuleDestinationResponse
-> Int -> CreateTopicRuleDestinationResponse)
-> Lens
CreateTopicRuleDestinationResponse
CreateTopicRuleDestinationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTopicRuleDestinationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTopicRuleDestinationResponse' :: CreateTopicRuleDestinationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTopicRuleDestinationResponse
s@CreateTopicRuleDestinationResponse' {} Int
a -> CreateTopicRuleDestinationResponse
s {$sel:httpStatus:CreateTopicRuleDestinationResponse' :: Int
httpStatus = Int
a} :: CreateTopicRuleDestinationResponse)
instance
Prelude.NFData
CreateTopicRuleDestinationResponse