{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
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
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]
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
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.
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'
{ $sel:destinationConfiguration:CreateTopicRuleDestination' :: TopicRuleDestinationConfiguration
destinationConfiguration =
TopicRuleDestinationConfiguration
pDestinationConfiguration_
}
createTopicRuleDestination_destinationConfiguration :: Lens.Lens' CreateTopicRuleDestination TopicRuleDestinationConfiguration
createTopicRuleDestination_destinationConfiguration :: Lens' CreateTopicRuleDestination TopicRuleDestinationConfiguration
createTopicRuleDestination_destinationConfiguration = 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 :: (Service -> Service)
-> CreateTopicRuleDestination -> Request CreateTopicRuleDestination
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTopicRuleDestination)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe TopicRuleDestination
-> Int -> CreateTopicRuleDestinationResponse
CreateTopicRuleDestinationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"topicRuleDestination")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateTopicRuleDestination where
hashWithSalt :: Int -> CreateTopicRuleDestination -> Int
hashWithSalt Int
_salt CreateTopicRuleDestination' {TopicRuleDestinationConfiguration
destinationConfiguration :: TopicRuleDestinationConfiguration
$sel:destinationConfiguration:CreateTopicRuleDestination' :: CreateTopicRuleDestination -> TopicRuleDestinationConfiguration
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TopicRuleDestinationConfiguration
destinationConfiguration
instance Prelude.NFData CreateTopicRuleDestination where
rnf :: CreateTopicRuleDestination -> ()
rnf CreateTopicRuleDestination' {TopicRuleDestinationConfiguration
destinationConfiguration :: TopicRuleDestinationConfiguration
$sel:destinationConfiguration:CreateTopicRuleDestination' :: CreateTopicRuleDestination -> TopicRuleDestinationConfiguration
..} =
forall a. NFData a => a -> ()
Prelude.rnf TopicRuleDestinationConfiguration
destinationConfiguration
instance Data.ToHeaders CreateTopicRuleDestination where
toHeaders :: CreateTopicRuleDestination -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON CreateTopicRuleDestination where
toJSON :: CreateTopicRuleDestination -> Value
toJSON CreateTopicRuleDestination' {TopicRuleDestinationConfiguration
destinationConfiguration :: TopicRuleDestinationConfiguration
$sel:destinationConfiguration:CreateTopicRuleDestination' :: CreateTopicRuleDestination -> TopicRuleDestinationConfiguration
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"destinationConfiguration"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TopicRuleDestinationConfiguration
destinationConfiguration
)
]
)
instance Data.ToPath CreateTopicRuleDestination where
toPath :: CreateTopicRuleDestination -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/destinations"
instance Data.ToQuery CreateTopicRuleDestination where
toQuery :: CreateTopicRuleDestination -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:topicRuleDestination:CreateTopicRuleDestinationResponse' :: Maybe TopicRuleDestination
topicRuleDestination =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTopicRuleDestinationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTopicRuleDestinationResponse_topicRuleDestination :: Lens.Lens' CreateTopicRuleDestinationResponse (Prelude.Maybe TopicRuleDestination)
createTopicRuleDestinationResponse_topicRuleDestination :: Lens'
CreateTopicRuleDestinationResponse (Maybe TopicRuleDestination)
createTopicRuleDestinationResponse_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 :: Lens' CreateTopicRuleDestinationResponse Int
createTopicRuleDestinationResponse_httpStatus = 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
where
rnf :: CreateTopicRuleDestinationResponse -> ()
rnf CreateTopicRuleDestinationResponse' {Int
Maybe TopicRuleDestination
httpStatus :: Int
topicRuleDestination :: Maybe TopicRuleDestination
$sel:httpStatus:CreateTopicRuleDestinationResponse' :: CreateTopicRuleDestinationResponse -> Int
$sel:topicRuleDestination:CreateTopicRuleDestinationResponse' :: CreateTopicRuleDestinationResponse -> Maybe TopicRuleDestination
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TopicRuleDestination
topicRuleDestination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus