{-# 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.CodeDeploy.StopDeployment
(
stopDeployment
, StopDeployment
, sdDeploymentId
, stopDeploymentResponse
, StopDeploymentResponse
, sdrsStatus
, sdrsStatusMessage
, sdrsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype StopDeployment = StopDeployment'
{ _sdDeploymentId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopDeployment
:: Text
-> StopDeployment
stopDeployment pDeploymentId_ =
StopDeployment'
{ _sdDeploymentId = pDeploymentId_
}
sdDeploymentId :: Lens' StopDeployment Text
sdDeploymentId = lens _sdDeploymentId (\ s a -> s{_sdDeploymentId = a});
instance AWSRequest StopDeployment where
type Rs StopDeployment = StopDeploymentResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
StopDeploymentResponse' <$>
(x .?> "status") <*> (x .?> "statusMessage") <*>
(pure (fromEnum s)))
instance Hashable StopDeployment
instance NFData StopDeployment
instance ToHeaders StopDeployment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.StopDeployment" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StopDeployment where
toJSON StopDeployment'{..}
= object
(catMaybes
[Just ("deploymentId" .= _sdDeploymentId)])
instance ToPath StopDeployment where
toPath = const "/"
instance ToQuery StopDeployment where
toQuery = const mempty
data StopDeploymentResponse = StopDeploymentResponse'
{ _sdrsStatus :: !(Maybe StopStatus)
, _sdrsStatusMessage :: !(Maybe Text)
, _sdrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopDeploymentResponse
:: Int
-> StopDeploymentResponse
stopDeploymentResponse pResponseStatus_ =
StopDeploymentResponse'
{ _sdrsStatus = Nothing
, _sdrsStatusMessage = Nothing
, _sdrsResponseStatus = pResponseStatus_
}
sdrsStatus :: Lens' StopDeploymentResponse (Maybe StopStatus)
sdrsStatus = lens _sdrsStatus (\ s a -> s{_sdrsStatus = a});
sdrsStatusMessage :: Lens' StopDeploymentResponse (Maybe Text)
sdrsStatusMessage = lens _sdrsStatusMessage (\ s a -> s{_sdrsStatusMessage = a});
sdrsResponseStatus :: Lens' StopDeploymentResponse Int
sdrsResponseStatus = lens _sdrsResponseStatus (\ s a -> s{_sdrsResponseStatus = a});
instance NFData StopDeploymentResponse