{-# 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.ConfirmSubscription
(
confirmSubscription
, ConfirmSubscription
, csAuthenticateOnUnsubscribe
, csTopicARN
, csToken
, confirmSubscriptionResponse
, ConfirmSubscriptionResponse
, csrsSubscriptionARN
, csrsResponseStatus
) 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
data ConfirmSubscription = ConfirmSubscription'
{ _csAuthenticateOnUnsubscribe :: !(Maybe Text)
, _csTopicARN :: !Text
, _csToken :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
confirmSubscription
:: Text
-> Text
-> ConfirmSubscription
confirmSubscription pTopicARN_ pToken_ =
ConfirmSubscription'
{ _csAuthenticateOnUnsubscribe = Nothing
, _csTopicARN = pTopicARN_
, _csToken = pToken_
}
csAuthenticateOnUnsubscribe :: Lens' ConfirmSubscription (Maybe Text)
csAuthenticateOnUnsubscribe = lens _csAuthenticateOnUnsubscribe (\ s a -> s{_csAuthenticateOnUnsubscribe = a})
csTopicARN :: Lens' ConfirmSubscription Text
csTopicARN = lens _csTopicARN (\ s a -> s{_csTopicARN = a})
csToken :: Lens' ConfirmSubscription Text
csToken = lens _csToken (\ s a -> s{_csToken = a})
instance AWSRequest ConfirmSubscription where
type Rs ConfirmSubscription =
ConfirmSubscriptionResponse
request = postQuery sns
response
= receiveXMLWrapper "ConfirmSubscriptionResult"
(\ s h x ->
ConfirmSubscriptionResponse' <$>
(x .@? "SubscriptionArn") <*> (pure (fromEnum s)))
instance Hashable ConfirmSubscription where
instance NFData ConfirmSubscription where
instance ToHeaders ConfirmSubscription where
toHeaders = const mempty
instance ToPath ConfirmSubscription where
toPath = const "/"
instance ToQuery ConfirmSubscription where
toQuery ConfirmSubscription'{..}
= mconcat
["Action" =: ("ConfirmSubscription" :: ByteString),
"Version" =: ("2010-03-31" :: ByteString),
"AuthenticateOnUnsubscribe" =:
_csAuthenticateOnUnsubscribe,
"TopicArn" =: _csTopicARN, "Token" =: _csToken]
data ConfirmSubscriptionResponse = ConfirmSubscriptionResponse'
{ _csrsSubscriptionARN :: !(Maybe Text)
, _csrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
confirmSubscriptionResponse
:: Int
-> ConfirmSubscriptionResponse
confirmSubscriptionResponse pResponseStatus_ =
ConfirmSubscriptionResponse'
{_csrsSubscriptionARN = Nothing, _csrsResponseStatus = pResponseStatus_}
csrsSubscriptionARN :: Lens' ConfirmSubscriptionResponse (Maybe Text)
csrsSubscriptionARN = lens _csrsSubscriptionARN (\ s a -> s{_csrsSubscriptionARN = a})
csrsResponseStatus :: Lens' ConfirmSubscriptionResponse Int
csrsResponseStatus = lens _csrsResponseStatus (\ s a -> s{_csrsResponseStatus = a})
instance NFData ConfirmSubscriptionResponse where