module Network.AWS.Lambda.ListFunctions
(
listFunctions
, ListFunctions
, lfMarker
, lfMaxItems
, listFunctionsResponse
, ListFunctionsResponse
, lfrsNextMarker
, lfrsFunctions
, lfrsResponseStatus
) where
import Network.AWS.Lambda.Types
import Network.AWS.Lambda.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListFunctions = ListFunctions'
{ _lfMarker :: !(Maybe Text)
, _lfMaxItems :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listFunctions
:: ListFunctions
listFunctions =
ListFunctions'
{ _lfMarker = Nothing
, _lfMaxItems = Nothing
}
lfMarker :: Lens' ListFunctions (Maybe Text)
lfMarker = lens _lfMarker (\ s a -> s{_lfMarker = a});
lfMaxItems :: Lens' ListFunctions (Maybe Natural)
lfMaxItems = lens _lfMaxItems (\ s a -> s{_lfMaxItems = a}) . mapping _Nat;
instance AWSPager ListFunctions where
page rq rs
| stop (rs ^. lfrsNextMarker) = Nothing
| stop (rs ^. lfrsFunctions) = Nothing
| otherwise =
Just $ rq & lfMarker .~ rs ^. lfrsNextMarker
instance AWSRequest ListFunctions where
type Rs ListFunctions = ListFunctionsResponse
request = get lambda
response
= receiveJSON
(\ s h x ->
ListFunctionsResponse' <$>
(x .?> "NextMarker") <*>
(x .?> "Functions" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders ListFunctions where
toHeaders = const mempty
instance ToPath ListFunctions where
toPath = const "/2015-03-31/functions/"
instance ToQuery ListFunctions where
toQuery ListFunctions'{..}
= mconcat
["Marker" =: _lfMarker, "MaxItems" =: _lfMaxItems]
data ListFunctionsResponse = ListFunctionsResponse'
{ _lfrsNextMarker :: !(Maybe Text)
, _lfrsFunctions :: !(Maybe [FunctionConfiguration])
, _lfrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listFunctionsResponse
:: Int
-> ListFunctionsResponse
listFunctionsResponse pResponseStatus_ =
ListFunctionsResponse'
{ _lfrsNextMarker = Nothing
, _lfrsFunctions = Nothing
, _lfrsResponseStatus = pResponseStatus_
}
lfrsNextMarker :: Lens' ListFunctionsResponse (Maybe Text)
lfrsNextMarker = lens _lfrsNextMarker (\ s a -> s{_lfrsNextMarker = a});
lfrsFunctions :: Lens' ListFunctionsResponse [FunctionConfiguration]
lfrsFunctions = lens _lfrsFunctions (\ s a -> s{_lfrsFunctions = a}) . _Default . _Coerce;
lfrsResponseStatus :: Lens' ListFunctionsResponse Int
lfrsResponseStatus = lens _lfrsResponseStatus (\ s a -> s{_lfrsResponseStatus = a});