{-# 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.PutRestAPI
(
putRestAPI
, PutRestAPI
, praMode
, praFailOnWarnings
, praParameters
, praRestAPIId
, praBody
, restAPI
, RestAPI
, raBinaryMediaTypes
, raWarnings
, raCreatedDate
, raName
, raVersion
, raId
, raDescription
) 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 PutRestAPI = PutRestAPI'
{ _praMode :: !(Maybe PutMode)
, _praFailOnWarnings :: !(Maybe Bool)
, _praParameters :: !(Maybe (Map Text Text))
, _praRestAPIId :: !Text
, _praBody :: !(HashMap Text Value)
} deriving (Eq,Show,Data,Typeable,Generic)
putRestAPI
:: Text
-> HashMap Text Value
-> PutRestAPI
putRestAPI pRestAPIId_ pBody_ =
PutRestAPI'
{ _praMode = Nothing
, _praFailOnWarnings = Nothing
, _praParameters = Nothing
, _praRestAPIId = pRestAPIId_
, _praBody = pBody_
}
praMode :: Lens' PutRestAPI (Maybe PutMode)
praMode = lens _praMode (\ s a -> s{_praMode = a});
praFailOnWarnings :: Lens' PutRestAPI (Maybe Bool)
praFailOnWarnings = lens _praFailOnWarnings (\ s a -> s{_praFailOnWarnings = a});
praParameters :: Lens' PutRestAPI (HashMap Text Text)
praParameters = lens _praParameters (\ s a -> s{_praParameters = a}) . _Default . _Map;
praRestAPIId :: Lens' PutRestAPI Text
praRestAPIId = lens _praRestAPIId (\ s a -> s{_praRestAPIId = a});
praBody :: Lens' PutRestAPI (HashMap Text Value)
praBody = lens _praBody (\ s a -> s{_praBody = a});
instance AWSRequest PutRestAPI where
type Rs PutRestAPI = RestAPI
request = putBody apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable PutRestAPI
instance NFData PutRestAPI
instance ToBody PutRestAPI where
toBody = toBody . _praBody
instance ToHeaders PutRestAPI where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath PutRestAPI where
toPath PutRestAPI'{..}
= mconcat ["/restapis/", toBS _praRestAPIId]
instance ToQuery PutRestAPI where
toQuery PutRestAPI'{..}
= mconcat
["mode" =: _praMode,
"failonwarnings" =: _praFailOnWarnings,
"parameters" =:
toQuery
(toQueryMap "entry" "key" "value" <$>
_praParameters)]