{-# 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.WorkSpaces.StopWorkspaces -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Stops the specified WorkSpaces. The API only works with WorkSpaces that have RunningMode configured as AutoStop and the State set to AVAILABLE, IMPAIRED, UNHEALTHY, or ERROR. -- -- module Network.AWS.WorkSpaces.StopWorkspaces ( -- * Creating a Request stopWorkspaces , StopWorkspaces -- * Request Lenses , swStopWorkspaceRequests -- * Destructuring the Response , stopWorkspacesResponse , StopWorkspacesResponse -- * Response Lenses , srsFailedRequests , srsResponseStatus ) where import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response import Network.AWS.WorkSpaces.Types import Network.AWS.WorkSpaces.Types.Product -- | /See:/ 'stopWorkspaces' smart constructor. newtype StopWorkspaces = StopWorkspaces' { _swStopWorkspaceRequests :: List1 StopRequest } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'StopWorkspaces' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'swStopWorkspaceRequests' - The requests. stopWorkspaces :: NonEmpty StopRequest -- ^ 'swStopWorkspaceRequests' -> StopWorkspaces stopWorkspaces pStopWorkspaceRequests_ = StopWorkspaces' { _swStopWorkspaceRequests = _List1 # pStopWorkspaceRequests_ } -- | The requests. swStopWorkspaceRequests :: Lens' StopWorkspaces (NonEmpty StopRequest) swStopWorkspaceRequests = lens _swStopWorkspaceRequests (\ s a -> s{_swStopWorkspaceRequests = a}) . _List1; instance AWSRequest StopWorkspaces where type Rs StopWorkspaces = StopWorkspacesResponse request = postJSON workSpaces response = receiveJSON (\ s h x -> StopWorkspacesResponse' <$> (x .?> "FailedRequests" .!@ mempty) <*> (pure (fromEnum s))) instance Hashable StopWorkspaces instance NFData StopWorkspaces instance ToHeaders StopWorkspaces where toHeaders = const (mconcat ["X-Amz-Target" =# ("WorkspacesService.StopWorkspaces" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON StopWorkspaces where toJSON StopWorkspaces'{..} = object (catMaybes [Just ("StopWorkspaceRequests" .= _swStopWorkspaceRequests)]) instance ToPath StopWorkspaces where toPath = const "/" instance ToQuery StopWorkspaces where toQuery = const mempty -- | /See:/ 'stopWorkspacesResponse' smart constructor. data StopWorkspacesResponse = StopWorkspacesResponse' { _srsFailedRequests :: !(Maybe [FailedWorkspaceChangeRequest]) , _srsResponseStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'StopWorkspacesResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'srsFailedRequests' - The failed requests. -- -- * 'srsResponseStatus' - -- | The response status code. stopWorkspacesResponse :: Int -- ^ 'srsResponseStatus' -> StopWorkspacesResponse stopWorkspacesResponse pResponseStatus_ = StopWorkspacesResponse' { _srsFailedRequests = Nothing , _srsResponseStatus = pResponseStatus_ } -- | The failed requests. srsFailedRequests :: Lens' StopWorkspacesResponse [FailedWorkspaceChangeRequest] srsFailedRequests = lens _srsFailedRequests (\ s a -> s{_srsFailedRequests = a}) . _Default . _Coerce; -- | -- | The response status code. srsResponseStatus :: Lens' StopWorkspacesResponse Int srsResponseStatus = lens _srsResponseStatus (\ s a -> s{_srsResponseStatus = a}); instance NFData StopWorkspacesResponse