{-# 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.GetTopicRule
(
getTopicRule
, GetTopicRule
, gtrRuleName
, getTopicRuleResponse
, GetTopicRuleResponse
, gtrrsRule
, gtrrsRuleARN
, gtrrsResponseStatus
) 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
newtype GetTopicRule = GetTopicRule'
{ _gtrRuleName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTopicRule
:: Text
-> GetTopicRule
getTopicRule pRuleName_ = GetTopicRule' {_gtrRuleName = pRuleName_}
gtrRuleName :: Lens' GetTopicRule Text
gtrRuleName = lens _gtrRuleName (\ s a -> s{_gtrRuleName = a})
instance AWSRequest GetTopicRule where
type Rs GetTopicRule = GetTopicRuleResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
GetTopicRuleResponse' <$>
(x .?> "rule") <*> (x .?> "ruleArn") <*>
(pure (fromEnum s)))
instance Hashable GetTopicRule where
instance NFData GetTopicRule where
instance ToHeaders GetTopicRule where
toHeaders = const mempty
instance ToPath GetTopicRule where
toPath GetTopicRule'{..}
= mconcat ["/rules/", toBS _gtrRuleName]
instance ToQuery GetTopicRule where
toQuery = const mempty
data GetTopicRuleResponse = GetTopicRuleResponse'
{ _gtrrsRule :: !(Maybe TopicRule)
, _gtrrsRuleARN :: !(Maybe Text)
, _gtrrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTopicRuleResponse
:: Int
-> GetTopicRuleResponse
getTopicRuleResponse pResponseStatus_ =
GetTopicRuleResponse'
{ _gtrrsRule = Nothing
, _gtrrsRuleARN = Nothing
, _gtrrsResponseStatus = pResponseStatus_
}
gtrrsRule :: Lens' GetTopicRuleResponse (Maybe TopicRule)
gtrrsRule = lens _gtrrsRule (\ s a -> s{_gtrrsRule = a})
gtrrsRuleARN :: Lens' GetTopicRuleResponse (Maybe Text)
gtrrsRuleARN = lens _gtrrsRuleARN (\ s a -> s{_gtrrsRuleARN = a})
gtrrsResponseStatus :: Lens' GetTopicRuleResponse Int
gtrrsResponseStatus = lens _gtrrsResponseStatus (\ s a -> s{_gtrrsResponseStatus = a})
instance NFData GetTopicRuleResponse where