{-# 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.SNS.GetTopicAttributes
(
getTopicAttributes
, GetTopicAttributes
, gtaTopicARN
, getTopicAttributesResponse
, GetTopicAttributesResponse
, gtarsAttributes
, gtarsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SNS.Types
import Network.AWS.SNS.Types.Product
newtype GetTopicAttributes = GetTopicAttributes'
{ _gtaTopicARN :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getTopicAttributes
:: Text
-> GetTopicAttributes
getTopicAttributes pTopicARN_ =
GetTopicAttributes'
{ _gtaTopicARN = pTopicARN_
}
gtaTopicARN :: Lens' GetTopicAttributes Text
gtaTopicARN = lens _gtaTopicARN (\ s a -> s{_gtaTopicARN = a});
instance AWSRequest GetTopicAttributes where
type Rs GetTopicAttributes =
GetTopicAttributesResponse
request = postQuery sns
response
= receiveXMLWrapper "GetTopicAttributesResult"
(\ s h x ->
GetTopicAttributesResponse' <$>
(x .@? "Attributes" .!@ mempty >>=
may (parseXMLMap "entry" "key" "value"))
<*> (pure (fromEnum s)))
instance Hashable GetTopicAttributes
instance NFData GetTopicAttributes
instance ToHeaders GetTopicAttributes where
toHeaders = const mempty
instance ToPath GetTopicAttributes where
toPath = const "/"
instance ToQuery GetTopicAttributes where
toQuery GetTopicAttributes'{..}
= mconcat
["Action" =: ("GetTopicAttributes" :: ByteString),
"Version" =: ("2010-03-31" :: ByteString),
"TopicArn" =: _gtaTopicARN]
data GetTopicAttributesResponse = GetTopicAttributesResponse'
{ _gtarsAttributes :: !(Maybe (Map Text Text))
, _gtarsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getTopicAttributesResponse
:: Int
-> GetTopicAttributesResponse
getTopicAttributesResponse pResponseStatus_ =
GetTopicAttributesResponse'
{ _gtarsAttributes = Nothing
, _gtarsResponseStatus = pResponseStatus_
}
gtarsAttributes :: Lens' GetTopicAttributesResponse (HashMap Text Text)
gtarsAttributes = lens _gtarsAttributes (\ s a -> s{_gtarsAttributes = a}) . _Default . _Map;
gtarsResponseStatus :: Lens' GetTopicAttributesResponse Int
gtarsResponseStatus = lens _gtarsResponseStatus (\ s a -> s{_gtarsResponseStatus = a});
instance NFData GetTopicAttributesResponse