{-# 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.ResetDeployments
(
resetDeployments
, ResetDeployments
, rdAmznClientToken
, rdForce
, rdGroupId
, resetDeploymentsResponse
, ResetDeploymentsResponse
, rdrsDeploymentId
, rdrsDeploymentARN
, rdrsResponseStatus
) 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 ResetDeployments = ResetDeployments'
{ _rdAmznClientToken :: !(Maybe Text)
, _rdForce :: !(Maybe Bool)
, _rdGroupId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resetDeployments
:: Text
-> ResetDeployments
resetDeployments pGroupId_ =
ResetDeployments'
{_rdAmznClientToken = Nothing, _rdForce = Nothing, _rdGroupId = pGroupId_}
rdAmznClientToken :: Lens' ResetDeployments (Maybe Text)
rdAmznClientToken = lens _rdAmznClientToken (\ s a -> s{_rdAmznClientToken = a})
rdForce :: Lens' ResetDeployments (Maybe Bool)
rdForce = lens _rdForce (\ s a -> s{_rdForce = a})
rdGroupId :: Lens' ResetDeployments Text
rdGroupId = lens _rdGroupId (\ s a -> s{_rdGroupId = a})
instance AWSRequest ResetDeployments where
type Rs ResetDeployments = ResetDeploymentsResponse
request = postJSON greengrass
response
= receiveJSON
(\ s h x ->
ResetDeploymentsResponse' <$>
(x .?> "DeploymentId") <*> (x .?> "DeploymentArn")
<*> (pure (fromEnum s)))
instance Hashable ResetDeployments where
instance NFData ResetDeployments where
instance ToHeaders ResetDeployments where
toHeaders ResetDeployments'{..}
= mconcat
["X-Amzn-Client-Token" =# _rdAmznClientToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON ResetDeployments where
toJSON ResetDeployments'{..}
= object (catMaybes [("Force" .=) <$> _rdForce])
instance ToPath ResetDeployments where
toPath ResetDeployments'{..}
= mconcat
["/greengrass/groups/", toBS _rdGroupId,
"/deployments/$reset"]
instance ToQuery ResetDeployments where
toQuery = const mempty
data ResetDeploymentsResponse = ResetDeploymentsResponse'
{ _rdrsDeploymentId :: !(Maybe Text)
, _rdrsDeploymentARN :: !(Maybe Text)
, _rdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resetDeploymentsResponse
:: Int
-> ResetDeploymentsResponse
resetDeploymentsResponse pResponseStatus_ =
ResetDeploymentsResponse'
{ _rdrsDeploymentId = Nothing
, _rdrsDeploymentARN = Nothing
, _rdrsResponseStatus = pResponseStatus_
}
rdrsDeploymentId :: Lens' ResetDeploymentsResponse (Maybe Text)
rdrsDeploymentId = lens _rdrsDeploymentId (\ s a -> s{_rdrsDeploymentId = a})
rdrsDeploymentARN :: Lens' ResetDeploymentsResponse (Maybe Text)
rdrsDeploymentARN = lens _rdrsDeploymentARN (\ s a -> s{_rdrsDeploymentARN = a})
rdrsResponseStatus :: Lens' ResetDeploymentsResponse Int
rdrsResponseStatus = lens _rdrsResponseStatus (\ s a -> s{_rdrsResponseStatus = a})
instance NFData ResetDeploymentsResponse where