module Network.AWS.Greengrass.CreateDeviceDefinitionVersion
(
createDeviceDefinitionVersion
, CreateDeviceDefinitionVersion
, cddvAmznClientToken
, cddvDevices
, cddvDeviceDefinitionId
, createDeviceDefinitionVersionResponse
, CreateDeviceDefinitionVersionResponse
, cddvrsARN
, cddvrsCreationTimestamp
, cddvrsVersion
, cddvrsId
, cddvrsResponseStatus
) 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 CreateDeviceDefinitionVersion = CreateDeviceDefinitionVersion'
{ _cddvAmznClientToken :: !(Maybe Text)
, _cddvDevices :: !(Maybe [Device])
, _cddvDeviceDefinitionId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDeviceDefinitionVersion
:: Text
-> CreateDeviceDefinitionVersion
createDeviceDefinitionVersion pDeviceDefinitionId_ =
CreateDeviceDefinitionVersion'
{ _cddvAmznClientToken = Nothing
, _cddvDevices = Nothing
, _cddvDeviceDefinitionId = pDeviceDefinitionId_
}
cddvAmznClientToken :: Lens' CreateDeviceDefinitionVersion (Maybe Text)
cddvAmznClientToken = lens _cddvAmznClientToken (\ s a -> s{_cddvAmznClientToken = a});
cddvDevices :: Lens' CreateDeviceDefinitionVersion [Device]
cddvDevices = lens _cddvDevices (\ s a -> s{_cddvDevices = a}) . _Default . _Coerce;
cddvDeviceDefinitionId :: Lens' CreateDeviceDefinitionVersion Text
cddvDeviceDefinitionId = lens _cddvDeviceDefinitionId (\ s a -> s{_cddvDeviceDefinitionId = a});
instance AWSRequest CreateDeviceDefinitionVersion
where
type Rs CreateDeviceDefinitionVersion =
CreateDeviceDefinitionVersionResponse
request = postJSON greengrass
response
= receiveJSON
(\ s h x ->
CreateDeviceDefinitionVersionResponse' <$>
(x .?> "Arn") <*> (x .?> "CreationTimestamp") <*>
(x .?> "Version")
<*> (x .?> "Id")
<*> (pure (fromEnum s)))
instance Hashable CreateDeviceDefinitionVersion where
instance NFData CreateDeviceDefinitionVersion where
instance ToHeaders CreateDeviceDefinitionVersion
where
toHeaders CreateDeviceDefinitionVersion'{..}
= mconcat
["X-Amzn-Client-Token" =# _cddvAmznClientToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON CreateDeviceDefinitionVersion where
toJSON CreateDeviceDefinitionVersion'{..}
= object
(catMaybes [("Devices" .=) <$> _cddvDevices])
instance ToPath CreateDeviceDefinitionVersion where
toPath CreateDeviceDefinitionVersion'{..}
= mconcat
["/greengrass/definition/devices/",
toBS _cddvDeviceDefinitionId, "/versions"]
instance ToQuery CreateDeviceDefinitionVersion where
toQuery = const mempty
data CreateDeviceDefinitionVersionResponse = CreateDeviceDefinitionVersionResponse'
{ _cddvrsARN :: !(Maybe Text)
, _cddvrsCreationTimestamp :: !(Maybe Text)
, _cddvrsVersion :: !(Maybe Text)
, _cddvrsId :: !(Maybe Text)
, _cddvrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDeviceDefinitionVersionResponse
:: Int
-> CreateDeviceDefinitionVersionResponse
createDeviceDefinitionVersionResponse pResponseStatus_ =
CreateDeviceDefinitionVersionResponse'
{ _cddvrsARN = Nothing
, _cddvrsCreationTimestamp = Nothing
, _cddvrsVersion = Nothing
, _cddvrsId = Nothing
, _cddvrsResponseStatus = pResponseStatus_
}
cddvrsARN :: Lens' CreateDeviceDefinitionVersionResponse (Maybe Text)
cddvrsARN = lens _cddvrsARN (\ s a -> s{_cddvrsARN = a});
cddvrsCreationTimestamp :: Lens' CreateDeviceDefinitionVersionResponse (Maybe Text)
cddvrsCreationTimestamp = lens _cddvrsCreationTimestamp (\ s a -> s{_cddvrsCreationTimestamp = a});
cddvrsVersion :: Lens' CreateDeviceDefinitionVersionResponse (Maybe Text)
cddvrsVersion = lens _cddvrsVersion (\ s a -> s{_cddvrsVersion = a});
cddvrsId :: Lens' CreateDeviceDefinitionVersionResponse (Maybe Text)
cddvrsId = lens _cddvrsId (\ s a -> s{_cddvrsId = a});
cddvrsResponseStatus :: Lens' CreateDeviceDefinitionVersionResponse Int
cddvrsResponseStatus = lens _cddvrsResponseStatus (\ s a -> s{_cddvrsResponseStatus = a});
instance NFData CreateDeviceDefinitionVersionResponse
where