{-# 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.ListEndpointsByPlatformApplication
(
listEndpointsByPlatformApplication
, ListEndpointsByPlatformApplication
, lebpaNextToken
, lebpaPlatformApplicationARN
, listEndpointsByPlatformApplicationResponse
, ListEndpointsByPlatformApplicationResponse
, lebparsNextToken
, lebparsEndpoints
, lebparsResponseStatus
) where
import Network.AWS.Lens
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 Hashable ListEndpointsByPlatformApplication
where
instance NFData ListEndpointsByPlatformApplication
where
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])
, _lebparsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listEndpointsByPlatformApplicationResponse
:: Int
-> ListEndpointsByPlatformApplicationResponse
listEndpointsByPlatformApplicationResponse pResponseStatus_ =
ListEndpointsByPlatformApplicationResponse'
{ _lebparsNextToken = Nothing
, _lebparsEndpoints = Nothing
, _lebparsResponseStatus = pResponseStatus_
}
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
lebparsResponseStatus :: Lens' ListEndpointsByPlatformApplicationResponse Int
lebparsResponseStatus = lens _lebparsResponseStatus (\ s a -> s{_lebparsResponseStatus = a})
instance NFData
ListEndpointsByPlatformApplicationResponse
where