{-# 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.PutMethod
(
putMethod
, PutMethod
, putRequestModels
, putRequestParameters
, putAuthorizerId
, putApiKeyRequired
, putRestAPIId
, putResourceId
, putHttpMethod
, putAuthorizationType
, method
, Method
, mMethodResponses
, mHttpMethod
, mRequestModels
, mRequestParameters
, mAuthorizerId
, mAuthorizationType
, mApiKeyRequired
, mMethodIntegration
) 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 PutMethod = PutMethod'
{ _putRequestModels :: !(Maybe (Map Text Text))
, _putRequestParameters :: !(Maybe (Map Text Bool))
, _putAuthorizerId :: !(Maybe Text)
, _putApiKeyRequired :: !(Maybe Bool)
, _putRestAPIId :: !Text
, _putResourceId :: !Text
, _putHttpMethod :: !Text
, _putAuthorizationType :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putMethod
:: Text
-> Text
-> Text
-> Text
-> PutMethod
putMethod pRestAPIId_ pResourceId_ pHttpMethod_ pAuthorizationType_ =
PutMethod'
{ _putRequestModels = Nothing
, _putRequestParameters = Nothing
, _putAuthorizerId = Nothing
, _putApiKeyRequired = Nothing
, _putRestAPIId = pRestAPIId_
, _putResourceId = pResourceId_
, _putHttpMethod = pHttpMethod_
, _putAuthorizationType = pAuthorizationType_
}
putRequestModels :: Lens' PutMethod (HashMap Text Text)
putRequestModels = lens _putRequestModels (\ s a -> s{_putRequestModels = a}) . _Default . _Map;
putRequestParameters :: Lens' PutMethod (HashMap Text Bool)
putRequestParameters = lens _putRequestParameters (\ s a -> s{_putRequestParameters = a}) . _Default . _Map;
putAuthorizerId :: Lens' PutMethod (Maybe Text)
putAuthorizerId = lens _putAuthorizerId (\ s a -> s{_putAuthorizerId = a});
putApiKeyRequired :: Lens' PutMethod (Maybe Bool)
putApiKeyRequired = lens _putApiKeyRequired (\ s a -> s{_putApiKeyRequired = a});
putRestAPIId :: Lens' PutMethod Text
putRestAPIId = lens _putRestAPIId (\ s a -> s{_putRestAPIId = a});
putResourceId :: Lens' PutMethod Text
putResourceId = lens _putResourceId (\ s a -> s{_putResourceId = a});
putHttpMethod :: Lens' PutMethod Text
putHttpMethod = lens _putHttpMethod (\ s a -> s{_putHttpMethod = a});
putAuthorizationType :: Lens' PutMethod Text
putAuthorizationType = lens _putAuthorizationType (\ s a -> s{_putAuthorizationType = a});
instance AWSRequest PutMethod where
type Rs PutMethod = Method
request = putJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable PutMethod
instance NFData PutMethod
instance ToHeaders PutMethod where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON PutMethod where
toJSON PutMethod'{..}
= object
(catMaybes
[("requestModels" .=) <$> _putRequestModels,
("requestParameters" .=) <$> _putRequestParameters,
("authorizerId" .=) <$> _putAuthorizerId,
("apiKeyRequired" .=) <$> _putApiKeyRequired,
Just ("authorizationType" .= _putAuthorizationType)])
instance ToPath PutMethod where
toPath PutMethod'{..}
= mconcat
["/restapis/", toBS _putRestAPIId, "/resources/",
toBS _putResourceId, "/methods/",
toBS _putHttpMethod]
instance ToQuery PutMethod where
toQuery = const mempty