{-# 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.Lambda.ListVersionsByFunction
(
listVersionsByFunction
, ListVersionsByFunction
, lvbfMarker
, lvbfMaxItems
, lvbfFunctionName
, listVersionsByFunctionResponse
, ListVersionsByFunctionResponse
, lvbfrsVersions
, lvbfrsNextMarker
, lvbfrsResponseStatus
) where
import Network.AWS.Lambda.Types
import Network.AWS.Lambda.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListVersionsByFunction = ListVersionsByFunction'
{ _lvbfMarker :: !(Maybe Text)
, _lvbfMaxItems :: !(Maybe Nat)
, _lvbfFunctionName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listVersionsByFunction
:: Text
-> ListVersionsByFunction
listVersionsByFunction pFunctionName_ =
ListVersionsByFunction'
{ _lvbfMarker = Nothing
, _lvbfMaxItems = Nothing
, _lvbfFunctionName = pFunctionName_
}
lvbfMarker :: Lens' ListVersionsByFunction (Maybe Text)
lvbfMarker = lens _lvbfMarker (\ s a -> s{_lvbfMarker = a})
lvbfMaxItems :: Lens' ListVersionsByFunction (Maybe Natural)
lvbfMaxItems = lens _lvbfMaxItems (\ s a -> s{_lvbfMaxItems = a}) . mapping _Nat
lvbfFunctionName :: Lens' ListVersionsByFunction Text
lvbfFunctionName = lens _lvbfFunctionName (\ s a -> s{_lvbfFunctionName = a})
instance AWSRequest ListVersionsByFunction where
type Rs ListVersionsByFunction =
ListVersionsByFunctionResponse
request = get lambda
response
= receiveJSON
(\ s h x ->
ListVersionsByFunctionResponse' <$>
(x .?> "Versions" .!@ mempty) <*>
(x .?> "NextMarker")
<*> (pure (fromEnum s)))
instance Hashable ListVersionsByFunction where
instance NFData ListVersionsByFunction where
instance ToHeaders ListVersionsByFunction where
toHeaders = const mempty
instance ToPath ListVersionsByFunction where
toPath ListVersionsByFunction'{..}
= mconcat
["/2015-03-31/functions/", toBS _lvbfFunctionName,
"/versions"]
instance ToQuery ListVersionsByFunction where
toQuery ListVersionsByFunction'{..}
= mconcat
["Marker" =: _lvbfMarker,
"MaxItems" =: _lvbfMaxItems]
data ListVersionsByFunctionResponse = ListVersionsByFunctionResponse'
{ _lvbfrsVersions :: !(Maybe [FunctionConfiguration])
, _lvbfrsNextMarker :: !(Maybe Text)
, _lvbfrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
listVersionsByFunctionResponse
:: Int
-> ListVersionsByFunctionResponse
listVersionsByFunctionResponse pResponseStatus_ =
ListVersionsByFunctionResponse'
{ _lvbfrsVersions = Nothing
, _lvbfrsNextMarker = Nothing
, _lvbfrsResponseStatus = pResponseStatus_
}
lvbfrsVersions :: Lens' ListVersionsByFunctionResponse [FunctionConfiguration]
lvbfrsVersions = lens _lvbfrsVersions (\ s a -> s{_lvbfrsVersions = a}) . _Default . _Coerce
lvbfrsNextMarker :: Lens' ListVersionsByFunctionResponse (Maybe Text)
lvbfrsNextMarker = lens _lvbfrsNextMarker (\ s a -> s{_lvbfrsNextMarker = a})
lvbfrsResponseStatus :: Lens' ListVersionsByFunctionResponse Int
lvbfrsResponseStatus = lens _lvbfrsResponseStatus (\ s a -> s{_lvbfrsResponseStatus = a})
instance NFData ListVersionsByFunctionResponse where