{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.IoT.CreateTopicRule
(
createTopicRule
, CreateTopicRule
, ctrRuleName
, ctrTopicRulePayload
, createTopicRuleResponse
, CreateTopicRuleResponse
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateTopicRule = CreateTopicRule'
{ _ctrRuleName :: !Text
, _ctrTopicRulePayload :: !TopicRulePayload
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createTopicRule
:: Text
-> TopicRulePayload
-> CreateTopicRule
createTopicRule pRuleName_ pTopicRulePayload_ =
CreateTopicRule'
{_ctrRuleName = pRuleName_, _ctrTopicRulePayload = pTopicRulePayload_}
ctrRuleName :: Lens' CreateTopicRule Text
ctrRuleName = lens _ctrRuleName (\ s a -> s{_ctrRuleName = a})
ctrTopicRulePayload :: Lens' CreateTopicRule TopicRulePayload
ctrTopicRulePayload = lens _ctrTopicRulePayload (\ s a -> s{_ctrTopicRulePayload = a})
instance AWSRequest CreateTopicRule where
type Rs CreateTopicRule = CreateTopicRuleResponse
request = postJSON ioT
response = receiveNull CreateTopicRuleResponse'
instance Hashable CreateTopicRule where
instance NFData CreateTopicRule where
instance ToHeaders CreateTopicRule where
toHeaders = const mempty
instance ToJSON CreateTopicRule where
toJSON CreateTopicRule'{..}
= object
(catMaybes
[Just ("topicRulePayload" .= _ctrTopicRulePayload)])
instance ToPath CreateTopicRule where
toPath CreateTopicRule'{..}
= mconcat ["/rules/", toBS _ctrRuleName]
instance ToQuery CreateTopicRule where
toQuery = const mempty
data CreateTopicRuleResponse =
CreateTopicRuleResponse'
deriving (Eq, Read, Show, Data, Typeable, Generic)
createTopicRuleResponse
:: CreateTopicRuleResponse
createTopicRuleResponse = CreateTopicRuleResponse'
instance NFData CreateTopicRuleResponse where