{-# 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.CreateResource
(
createResource
, CreateResource
, crRestAPIId
, crParentId
, crPathPart
, resource
, Resource
, rPathPart
, rPath
, rId
, rResourceMethods
, rParentId
) 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 CreateResource = CreateResource'
{ _crRestAPIId :: !Text
, _crParentId :: !Text
, _crPathPart :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createResource
:: Text
-> Text
-> Text
-> CreateResource
createResource pRestAPIId_ pParentId_ pPathPart_ =
CreateResource'
{ _crRestAPIId = pRestAPIId_
, _crParentId = pParentId_
, _crPathPart = pPathPart_
}
crRestAPIId :: Lens' CreateResource Text
crRestAPIId = lens _crRestAPIId (\ s a -> s{_crRestAPIId = a})
crParentId :: Lens' CreateResource Text
crParentId = lens _crParentId (\ s a -> s{_crParentId = a})
crPathPart :: Lens' CreateResource Text
crPathPart = lens _crPathPart (\ s a -> s{_crPathPart = a})
instance AWSRequest CreateResource where
type Rs CreateResource = Resource
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateResource where
instance NFData CreateResource where
instance ToHeaders CreateResource where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateResource where
toJSON CreateResource'{..}
= object
(catMaybes [Just ("pathPart" .= _crPathPart)])
instance ToPath CreateResource where
toPath CreateResource'{..}
= mconcat
["/restapis/", toBS _crRestAPIId, "/resources/",
toBS _crParentId]
instance ToQuery CreateResource where
toQuery = const mempty