{-# 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.ListPlatformApplications
(
listPlatformApplications
, ListPlatformApplications
, lpaNextToken
, listPlatformApplicationsResponse
, ListPlatformApplicationsResponse
, lparsPlatformApplications
, lparsNextToken
, lparsResponseStatus
) 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
newtype ListPlatformApplications = ListPlatformApplications'
{ _lpaNextToken :: Maybe Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listPlatformApplications
:: ListPlatformApplications
listPlatformApplications = ListPlatformApplications' {_lpaNextToken = Nothing}
lpaNextToken :: Lens' ListPlatformApplications (Maybe Text)
lpaNextToken = lens _lpaNextToken (\ s a -> s{_lpaNextToken = a})
instance AWSPager ListPlatformApplications where
page rq rs
| stop (rs ^. lparsNextToken) = Nothing
| stop (rs ^. lparsPlatformApplications) = Nothing
| otherwise =
Just $ rq & lpaNextToken .~ rs ^. lparsNextToken
instance AWSRequest ListPlatformApplications where
type Rs ListPlatformApplications =
ListPlatformApplicationsResponse
request = postQuery sns
response
= receiveXMLWrapper "ListPlatformApplicationsResult"
(\ s h x ->
ListPlatformApplicationsResponse' <$>
(x .@? "PlatformApplications" .!@ mempty >>=
may (parseXMLList "member"))
<*> (x .@? "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListPlatformApplications where
instance NFData ListPlatformApplications where
instance ToHeaders ListPlatformApplications where
toHeaders = const mempty
instance ToPath ListPlatformApplications where
toPath = const "/"
instance ToQuery ListPlatformApplications where
toQuery ListPlatformApplications'{..}
= mconcat
["Action" =:
("ListPlatformApplications" :: ByteString),
"Version" =: ("2010-03-31" :: ByteString),
"NextToken" =: _lpaNextToken]
data ListPlatformApplicationsResponse = ListPlatformApplicationsResponse'
{ _lparsPlatformApplications :: !(Maybe [PlatformApplication])
, _lparsNextToken :: !(Maybe Text)
, _lparsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listPlatformApplicationsResponse
:: Int
-> ListPlatformApplicationsResponse
listPlatformApplicationsResponse pResponseStatus_ =
ListPlatformApplicationsResponse'
{ _lparsPlatformApplications = Nothing
, _lparsNextToken = Nothing
, _lparsResponseStatus = pResponseStatus_
}
lparsPlatformApplications :: Lens' ListPlatformApplicationsResponse [PlatformApplication]
lparsPlatformApplications = lens _lparsPlatformApplications (\ s a -> s{_lparsPlatformApplications = a}) . _Default . _Coerce
lparsNextToken :: Lens' ListPlatformApplicationsResponse (Maybe Text)
lparsNextToken = lens _lparsNextToken (\ s a -> s{_lparsNextToken = a})
lparsResponseStatus :: Lens' ListPlatformApplicationsResponse Int
lparsResponseStatus = lens _lparsResponseStatus (\ s a -> s{_lparsResponseStatus = a})
instance NFData ListPlatformApplicationsResponse
where