{-# 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.CreateBasePathMapping
(
createBasePathMapping
, CreateBasePathMapping
, cbpmStage
, cbpmBasePath
, cbpmDomainName
, cbpmRestAPIId
, 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 CreateBasePathMapping = CreateBasePathMapping'
{ _cbpmStage :: !(Maybe Text)
, _cbpmBasePath :: !(Maybe Text)
, _cbpmDomainName :: !Text
, _cbpmRestAPIId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createBasePathMapping
:: Text
-> Text
-> CreateBasePathMapping
createBasePathMapping pDomainName_ pRestAPIId_ =
CreateBasePathMapping'
{ _cbpmStage = Nothing
, _cbpmBasePath = Nothing
, _cbpmDomainName = pDomainName_
, _cbpmRestAPIId = pRestAPIId_
}
cbpmStage :: Lens' CreateBasePathMapping (Maybe Text)
cbpmStage = lens _cbpmStage (\ s a -> s{_cbpmStage = a});
cbpmBasePath :: Lens' CreateBasePathMapping (Maybe Text)
cbpmBasePath = lens _cbpmBasePath (\ s a -> s{_cbpmBasePath = a});
cbpmDomainName :: Lens' CreateBasePathMapping Text
cbpmDomainName = lens _cbpmDomainName (\ s a -> s{_cbpmDomainName = a});
cbpmRestAPIId :: Lens' CreateBasePathMapping Text
cbpmRestAPIId = lens _cbpmRestAPIId (\ s a -> s{_cbpmRestAPIId = a});
instance AWSRequest CreateBasePathMapping where
type Rs CreateBasePathMapping = BasePathMapping
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateBasePathMapping
instance NFData CreateBasePathMapping
instance ToHeaders CreateBasePathMapping where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateBasePathMapping where
toJSON CreateBasePathMapping'{..}
= object
(catMaybes
[("stage" .=) <$> _cbpmStage,
("basePath" .=) <$> _cbpmBasePath,
Just ("restApiId" .= _cbpmRestAPIId)])
instance ToPath CreateBasePathMapping where
toPath CreateBasePathMapping'{..}
= mconcat
["/domainnames/", toBS _cbpmDomainName,
"/basepathmappings"]
instance ToQuery CreateBasePathMapping where
toQuery = const mempty