module Network.AWS.APIGateway.GetRestAPIs
(
getRestAPIs
, GetRestAPIs
, graLimit
, graPosition
, getRestAPIsResponse
, GetRestAPIsResponse
, grarsItems
, grarsPosition
, grarsResponseStatus
) 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 GetRestAPIs = GetRestAPIs'
{ _graLimit :: !(Maybe Int)
, _graPosition :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRestAPIs
:: GetRestAPIs
getRestAPIs = GetRestAPIs' {_graLimit = Nothing, _graPosition = Nothing}
graLimit :: Lens' GetRestAPIs (Maybe Int)
graLimit = lens _graLimit (\ s a -> s{_graLimit = a});
graPosition :: Lens' GetRestAPIs (Maybe Text)
graPosition = lens _graPosition (\ s a -> s{_graPosition = a});
instance AWSPager GetRestAPIs where
page rq rs
| stop (rs ^. grarsPosition) = Nothing
| stop (rs ^. grarsItems) = Nothing
| otherwise =
Just $ rq & graPosition .~ rs ^. grarsPosition
instance AWSRequest GetRestAPIs where
type Rs GetRestAPIs = GetRestAPIsResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetRestAPIsResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance Hashable GetRestAPIs where
instance NFData GetRestAPIs where
instance ToHeaders GetRestAPIs where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetRestAPIs where
toPath = const "/restapis"
instance ToQuery GetRestAPIs where
toQuery GetRestAPIs'{..}
= mconcat
["limit" =: _graLimit, "position" =: _graPosition]
data GetRestAPIsResponse = GetRestAPIsResponse'
{ _grarsItems :: !(Maybe [RestAPI])
, _grarsPosition :: !(Maybe Text)
, _grarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRestAPIsResponse
:: Int
-> GetRestAPIsResponse
getRestAPIsResponse pResponseStatus_ =
GetRestAPIsResponse'
{ _grarsItems = Nothing
, _grarsPosition = Nothing
, _grarsResponseStatus = pResponseStatus_
}
grarsItems :: Lens' GetRestAPIsResponse [RestAPI]
grarsItems = lens _grarsItems (\ s a -> s{_grarsItems = a}) . _Default . _Coerce;
grarsPosition :: Lens' GetRestAPIsResponse (Maybe Text)
grarsPosition = lens _grarsPosition (\ s a -> s{_grarsPosition = a});
grarsResponseStatus :: Lens' GetRestAPIsResponse Int
grarsResponseStatus = lens _grarsResponseStatus (\ s a -> s{_grarsResponseStatus = a});
instance NFData GetRestAPIsResponse where