{-# 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.ImportRestAPI
(
importRestAPI
, ImportRestAPI
, iraFailOnWarnings
, iraParameters
, iraBody
, 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 ImportRestAPI = ImportRestAPI'
{ _iraFailOnWarnings :: !(Maybe Bool)
, _iraParameters :: !(Maybe (Map Text Text))
, _iraBody :: !(HashMap Text Value)
} deriving (Eq,Show,Data,Typeable,Generic)
importRestAPI
:: HashMap Text Value
-> ImportRestAPI
importRestAPI pBody_ =
ImportRestAPI'
{ _iraFailOnWarnings = Nothing
, _iraParameters = Nothing
, _iraBody = pBody_
}
iraFailOnWarnings :: Lens' ImportRestAPI (Maybe Bool)
iraFailOnWarnings = lens _iraFailOnWarnings (\ s a -> s{_iraFailOnWarnings = a});
iraParameters :: Lens' ImportRestAPI (HashMap Text Text)
iraParameters = lens _iraParameters (\ s a -> s{_iraParameters = a}) . _Default . _Map;
iraBody :: Lens' ImportRestAPI (HashMap Text Value)
iraBody = lens _iraBody (\ s a -> s{_iraBody = a});
instance AWSRequest ImportRestAPI where
type Rs ImportRestAPI = RestAPI
request = postBody apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable ImportRestAPI
instance NFData ImportRestAPI
instance ToBody ImportRestAPI where
toBody = toBody . _iraBody
instance ToHeaders ImportRestAPI where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath ImportRestAPI where
toPath = const "/restapis"
instance ToQuery ImportRestAPI where
toQuery ImportRestAPI'{..}
= mconcat
["failonwarnings" =: _iraFailOnWarnings,
"parameters" =:
toQuery
(toQueryMap "entry" "key" "value" <$>
_iraParameters),
"mode=import"]