{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.APIGateway.UpdateResource -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Changes information about a < Resource> resource. module Network.AWS.APIGateway.UpdateResource ( -- * Creating a Request updateResource , UpdateResource -- * Request Lenses , urPatchOperations , urRestAPIId , urResourceId -- * Destructuring the Response , resource , Resource -- * Response Lenses , 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 -- | Request to change information about a < Resource> resource. -- -- /See:/ 'updateResource' smart constructor. data UpdateResource = UpdateResource' { _urPatchOperations :: !(Maybe [PatchOperation]) , _urRestAPIId :: !Text , _urResourceId :: !Text } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'UpdateResource' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'urPatchOperations' -- -- * 'urRestAPIId' -- -- * 'urResourceId' updateResource :: Text -- ^ 'urRestAPIId' -> Text -- ^ 'urResourceId' -> UpdateResource updateResource pRestAPIId_ pResourceId_ = UpdateResource' { _urPatchOperations = Nothing , _urRestAPIId = pRestAPIId_ , _urResourceId = pResourceId_ } -- | A list of operations describing the updates to apply to the specified -- resource. The patches are applied in the order specified in the list. urPatchOperations :: Lens' UpdateResource [PatchOperation] urPatchOperations = lens _urPatchOperations (\ s a -> s{_urPatchOperations = a}) . _Default . _Coerce; -- | The < RestApi> identifier for the < Resource> resource. urRestAPIId :: Lens' UpdateResource Text urRestAPIId = lens _urRestAPIId (\ s a -> s{_urRestAPIId = a}); -- | The identifier of the < Resource> resource. 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 instance NFData UpdateResource 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