{-# 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.Greengrass.ListFunctionDefinitionVersions
(
listFunctionDefinitionVersions
, ListFunctionDefinitionVersions
, lfdvNextToken
, lfdvMaxResults
, lfdvFunctionDefinitionId
, listFunctionDefinitionVersionsResponse
, ListFunctionDefinitionVersionsResponse
, lfdvrsVersions
, lfdvrsNextToken
, lfdvrsResponseStatus
) where
import Network.AWS.Greengrass.Types
import Network.AWS.Greengrass.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListFunctionDefinitionVersions = ListFunctionDefinitionVersions'
{ _lfdvNextToken :: !(Maybe Text)
, _lfdvMaxResults :: !(Maybe Text)
, _lfdvFunctionDefinitionId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listFunctionDefinitionVersions
:: Text
-> ListFunctionDefinitionVersions
listFunctionDefinitionVersions pFunctionDefinitionId_ =
ListFunctionDefinitionVersions'
{ _lfdvNextToken = Nothing
, _lfdvMaxResults = Nothing
, _lfdvFunctionDefinitionId = pFunctionDefinitionId_
}
lfdvNextToken :: Lens' ListFunctionDefinitionVersions (Maybe Text)
lfdvNextToken = lens _lfdvNextToken (\ s a -> s{_lfdvNextToken = a})
lfdvMaxResults :: Lens' ListFunctionDefinitionVersions (Maybe Text)
lfdvMaxResults = lens _lfdvMaxResults (\ s a -> s{_lfdvMaxResults = a})
lfdvFunctionDefinitionId :: Lens' ListFunctionDefinitionVersions Text
lfdvFunctionDefinitionId = lens _lfdvFunctionDefinitionId (\ s a -> s{_lfdvFunctionDefinitionId = a})
instance AWSRequest ListFunctionDefinitionVersions
where
type Rs ListFunctionDefinitionVersions =
ListFunctionDefinitionVersionsResponse
request = get greengrass
response
= receiveJSON
(\ s h x ->
ListFunctionDefinitionVersionsResponse' <$>
(x .?> "Versions" .!@ mempty) <*> (x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListFunctionDefinitionVersions
where
instance NFData ListFunctionDefinitionVersions where
instance ToHeaders ListFunctionDefinitionVersions
where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath ListFunctionDefinitionVersions where
toPath ListFunctionDefinitionVersions'{..}
= mconcat
["/greengrass/definition/functions/",
toBS _lfdvFunctionDefinitionId, "/versions"]
instance ToQuery ListFunctionDefinitionVersions where
toQuery ListFunctionDefinitionVersions'{..}
= mconcat
["NextToken" =: _lfdvNextToken,
"MaxResults" =: _lfdvMaxResults]
data ListFunctionDefinitionVersionsResponse = ListFunctionDefinitionVersionsResponse'
{ _lfdvrsVersions :: !(Maybe [VersionInformation])
, _lfdvrsNextToken :: !(Maybe Text)
, _lfdvrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listFunctionDefinitionVersionsResponse
:: Int
-> ListFunctionDefinitionVersionsResponse
listFunctionDefinitionVersionsResponse pResponseStatus_ =
ListFunctionDefinitionVersionsResponse'
{ _lfdvrsVersions = Nothing
, _lfdvrsNextToken = Nothing
, _lfdvrsResponseStatus = pResponseStatus_
}
lfdvrsVersions :: Lens' ListFunctionDefinitionVersionsResponse [VersionInformation]
lfdvrsVersions = lens _lfdvrsVersions (\ s a -> s{_lfdvrsVersions = a}) . _Default . _Coerce
lfdvrsNextToken :: Lens' ListFunctionDefinitionVersionsResponse (Maybe Text)
lfdvrsNextToken = lens _lfdvrsNextToken (\ s a -> s{_lfdvrsNextToken = a})
lfdvrsResponseStatus :: Lens' ListFunctionDefinitionVersionsResponse Int
lfdvrsResponseStatus = lens _lfdvrsResponseStatus (\ s a -> s{_lfdvrsResponseStatus = a})
instance NFData
ListFunctionDefinitionVersionsResponse
where