module Network.AWS.APIGateway.CreateDeployment
(
createDeployment
, CreateDeployment
, cdStageDescription
, cdVariables
, cdCacheClusterSize
, cdCacheClusterEnabled
, cdDescription
, cdRestAPIId
, cdStageName
, deployment
, Deployment
, dApiSummary
, dCreatedDate
, dId
, dDescription
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateDeployment = CreateDeployment'
{ _cdStageDescription :: !(Maybe Text)
, _cdVariables :: !(Maybe (Map Text Text))
, _cdCacheClusterSize :: !(Maybe CacheClusterSize)
, _cdCacheClusterEnabled :: !(Maybe Bool)
, _cdDescription :: !(Maybe Text)
, _cdRestAPIId :: !Text
, _cdStageName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDeployment
:: Text
-> Text
-> CreateDeployment
createDeployment pRestAPIId_ pStageName_ =
CreateDeployment'
{ _cdStageDescription = Nothing
, _cdVariables = Nothing
, _cdCacheClusterSize = Nothing
, _cdCacheClusterEnabled = Nothing
, _cdDescription = Nothing
, _cdRestAPIId = pRestAPIId_
, _cdStageName = pStageName_
}
cdStageDescription :: Lens' CreateDeployment (Maybe Text)
cdStageDescription = lens _cdStageDescription (\ s a -> s{_cdStageDescription = a});
cdVariables :: Lens' CreateDeployment (HashMap Text Text)
cdVariables = lens _cdVariables (\ s a -> s{_cdVariables = a}) . _Default . _Map;
cdCacheClusterSize :: Lens' CreateDeployment (Maybe CacheClusterSize)
cdCacheClusterSize = lens _cdCacheClusterSize (\ s a -> s{_cdCacheClusterSize = a});
cdCacheClusterEnabled :: Lens' CreateDeployment (Maybe Bool)
cdCacheClusterEnabled = lens _cdCacheClusterEnabled (\ s a -> s{_cdCacheClusterEnabled = a});
cdDescription :: Lens' CreateDeployment (Maybe Text)
cdDescription = lens _cdDescription (\ s a -> s{_cdDescription = a});
cdRestAPIId :: Lens' CreateDeployment Text
cdRestAPIId = lens _cdRestAPIId (\ s a -> s{_cdRestAPIId = a});
cdStageName :: Lens' CreateDeployment Text
cdStageName = lens _cdStageName (\ s a -> s{_cdStageName = a});
instance AWSRequest CreateDeployment where
type Rs CreateDeployment = Deployment
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateDeployment
instance ToHeaders CreateDeployment where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateDeployment where
toJSON CreateDeployment'{..}
= object
(catMaybes
[("stageDescription" .=) <$> _cdStageDescription,
("variables" .=) <$> _cdVariables,
("cacheClusterSize" .=) <$> _cdCacheClusterSize,
("cacheClusterEnabled" .=) <$>
_cdCacheClusterEnabled,
("description" .=) <$> _cdDescription,
Just ("stageName" .= _cdStageName)])
instance ToPath CreateDeployment where
toPath CreateDeployment'{..}
= mconcat
["/restapis/", toBS _cdRestAPIId, "/deployments"]
instance ToQuery CreateDeployment where
toQuery = const mempty