{-# 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.UpdateStage
(
updateStage
, UpdateStage
, usPatchOperations
, usRestAPIId
, usStageName
, stage
, Stage
, sDeploymentId
, sVariables
, sDocumentationVersion
, 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 UpdateStage = UpdateStage'
{ _usPatchOperations :: !(Maybe [PatchOperation])
, _usRestAPIId :: !Text
, _usStageName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateStage
:: Text
-> Text
-> UpdateStage
updateStage pRestAPIId_ pStageName_ =
UpdateStage'
{ _usPatchOperations = Nothing
, _usRestAPIId = pRestAPIId_
, _usStageName = pStageName_
}
usPatchOperations :: Lens' UpdateStage [PatchOperation]
usPatchOperations = lens _usPatchOperations (\ s a -> s{_usPatchOperations = a}) . _Default . _Coerce;
usRestAPIId :: Lens' UpdateStage Text
usRestAPIId = lens _usRestAPIId (\ s a -> s{_usRestAPIId = a});
usStageName :: Lens' UpdateStage Text
usStageName = lens _usStageName (\ s a -> s{_usStageName = a});
instance AWSRequest UpdateStage where
type Rs UpdateStage = Stage
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateStage
instance NFData UpdateStage
instance ToHeaders UpdateStage where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateStage where
toJSON UpdateStage'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _usPatchOperations])
instance ToPath UpdateStage where
toPath UpdateStage'{..}
= mconcat
["/restapis/", toBS _usRestAPIId, "/stages/",
toBS _usStageName]
instance ToQuery UpdateStage where
toQuery = const mempty