module Network.AWS.APIGateway.CreateStage
(
createStage
, CreateStage
, csVariables
, csCacheClusterSize
, csCacheClusterEnabled
, csDescription
, csRestAPIId
, csStageName
, csDeploymentId
, stage
, Stage
, sDeploymentId
, sVariables
, sClientCertificateId
, sCreatedDate
, sCacheClusterStatus
, sMethodSettings
, sLastUpdatedDate
, sCacheClusterSize
, sCacheClusterEnabled
, sStageName
, sDescription
) 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'
{ _csVariables :: !(Maybe (Map Text Text))
, _csCacheClusterSize :: !(Maybe CacheClusterSize)
, _csCacheClusterEnabled :: !(Maybe Bool)
, _csDescription :: !(Maybe Text)
, _csRestAPIId :: !Text
, _csStageName :: !Text
, _csDeploymentId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createStage
:: Text
-> Text
-> Text
-> CreateStage
createStage pRestAPIId_ pStageName_ pDeploymentId_ =
CreateStage'
{ _csVariables = Nothing
, _csCacheClusterSize = Nothing
, _csCacheClusterEnabled = Nothing
, _csDescription = Nothing
, _csRestAPIId = pRestAPIId_
, _csStageName = pStageName_
, _csDeploymentId = pDeploymentId_
}
csVariables :: Lens' CreateStage (HashMap Text Text)
csVariables = lens _csVariables (\ s a -> s{_csVariables = a}) . _Default . _Map;
csCacheClusterSize :: Lens' CreateStage (Maybe CacheClusterSize)
csCacheClusterSize = lens _csCacheClusterSize (\ s a -> s{_csCacheClusterSize = a});
csCacheClusterEnabled :: Lens' CreateStage (Maybe Bool)
csCacheClusterEnabled = lens _csCacheClusterEnabled (\ s a -> s{_csCacheClusterEnabled = a});
csDescription :: Lens' CreateStage (Maybe Text)
csDescription = lens _csDescription (\ s a -> s{_csDescription = a});
csRestAPIId :: Lens' CreateStage Text
csRestAPIId = lens _csRestAPIId (\ s a -> s{_csRestAPIId = a});
csStageName :: Lens' CreateStage Text
csStageName = lens _csStageName (\ s a -> s{_csStageName = a});
csDeploymentId :: Lens' CreateStage Text
csDeploymentId = lens _csDeploymentId (\ s a -> s{_csDeploymentId = a});
instance AWSRequest CreateStage where
type Rs CreateStage = Stage
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateStage
instance ToHeaders CreateStage where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateStage where
toJSON CreateStage'{..}
= object
(catMaybes
[("variables" .=) <$> _csVariables,
("cacheClusterSize" .=) <$> _csCacheClusterSize,
("cacheClusterEnabled" .=) <$>
_csCacheClusterEnabled,
("description" .=) <$> _csDescription,
Just ("stageName" .= _csStageName),
Just ("deploymentId" .= _csDeploymentId)])
instance ToPath CreateStage where
toPath CreateStage'{..}
= mconcat
["/restapis/", toBS _csRestAPIId, "/stages"]
instance ToQuery CreateStage where
toQuery = const mempty