{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.Greengrass.ResetDeployments -- Copyright : (c) 2013-2017 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Resets a group's deployments. module Network.AWS.Greengrass.ResetDeployments ( -- * Creating a Request resetDeployments , ResetDeployments -- * Request Lenses , rdAmznClientToken , rdForce , rdGroupId -- * Destructuring the Response , resetDeploymentsResponse , ResetDeploymentsResponse -- * Response Lenses , 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 -- | Information needed to perform a reset of a group's deployments. -- -- /See:/ 'resetDeployments' smart constructor. data ResetDeployments = ResetDeployments' { _rdAmznClientToken :: !(Maybe Text) , _rdForce :: !(Maybe Bool) , _rdGroupId :: !Text } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'ResetDeployments' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rdAmznClientToken' - The client token used to request idempotent operations. -- -- * 'rdForce' - When set to true, perform a best-effort only core reset. -- -- * 'rdGroupId' - The unique Id of the AWS Greengrass Group resetDeployments :: Text -- ^ 'rdGroupId' -> ResetDeployments resetDeployments pGroupId_ = ResetDeployments' {_rdAmznClientToken = Nothing, _rdForce = Nothing, _rdGroupId = pGroupId_} -- | The client token used to request idempotent operations. rdAmznClientToken :: Lens' ResetDeployments (Maybe Text) rdAmznClientToken = lens _rdAmznClientToken (\ s a -> s{_rdAmznClientToken = a}); -- | When set to true, perform a best-effort only core reset. rdForce :: Lens' ResetDeployments (Maybe Bool) rdForce = lens _rdForce (\ s a -> s{_rdForce = a}); -- | The unique Id of the AWS Greengrass Group 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 -- | /See:/ 'resetDeploymentsResponse' smart constructor. data ResetDeploymentsResponse = ResetDeploymentsResponse' { _rdrsDeploymentId :: !(Maybe Text) , _rdrsDeploymentARN :: !(Maybe Text) , _rdrsResponseStatus :: !Int } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'ResetDeploymentsResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rdrsDeploymentId' - The id of the reset deployment. -- -- * 'rdrsDeploymentARN' - The arn of the reset deployment. -- -- * 'rdrsResponseStatus' - -- | The response status code. resetDeploymentsResponse :: Int -- ^ 'rdrsResponseStatus' -> ResetDeploymentsResponse resetDeploymentsResponse pResponseStatus_ = ResetDeploymentsResponse' { _rdrsDeploymentId = Nothing , _rdrsDeploymentARN = Nothing , _rdrsResponseStatus = pResponseStatus_ } -- | The id of the reset deployment. rdrsDeploymentId :: Lens' ResetDeploymentsResponse (Maybe Text) rdrsDeploymentId = lens _rdrsDeploymentId (\ s a -> s{_rdrsDeploymentId = a}); -- | The arn of the reset deployment. rdrsDeploymentARN :: Lens' ResetDeploymentsResponse (Maybe Text) rdrsDeploymentARN = lens _rdrsDeploymentARN (\ s a -> s{_rdrsDeploymentARN = a}); -- | -- | The response status code. rdrsResponseStatus :: Lens' ResetDeploymentsResponse Int rdrsResponseStatus = lens _rdrsResponseStatus (\ s a -> s{_rdrsResponseStatus = a}); instance NFData ResetDeploymentsResponse where