module Network.AWS.SNS.ListEndpointsByPlatformApplication
(
listEndpointsByPlatformApplication
, ListEndpointsByPlatformApplication
, lebpaNextToken
, lebpaPlatformApplicationARN
, listEndpointsByPlatformApplicationResponse
, ListEndpointsByPlatformApplicationResponse
, lebparsNextToken
, lebparsEndpoints
, lebparsStatus
) where
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SNS.Types
import Network.AWS.SNS.Types.Product
data ListEndpointsByPlatformApplication = ListEndpointsByPlatformApplication'
{ _lebpaNextToken :: !(Maybe Text)
, _lebpaPlatformApplicationARN :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listEndpointsByPlatformApplication
:: Text
-> ListEndpointsByPlatformApplication
listEndpointsByPlatformApplication pPlatformApplicationARN_ =
ListEndpointsByPlatformApplication'
{ _lebpaNextToken = Nothing
, _lebpaPlatformApplicationARN = pPlatformApplicationARN_
}
lebpaNextToken :: Lens' ListEndpointsByPlatformApplication (Maybe Text)
lebpaNextToken = lens _lebpaNextToken (\ s a -> s{_lebpaNextToken = a});
lebpaPlatformApplicationARN :: Lens' ListEndpointsByPlatformApplication Text
lebpaPlatformApplicationARN = lens _lebpaPlatformApplicationARN (\ s a -> s{_lebpaPlatformApplicationARN = a});
instance AWSPager ListEndpointsByPlatformApplication
where
page rq rs
| stop (rs ^. lebparsNextToken) = Nothing
| stop (rs ^. lebparsEndpoints) = Nothing
| otherwise =
Just $ rq & lebpaNextToken .~ rs ^. lebparsNextToken
instance AWSRequest
ListEndpointsByPlatformApplication where
type Rs ListEndpointsByPlatformApplication =
ListEndpointsByPlatformApplicationResponse
request = postQuery sNS
response
= receiveXMLWrapper
"ListEndpointsByPlatformApplicationResult"
(\ s h x ->
ListEndpointsByPlatformApplicationResponse' <$>
(x .@? "NextToken") <*>
(x .@? "Endpoints" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance ToHeaders ListEndpointsByPlatformApplication
where
toHeaders = const mempty
instance ToPath ListEndpointsByPlatformApplication
where
toPath = const "/"
instance ToQuery ListEndpointsByPlatformApplication
where
toQuery ListEndpointsByPlatformApplication'{..}
= mconcat
["Action" =:
("ListEndpointsByPlatformApplication" :: ByteString),
"Version" =: ("2010-03-31" :: ByteString),
"NextToken" =: _lebpaNextToken,
"PlatformApplicationArn" =:
_lebpaPlatformApplicationARN]
data ListEndpointsByPlatformApplicationResponse = ListEndpointsByPlatformApplicationResponse'
{ _lebparsNextToken :: !(Maybe Text)
, _lebparsEndpoints :: !(Maybe [Endpoint])
, _lebparsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listEndpointsByPlatformApplicationResponse
:: Int
-> ListEndpointsByPlatformApplicationResponse
listEndpointsByPlatformApplicationResponse pStatus_ =
ListEndpointsByPlatformApplicationResponse'
{ _lebparsNextToken = Nothing
, _lebparsEndpoints = Nothing
, _lebparsStatus = pStatus_
}
lebparsNextToken :: Lens' ListEndpointsByPlatformApplicationResponse (Maybe Text)
lebparsNextToken = lens _lebparsNextToken (\ s a -> s{_lebparsNextToken = a});
lebparsEndpoints :: Lens' ListEndpointsByPlatformApplicationResponse [Endpoint]
lebparsEndpoints = lens _lebparsEndpoints (\ s a -> s{_lebparsEndpoints = a}) . _Default . _Coerce;
lebparsStatus :: Lens' ListEndpointsByPlatformApplicationResponse Int
lebparsStatus = lens _lebparsStatus (\ s a -> s{_lebparsStatus = a});