{-# 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.CreatePlatformEndpoint
(
createPlatformEndpoint
, CreatePlatformEndpoint
, cpeCustomUserData
, cpeAttributes
, cpePlatformApplicationARN
, cpeToken
, createPlatformEndpointResponse
, CreatePlatformEndpointResponse
, cpersEndpointARN
, cpersResponseStatus
) 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 CreatePlatformEndpoint = CreatePlatformEndpoint'
{ _cpeCustomUserData :: !(Maybe Text)
, _cpeAttributes :: !(Maybe (Map Text Text))
, _cpePlatformApplicationARN :: !Text
, _cpeToken :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createPlatformEndpoint
:: Text
-> Text
-> CreatePlatformEndpoint
createPlatformEndpoint pPlatformApplicationARN_ pToken_ =
CreatePlatformEndpoint'
{ _cpeCustomUserData = Nothing
, _cpeAttributes = Nothing
, _cpePlatformApplicationARN = pPlatformApplicationARN_
, _cpeToken = pToken_
}
cpeCustomUserData :: Lens' CreatePlatformEndpoint (Maybe Text)
cpeCustomUserData = lens _cpeCustomUserData (\ s a -> s{_cpeCustomUserData = a});
cpeAttributes :: Lens' CreatePlatformEndpoint (HashMap Text Text)
cpeAttributes = lens _cpeAttributes (\ s a -> s{_cpeAttributes = a}) . _Default . _Map;
cpePlatformApplicationARN :: Lens' CreatePlatformEndpoint Text
cpePlatformApplicationARN = lens _cpePlatformApplicationARN (\ s a -> s{_cpePlatformApplicationARN = a});
cpeToken :: Lens' CreatePlatformEndpoint Text
cpeToken = lens _cpeToken (\ s a -> s{_cpeToken = a});
instance AWSRequest CreatePlatformEndpoint where
type Rs CreatePlatformEndpoint =
CreatePlatformEndpointResponse
request = postQuery sns
response
= receiveXMLWrapper "CreatePlatformEndpointResult"
(\ s h x ->
CreatePlatformEndpointResponse' <$>
(x .@? "EndpointArn") <*> (pure (fromEnum s)))
instance Hashable CreatePlatformEndpoint
instance NFData CreatePlatformEndpoint
instance ToHeaders CreatePlatformEndpoint where
toHeaders = const mempty
instance ToPath CreatePlatformEndpoint where
toPath = const "/"
instance ToQuery CreatePlatformEndpoint where
toQuery CreatePlatformEndpoint'{..}
= mconcat
["Action" =:
("CreatePlatformEndpoint" :: ByteString),
"Version" =: ("2010-03-31" :: ByteString),
"CustomUserData" =: _cpeCustomUserData,
"Attributes" =:
toQuery
(toQueryMap "entry" "key" "value" <$>
_cpeAttributes),
"PlatformApplicationArn" =:
_cpePlatformApplicationARN,
"Token" =: _cpeToken]
data CreatePlatformEndpointResponse = CreatePlatformEndpointResponse'
{ _cpersEndpointARN :: !(Maybe Text)
, _cpersResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createPlatformEndpointResponse
:: Int
-> CreatePlatformEndpointResponse
createPlatformEndpointResponse pResponseStatus_ =
CreatePlatformEndpointResponse'
{ _cpersEndpointARN = Nothing
, _cpersResponseStatus = pResponseStatus_
}
cpersEndpointARN :: Lens' CreatePlatformEndpointResponse (Maybe Text)
cpersEndpointARN = lens _cpersEndpointARN (\ s a -> s{_cpersEndpointARN = a});
cpersResponseStatus :: Lens' CreatePlatformEndpointResponse Int
cpersResponseStatus = lens _cpersResponseStatus (\ s a -> s{_cpersResponseStatus = a});
instance NFData CreatePlatformEndpointResponse