module Network.AWS.Greengrass.CreateFunctionDefinition
(
createFunctionDefinition
, CreateFunctionDefinition
, cfdAmznClientToken
, cfdInitialVersion
, cfdName
, createFunctionDefinitionResponse
, CreateFunctionDefinitionResponse
, cfdrsLatestVersionARN
, cfdrsARN
, cfdrsName
, cfdrsCreationTimestamp
, cfdrsId
, cfdrsLatestVersion
, cfdrsLastUpdatedTimestamp
, cfdrsResponseStatus
) 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 CreateFunctionDefinition = CreateFunctionDefinition'
{ _cfdAmznClientToken :: !(Maybe Text)
, _cfdInitialVersion :: !(Maybe FunctionDefinitionVersion)
, _cfdName :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createFunctionDefinition
:: CreateFunctionDefinition
createFunctionDefinition =
CreateFunctionDefinition'
{ _cfdAmznClientToken = Nothing
, _cfdInitialVersion = Nothing
, _cfdName = Nothing
}
cfdAmznClientToken :: Lens' CreateFunctionDefinition (Maybe Text)
cfdAmznClientToken = lens _cfdAmznClientToken (\ s a -> s{_cfdAmznClientToken = a});
cfdInitialVersion :: Lens' CreateFunctionDefinition (Maybe FunctionDefinitionVersion)
cfdInitialVersion = lens _cfdInitialVersion (\ s a -> s{_cfdInitialVersion = a});
cfdName :: Lens' CreateFunctionDefinition (Maybe Text)
cfdName = lens _cfdName (\ s a -> s{_cfdName = a});
instance AWSRequest CreateFunctionDefinition where
type Rs CreateFunctionDefinition =
CreateFunctionDefinitionResponse
request = postJSON greengrass
response
= receiveJSON
(\ s h x ->
CreateFunctionDefinitionResponse' <$>
(x .?> "LatestVersionArn") <*> (x .?> "Arn") <*>
(x .?> "Name")
<*> (x .?> "CreationTimestamp")
<*> (x .?> "Id")
<*> (x .?> "LatestVersion")
<*> (x .?> "LastUpdatedTimestamp")
<*> (pure (fromEnum s)))
instance Hashable CreateFunctionDefinition where
instance NFData CreateFunctionDefinition where
instance ToHeaders CreateFunctionDefinition where
toHeaders CreateFunctionDefinition'{..}
= mconcat
["X-Amzn-Client-Token" =# _cfdAmznClientToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON CreateFunctionDefinition where
toJSON CreateFunctionDefinition'{..}
= object
(catMaybes
[("InitialVersion" .=) <$> _cfdInitialVersion,
("Name" .=) <$> _cfdName])
instance ToPath CreateFunctionDefinition where
toPath = const "/greengrass/definition/functions"
instance ToQuery CreateFunctionDefinition where
toQuery = const mempty
data CreateFunctionDefinitionResponse = CreateFunctionDefinitionResponse'
{ _cfdrsLatestVersionARN :: !(Maybe Text)
, _cfdrsARN :: !(Maybe Text)
, _cfdrsName :: !(Maybe Text)
, _cfdrsCreationTimestamp :: !(Maybe Text)
, _cfdrsId :: !(Maybe Text)
, _cfdrsLatestVersion :: !(Maybe Text)
, _cfdrsLastUpdatedTimestamp :: !(Maybe Text)
, _cfdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createFunctionDefinitionResponse
:: Int
-> CreateFunctionDefinitionResponse
createFunctionDefinitionResponse pResponseStatus_ =
CreateFunctionDefinitionResponse'
{ _cfdrsLatestVersionARN = Nothing
, _cfdrsARN = Nothing
, _cfdrsName = Nothing
, _cfdrsCreationTimestamp = Nothing
, _cfdrsId = Nothing
, _cfdrsLatestVersion = Nothing
, _cfdrsLastUpdatedTimestamp = Nothing
, _cfdrsResponseStatus = pResponseStatus_
}
cfdrsLatestVersionARN :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsLatestVersionARN = lens _cfdrsLatestVersionARN (\ s a -> s{_cfdrsLatestVersionARN = a});
cfdrsARN :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsARN = lens _cfdrsARN (\ s a -> s{_cfdrsARN = a});
cfdrsName :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsName = lens _cfdrsName (\ s a -> s{_cfdrsName = a});
cfdrsCreationTimestamp :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsCreationTimestamp = lens _cfdrsCreationTimestamp (\ s a -> s{_cfdrsCreationTimestamp = a});
cfdrsId :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsId = lens _cfdrsId (\ s a -> s{_cfdrsId = a});
cfdrsLatestVersion :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsLatestVersion = lens _cfdrsLatestVersion (\ s a -> s{_cfdrsLatestVersion = a});
cfdrsLastUpdatedTimestamp :: Lens' CreateFunctionDefinitionResponse (Maybe Text)
cfdrsLastUpdatedTimestamp = lens _cfdrsLastUpdatedTimestamp (\ s a -> s{_cfdrsLastUpdatedTimestamp = a});
cfdrsResponseStatus :: Lens' CreateFunctionDefinitionResponse Int
cfdrsResponseStatus = lens _cfdrsResponseStatus (\ s a -> s{_cfdrsResponseStatus = a});
instance NFData CreateFunctionDefinitionResponse
where