module Network.AWS.APIGateway.UpdateResource
(
updateResource
, UpdateResource
, urPatchOperations
, urRestAPIId
, urResourceId
, 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 UpdateResource = UpdateResource'
{ _urPatchOperations :: !(Maybe [PatchOperation])
, _urRestAPIId :: !Text
, _urResourceId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateResource
:: Text
-> Text
-> UpdateResource
updateResource pRestAPIId_ pResourceId_ =
UpdateResource'
{ _urPatchOperations = Nothing
, _urRestAPIId = pRestAPIId_
, _urResourceId = pResourceId_
}
urPatchOperations :: Lens' UpdateResource [PatchOperation]
urPatchOperations = lens _urPatchOperations (\ s a -> s{_urPatchOperations = a}) . _Default . _Coerce;
urRestAPIId :: Lens' UpdateResource Text
urRestAPIId = lens _urRestAPIId (\ s a -> s{_urRestAPIId = a});
urResourceId :: Lens' UpdateResource Text
urResourceId = lens _urResourceId (\ s a -> s{_urResourceId = a});
instance AWSRequest UpdateResource where
type Rs UpdateResource = Resource
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateResource where
instance NFData UpdateResource where
instance ToHeaders UpdateResource where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateResource where
toJSON UpdateResource'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _urPatchOperations])
instance ToPath UpdateResource where
toPath UpdateResource'{..}
= mconcat
["/restapis/", toBS _urRestAPIId, "/resources/",
toBS _urResourceId]
instance ToQuery UpdateResource where
toQuery = const mempty