module Network.AWS.APIGateway.GetAPIKeys
(
getAPIKeys
, GetAPIKeys
, gakLimit
, gakPosition
, getAPIKeysResponse
, GetAPIKeysResponse
, gakrsItems
, gakrsPosition
, gakrsResponseStatus
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetAPIKeys = GetAPIKeys'
{ _gakLimit :: !(Maybe Int)
, _gakPosition :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getAPIKeys
:: GetAPIKeys
getAPIKeys =
GetAPIKeys'
{ _gakLimit = Nothing
, _gakPosition = Nothing
}
gakLimit :: Lens' GetAPIKeys (Maybe Int)
gakLimit = lens _gakLimit (\ s a -> s{_gakLimit = a});
gakPosition :: Lens' GetAPIKeys (Maybe Text)
gakPosition = lens _gakPosition (\ s a -> s{_gakPosition = a});
instance AWSPager GetAPIKeys where
page rq rs
| stop (rs ^. gakrsPosition) = Nothing
| stop (rs ^. gakrsItems) = Nothing
| otherwise =
Just $ rq & gakPosition .~ rs ^. gakrsPosition
instance AWSRequest GetAPIKeys where
type Rs GetAPIKeys = GetAPIKeysResponse
request = get aPIGateway
response
= receiveJSON
(\ s h x ->
GetAPIKeysResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance ToHeaders GetAPIKeys where
toHeaders = const mempty
instance ToPath GetAPIKeys where
toPath = const "/apikeys"
instance ToQuery GetAPIKeys where
toQuery GetAPIKeys'{..}
= mconcat
["limit" =: _gakLimit, "position" =: _gakPosition]
data GetAPIKeysResponse = GetAPIKeysResponse'
{ _gakrsItems :: !(Maybe [APIKey])
, _gakrsPosition :: !(Maybe Text)
, _gakrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getAPIKeysResponse
:: Int
-> GetAPIKeysResponse
getAPIKeysResponse pResponseStatus_ =
GetAPIKeysResponse'
{ _gakrsItems = Nothing
, _gakrsPosition = Nothing
, _gakrsResponseStatus = pResponseStatus_
}
gakrsItems :: Lens' GetAPIKeysResponse [APIKey]
gakrsItems = lens _gakrsItems (\ s a -> s{_gakrsItems = a}) . _Default . _Coerce;
gakrsPosition :: Lens' GetAPIKeysResponse (Maybe Text)
gakrsPosition = lens _gakrsPosition (\ s a -> s{_gakrsPosition = a});
gakrsResponseStatus :: Lens' GetAPIKeysResponse Int
gakrsResponseStatus = lens _gakrsResponseStatus (\ s a -> s{_gakrsResponseStatus = a});