module Network.AWS.CodeDeploy.GetDeployment
(
getDeployment
, GetDeployment
, gdDeploymentId
, getDeploymentResponse
, GetDeploymentResponse
, gdrsDeploymentInfo
, gdrsStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetDeployment = GetDeployment'
{ _gdDeploymentId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDeployment
:: Text
-> GetDeployment
getDeployment pDeploymentId_ =
GetDeployment'
{ _gdDeploymentId = pDeploymentId_
}
gdDeploymentId :: Lens' GetDeployment Text
gdDeploymentId = lens _gdDeploymentId (\ s a -> s{_gdDeploymentId = a});
instance AWSRequest GetDeployment where
type Rs GetDeployment = GetDeploymentResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
GetDeploymentResponse' <$>
(x .?> "deploymentInfo") <*> (pure (fromEnum s)))
instance ToHeaders GetDeployment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.GetDeployment" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetDeployment where
toJSON GetDeployment'{..}
= object
(catMaybes
[Just ("deploymentId" .= _gdDeploymentId)])
instance ToPath GetDeployment where
toPath = const "/"
instance ToQuery GetDeployment where
toQuery = const mempty
data GetDeploymentResponse = GetDeploymentResponse'
{ _gdrsDeploymentInfo :: !(Maybe DeploymentInfo)
, _gdrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDeploymentResponse
:: Int
-> GetDeploymentResponse
getDeploymentResponse pStatus_ =
GetDeploymentResponse'
{ _gdrsDeploymentInfo = Nothing
, _gdrsStatus = pStatus_
}
gdrsDeploymentInfo :: Lens' GetDeploymentResponse (Maybe DeploymentInfo)
gdrsDeploymentInfo = lens _gdrsDeploymentInfo (\ s a -> s{_gdrsDeploymentInfo = a});
gdrsStatus :: Lens' GetDeploymentResponse Int
gdrsStatus = lens _gdrsStatus (\ s a -> s{_gdrsStatus = a});