{-# 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.GetFunctionDefinition
(
getFunctionDefinition
, GetFunctionDefinition
, gfdFunctionDefinitionId
, getFunctionDefinitionResponse
, GetFunctionDefinitionResponse
, gfdrsLatestVersionARN
, gfdrsARN
, gfdrsName
, gfdrsCreationTimestamp
, gfdrsId
, gfdrsLatestVersion
, gfdrsLastUpdatedTimestamp
, gfdrsResponseStatus
) 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
newtype GetFunctionDefinition = GetFunctionDefinition'
{ _gfdFunctionDefinitionId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getFunctionDefinition
:: Text
-> GetFunctionDefinition
getFunctionDefinition pFunctionDefinitionId_ =
GetFunctionDefinition' {_gfdFunctionDefinitionId = pFunctionDefinitionId_}
gfdFunctionDefinitionId :: Lens' GetFunctionDefinition Text
gfdFunctionDefinitionId = lens _gfdFunctionDefinitionId (\ s a -> s{_gfdFunctionDefinitionId = a})
instance AWSRequest GetFunctionDefinition where
type Rs GetFunctionDefinition =
GetFunctionDefinitionResponse
request = get greengrass
response
= receiveJSON
(\ s h x ->
GetFunctionDefinitionResponse' <$>
(x .?> "LatestVersionArn") <*> (x .?> "Arn") <*>
(x .?> "Name")
<*> (x .?> "CreationTimestamp")
<*> (x .?> "Id")
<*> (x .?> "LatestVersion")
<*> (x .?> "LastUpdatedTimestamp")
<*> (pure (fromEnum s)))
instance Hashable GetFunctionDefinition where
instance NFData GetFunctionDefinition where
instance ToHeaders GetFunctionDefinition where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetFunctionDefinition where
toPath GetFunctionDefinition'{..}
= mconcat
["/greengrass/definition/functions/",
toBS _gfdFunctionDefinitionId]
instance ToQuery GetFunctionDefinition where
toQuery = const mempty
data GetFunctionDefinitionResponse = GetFunctionDefinitionResponse'
{ _gfdrsLatestVersionARN :: !(Maybe Text)
, _gfdrsARN :: !(Maybe Text)
, _gfdrsName :: !(Maybe Text)
, _gfdrsCreationTimestamp :: !(Maybe Text)
, _gfdrsId :: !(Maybe Text)
, _gfdrsLatestVersion :: !(Maybe Text)
, _gfdrsLastUpdatedTimestamp :: !(Maybe Text)
, _gfdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getFunctionDefinitionResponse
:: Int
-> GetFunctionDefinitionResponse
getFunctionDefinitionResponse pResponseStatus_ =
GetFunctionDefinitionResponse'
{ _gfdrsLatestVersionARN = Nothing
, _gfdrsARN = Nothing
, _gfdrsName = Nothing
, _gfdrsCreationTimestamp = Nothing
, _gfdrsId = Nothing
, _gfdrsLatestVersion = Nothing
, _gfdrsLastUpdatedTimestamp = Nothing
, _gfdrsResponseStatus = pResponseStatus_
}
gfdrsLatestVersionARN :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsLatestVersionARN = lens _gfdrsLatestVersionARN (\ s a -> s{_gfdrsLatestVersionARN = a})
gfdrsARN :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsARN = lens _gfdrsARN (\ s a -> s{_gfdrsARN = a})
gfdrsName :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsName = lens _gfdrsName (\ s a -> s{_gfdrsName = a})
gfdrsCreationTimestamp :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsCreationTimestamp = lens _gfdrsCreationTimestamp (\ s a -> s{_gfdrsCreationTimestamp = a})
gfdrsId :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsId = lens _gfdrsId (\ s a -> s{_gfdrsId = a})
gfdrsLatestVersion :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsLatestVersion = lens _gfdrsLatestVersion (\ s a -> s{_gfdrsLatestVersion = a})
gfdrsLastUpdatedTimestamp :: Lens' GetFunctionDefinitionResponse (Maybe Text)
gfdrsLastUpdatedTimestamp = lens _gfdrsLastUpdatedTimestamp (\ s a -> s{_gfdrsLastUpdatedTimestamp = a})
gfdrsResponseStatus :: Lens' GetFunctionDefinitionResponse Int
gfdrsResponseStatus = lens _gfdrsResponseStatus (\ s a -> s{_gfdrsResponseStatus = a})
instance NFData GetFunctionDefinitionResponse where