{-# 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.UpdateModel
(
updateModel
, UpdateModel
, uPatchOperations
, uRestAPIId
, uModelName
, model
, Model
, mSchema
, mName
, mId
, mDescription
, mContentType
) 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 UpdateModel = UpdateModel'
{ _uPatchOperations :: !(Maybe [PatchOperation])
, _uRestAPIId :: !Text
, _uModelName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateModel
:: Text
-> Text
-> UpdateModel
updateModel pRestAPIId_ pModelName_ =
UpdateModel'
{ _uPatchOperations = Nothing
, _uRestAPIId = pRestAPIId_
, _uModelName = pModelName_
}
uPatchOperations :: Lens' UpdateModel [PatchOperation]
uPatchOperations = lens _uPatchOperations (\ s a -> s{_uPatchOperations = a}) . _Default . _Coerce;
uRestAPIId :: Lens' UpdateModel Text
uRestAPIId = lens _uRestAPIId (\ s a -> s{_uRestAPIId = a});
uModelName :: Lens' UpdateModel Text
uModelName = lens _uModelName (\ s a -> s{_uModelName = a});
instance AWSRequest UpdateModel where
type Rs UpdateModel = Model
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateModel
instance NFData UpdateModel
instance ToHeaders UpdateModel where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateModel where
toJSON UpdateModel'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _uPatchOperations])
instance ToPath UpdateModel where
toPath UpdateModel'{..}
= mconcat
["/restapis/", toBS _uRestAPIId, "/models/",
toBS _uModelName]
instance ToQuery UpdateModel where
toQuery = const mempty