{-# 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.UpdateBasePathMapping
(
updateBasePathMapping
, UpdateBasePathMapping
, ubpmPatchOperations
, ubpmDomainName
, ubpmBasePath
, basePathMapping
, BasePathMapping
, bpmStage
, bpmBasePath
, bpmRestAPIId
) 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 UpdateBasePathMapping = UpdateBasePathMapping'
{ _ubpmPatchOperations :: !(Maybe [PatchOperation])
, _ubpmDomainName :: !Text
, _ubpmBasePath :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateBasePathMapping
:: Text
-> Text
-> UpdateBasePathMapping
updateBasePathMapping pDomainName_ pBasePath_ =
UpdateBasePathMapping'
{ _ubpmPatchOperations = Nothing
, _ubpmDomainName = pDomainName_
, _ubpmBasePath = pBasePath_
}
ubpmPatchOperations :: Lens' UpdateBasePathMapping [PatchOperation]
ubpmPatchOperations = lens _ubpmPatchOperations (\ s a -> s{_ubpmPatchOperations = a}) . _Default . _Coerce
ubpmDomainName :: Lens' UpdateBasePathMapping Text
ubpmDomainName = lens _ubpmDomainName (\ s a -> s{_ubpmDomainName = a})
ubpmBasePath :: Lens' UpdateBasePathMapping Text
ubpmBasePath = lens _ubpmBasePath (\ s a -> s{_ubpmBasePath = a})
instance AWSRequest UpdateBasePathMapping where
type Rs UpdateBasePathMapping = BasePathMapping
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateBasePathMapping where
instance NFData UpdateBasePathMapping where
instance ToHeaders UpdateBasePathMapping where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateBasePathMapping where
toJSON UpdateBasePathMapping'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _ubpmPatchOperations])
instance ToPath UpdateBasePathMapping where
toPath UpdateBasePathMapping'{..}
= mconcat
["/domainnames/", toBS _ubpmDomainName,
"/basepathmappings/", toBS _ubpmBasePath]
instance ToQuery UpdateBasePathMapping where
toQuery = const mempty