{-# 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.CreateDeploymentConfig
(
createDeploymentConfig
, CreateDeploymentConfig
, cdcComputePlatform
, cdcMinimumHealthyHosts
, cdcTrafficRoutingConfig
, 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'
{ _cdcComputePlatform :: !(Maybe ComputePlatform)
, _cdcMinimumHealthyHosts :: !(Maybe MinimumHealthyHosts)
, _cdcTrafficRoutingConfig :: !(Maybe TrafficRoutingConfig)
, _cdcDeploymentConfigName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDeploymentConfig
:: Text
-> CreateDeploymentConfig
createDeploymentConfig pDeploymentConfigName_ =
CreateDeploymentConfig'
{ _cdcComputePlatform = Nothing
, _cdcMinimumHealthyHosts = Nothing
, _cdcTrafficRoutingConfig = Nothing
, _cdcDeploymentConfigName = pDeploymentConfigName_
}
cdcComputePlatform :: Lens' CreateDeploymentConfig (Maybe ComputePlatform)
cdcComputePlatform = lens _cdcComputePlatform (\ s a -> s{_cdcComputePlatform = a})
cdcMinimumHealthyHosts :: Lens' CreateDeploymentConfig (Maybe MinimumHealthyHosts)
cdcMinimumHealthyHosts = lens _cdcMinimumHealthyHosts (\ s a -> s{_cdcMinimumHealthyHosts = a})
cdcTrafficRoutingConfig :: Lens' CreateDeploymentConfig (Maybe TrafficRoutingConfig)
cdcTrafficRoutingConfig = lens _cdcTrafficRoutingConfig (\ s a -> s{_cdcTrafficRoutingConfig = 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 where
instance NFData CreateDeploymentConfig where
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
[("computePlatform" .=) <$> _cdcComputePlatform,
("minimumHealthyHosts" .=) <$>
_cdcMinimumHealthyHosts,
("trafficRoutingConfig" .=) <$>
_cdcTrafficRoutingConfig,
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})
instance NFData CreateDeploymentConfigResponse where