{-# 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.APIGateway.CreateStage
(
createStage
, CreateStage
, cVariables
, cDocumentationVersion
, cCacheClusterSize
, cCanarySettings
, cCacheClusterEnabled
, cDescription
, cTags
, cRestAPIId
, cStageName
, cDeploymentId
, stage
, Stage
, sDeploymentId
, sVariables
, sAccessLogSettings
, sDocumentationVersion
, sClientCertificateId
, sCreatedDate
, sCacheClusterStatus
, sMethodSettings
, sLastUpdatedDate
, sCacheClusterSize
, sCanarySettings
, sCacheClusterEnabled
, sStageName
, sDescription
, sTags
) 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 CreateStage = CreateStage'
{ _cVariables :: !(Maybe (Map Text Text))
, _cDocumentationVersion :: !(Maybe Text)
, _cCacheClusterSize :: !(Maybe CacheClusterSize)
, _cCanarySettings :: !(Maybe CanarySettings)
, _cCacheClusterEnabled :: !(Maybe Bool)
, _cDescription :: !(Maybe Text)
, _cTags :: !(Maybe (Map Text Text))
, _cRestAPIId :: !Text
, _cStageName :: !Text
, _cDeploymentId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createStage
:: Text
-> Text
-> Text
-> CreateStage
createStage pRestAPIId_ pStageName_ pDeploymentId_ =
CreateStage'
{ _cVariables = Nothing
, _cDocumentationVersion = Nothing
, _cCacheClusterSize = Nothing
, _cCanarySettings = Nothing
, _cCacheClusterEnabled = Nothing
, _cDescription = Nothing
, _cTags = Nothing
, _cRestAPIId = pRestAPIId_
, _cStageName = pStageName_
, _cDeploymentId = pDeploymentId_
}
cVariables :: Lens' CreateStage (HashMap Text Text)
cVariables = lens _cVariables (\ s a -> s{_cVariables = a}) . _Default . _Map
cDocumentationVersion :: Lens' CreateStage (Maybe Text)
cDocumentationVersion = lens _cDocumentationVersion (\ s a -> s{_cDocumentationVersion = a})
cCacheClusterSize :: Lens' CreateStage (Maybe CacheClusterSize)
cCacheClusterSize = lens _cCacheClusterSize (\ s a -> s{_cCacheClusterSize = a})
cCanarySettings :: Lens' CreateStage (Maybe CanarySettings)
cCanarySettings = lens _cCanarySettings (\ s a -> s{_cCanarySettings = a})
cCacheClusterEnabled :: Lens' CreateStage (Maybe Bool)
cCacheClusterEnabled = lens _cCacheClusterEnabled (\ s a -> s{_cCacheClusterEnabled = a})
cDescription :: Lens' CreateStage (Maybe Text)
cDescription = lens _cDescription (\ s a -> s{_cDescription = a})
cTags :: Lens' CreateStage (HashMap Text Text)
cTags = lens _cTags (\ s a -> s{_cTags = a}) . _Default . _Map
cRestAPIId :: Lens' CreateStage Text
cRestAPIId = lens _cRestAPIId (\ s a -> s{_cRestAPIId = a})
cStageName :: Lens' CreateStage Text
cStageName = lens _cStageName (\ s a -> s{_cStageName = a})
cDeploymentId :: Lens' CreateStage Text
cDeploymentId = lens _cDeploymentId (\ s a -> s{_cDeploymentId = a})
instance AWSRequest CreateStage where
type Rs CreateStage = Stage
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateStage where
instance NFData CreateStage where
instance ToHeaders CreateStage where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateStage where
toJSON CreateStage'{..}
= object
(catMaybes
[("variables" .=) <$> _cVariables,
("documentationVersion" .=) <$>
_cDocumentationVersion,
("cacheClusterSize" .=) <$> _cCacheClusterSize,
("canarySettings" .=) <$> _cCanarySettings,
("cacheClusterEnabled" .=) <$> _cCacheClusterEnabled,
("description" .=) <$> _cDescription,
("tags" .=) <$> _cTags,
Just ("stageName" .= _cStageName),
Just ("deploymentId" .= _cDeploymentId)])
instance ToPath CreateStage where
toPath CreateStage'{..}
= mconcat ["/restapis/", toBS _cRestAPIId, "/stages"]
instance ToQuery CreateStage where
toQuery = const mempty