module Network.AWS.CodeDeploy.CreateDeployment
(
createDeployment
, CreateDeployment
, cdDeploymentConfigName
, cdRevision
, cdDescription
, cdDeploymentGroupName
, cdIgnoreApplicationStopFailures
, cdApplicationName
, createDeploymentResponse
, CreateDeploymentResponse
, cdrsDeploymentId
, cdrsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateDeployment = CreateDeployment'
{ _cdDeploymentConfigName :: !(Maybe Text)
, _cdRevision :: !(Maybe RevisionLocation)
, _cdDescription :: !(Maybe Text)
, _cdDeploymentGroupName :: !(Maybe Text)
, _cdIgnoreApplicationStopFailures :: !(Maybe Bool)
, _cdApplicationName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDeployment
:: Text
-> CreateDeployment
createDeployment pApplicationName_ =
CreateDeployment'
{ _cdDeploymentConfigName = Nothing
, _cdRevision = Nothing
, _cdDescription = Nothing
, _cdDeploymentGroupName = Nothing
, _cdIgnoreApplicationStopFailures = Nothing
, _cdApplicationName = pApplicationName_
}
cdDeploymentConfigName :: Lens' CreateDeployment (Maybe Text)
cdDeploymentConfigName = lens _cdDeploymentConfigName (\ s a -> s{_cdDeploymentConfigName = a});
cdRevision :: Lens' CreateDeployment (Maybe RevisionLocation)
cdRevision = lens _cdRevision (\ s a -> s{_cdRevision = a});
cdDescription :: Lens' CreateDeployment (Maybe Text)
cdDescription = lens _cdDescription (\ s a -> s{_cdDescription = a});
cdDeploymentGroupName :: Lens' CreateDeployment (Maybe Text)
cdDeploymentGroupName = lens _cdDeploymentGroupName (\ s a -> s{_cdDeploymentGroupName = a});
cdIgnoreApplicationStopFailures :: Lens' CreateDeployment (Maybe Bool)
cdIgnoreApplicationStopFailures = lens _cdIgnoreApplicationStopFailures (\ s a -> s{_cdIgnoreApplicationStopFailures = a});
cdApplicationName :: Lens' CreateDeployment Text
cdApplicationName = lens _cdApplicationName (\ s a -> s{_cdApplicationName = a});
instance AWSRequest CreateDeployment where
type Rs CreateDeployment = CreateDeploymentResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
CreateDeploymentResponse' <$>
(x .?> "deploymentId") <*> (pure (fromEnum s)))
instance ToHeaders CreateDeployment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.CreateDeployment" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateDeployment where
toJSON CreateDeployment'{..}
= object
(catMaybes
[("deploymentConfigName" .=) <$>
_cdDeploymentConfigName,
("revision" .=) <$> _cdRevision,
("description" .=) <$> _cdDescription,
("deploymentGroupName" .=) <$>
_cdDeploymentGroupName,
("ignoreApplicationStopFailures" .=) <$>
_cdIgnoreApplicationStopFailures,
Just ("applicationName" .= _cdApplicationName)])
instance ToPath CreateDeployment where
toPath = const "/"
instance ToQuery CreateDeployment where
toQuery = const mempty
data CreateDeploymentResponse = CreateDeploymentResponse'
{ _cdrsDeploymentId :: !(Maybe Text)
, _cdrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDeploymentResponse
:: Int
-> CreateDeploymentResponse
createDeploymentResponse pResponseStatus_ =
CreateDeploymentResponse'
{ _cdrsDeploymentId = Nothing
, _cdrsResponseStatus = pResponseStatus_
}
cdrsDeploymentId :: Lens' CreateDeploymentResponse (Maybe Text)
cdrsDeploymentId = lens _cdrsDeploymentId (\ s a -> s{_cdrsDeploymentId = a});
cdrsResponseStatus :: Lens' CreateDeploymentResponse Int
cdrsResponseStatus = lens _cdrsResponseStatus (\ s a -> s{_cdrsResponseStatus = a});