module Network.AWS.CodeDeploy.CreateDeploymentConfig
(
createDeploymentConfig
, CreateDeploymentConfig
, cdcMinimumHealthyHosts
, cdcDeploymentConfigName
, createDeploymentConfigResponse
, CreateDeploymentConfigResponse
, cdcrsDeploymentConfigId
, cdcrsResponseStatus
) 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
data CreateDeploymentConfig = CreateDeploymentConfig'
{ _cdcMinimumHealthyHosts :: !(Maybe MinimumHealthyHosts)
, _cdcDeploymentConfigName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDeploymentConfig
:: Text
-> CreateDeploymentConfig
createDeploymentConfig pDeploymentConfigName_ =
CreateDeploymentConfig'
{ _cdcMinimumHealthyHosts = Nothing
, _cdcDeploymentConfigName = pDeploymentConfigName_
}
cdcMinimumHealthyHosts :: Lens' CreateDeploymentConfig (Maybe MinimumHealthyHosts)
cdcMinimumHealthyHosts = lens _cdcMinimumHealthyHosts (\ s a -> s{_cdcMinimumHealthyHosts = a});
cdcDeploymentConfigName :: Lens' CreateDeploymentConfig Text
cdcDeploymentConfigName = lens _cdcDeploymentConfigName (\ s a -> s{_cdcDeploymentConfigName = a});
instance AWSRequest CreateDeploymentConfig where
type Rs CreateDeploymentConfig =
CreateDeploymentConfigResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
CreateDeploymentConfigResponse' <$>
(x .?> "deploymentConfigId") <*> (pure (fromEnum s)))
instance Hashable CreateDeploymentConfig
instance ToHeaders CreateDeploymentConfig where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.CreateDeploymentConfig" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateDeploymentConfig where
toJSON CreateDeploymentConfig'{..}
= object
(catMaybes
[("minimumHealthyHosts" .=) <$>
_cdcMinimumHealthyHosts,
Just
("deploymentConfigName" .=
_cdcDeploymentConfigName)])
instance ToPath CreateDeploymentConfig where
toPath = const "/"
instance ToQuery CreateDeploymentConfig where
toQuery = const mempty
data CreateDeploymentConfigResponse = CreateDeploymentConfigResponse'
{ _cdcrsDeploymentConfigId :: !(Maybe Text)
, _cdcrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDeploymentConfigResponse
:: Int
-> CreateDeploymentConfigResponse
createDeploymentConfigResponse pResponseStatus_ =
CreateDeploymentConfigResponse'
{ _cdcrsDeploymentConfigId = Nothing
, _cdcrsResponseStatus = pResponseStatus_
}
cdcrsDeploymentConfigId :: Lens' CreateDeploymentConfigResponse (Maybe Text)
cdcrsDeploymentConfigId = lens _cdcrsDeploymentConfigId (\ s a -> s{_cdcrsDeploymentConfigId = a});
cdcrsResponseStatus :: Lens' CreateDeploymentConfigResponse Int
cdcrsResponseStatus = lens _cdcrsResponseStatus (\ s a -> s{_cdcrsResponseStatus = a});