{-# 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.ImportAPIKeys
(
importAPIKeys
, ImportAPIKeys
, iakFailOnWarnings
, iakBody
, iakFormat
, importAPIKeysResponse
, ImportAPIKeysResponse
, iakrsIds
, iakrsWarnings
, iakrsResponseStatus
) 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 ImportAPIKeys = ImportAPIKeys'
{ _iakFailOnWarnings :: !(Maybe Bool)
, _iakBody :: !(HashMap Text Value)
, _iakFormat :: !APIKeysFormat
} deriving (Eq,Show,Data,Typeable,Generic)
importAPIKeys
:: HashMap Text Value
-> APIKeysFormat
-> ImportAPIKeys
importAPIKeys pBody_ pFormat_ =
ImportAPIKeys'
{ _iakFailOnWarnings = Nothing
, _iakBody = pBody_
, _iakFormat = pFormat_
}
iakFailOnWarnings :: Lens' ImportAPIKeys (Maybe Bool)
iakFailOnWarnings = lens _iakFailOnWarnings (\ s a -> s{_iakFailOnWarnings = a});
iakBody :: Lens' ImportAPIKeys (HashMap Text Value)
iakBody = lens _iakBody (\ s a -> s{_iakBody = a});
iakFormat :: Lens' ImportAPIKeys APIKeysFormat
iakFormat = lens _iakFormat (\ s a -> s{_iakFormat = a});
instance AWSRequest ImportAPIKeys where
type Rs ImportAPIKeys = ImportAPIKeysResponse
request = postBody apiGateway
response
= receiveJSON
(\ s h x ->
ImportAPIKeysResponse' <$>
(x .?> "ids" .!@ mempty) <*>
(x .?> "warnings" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ImportAPIKeys
instance NFData ImportAPIKeys
instance ToBody ImportAPIKeys where
toBody = toBody . _iakBody
instance ToHeaders ImportAPIKeys where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath ImportAPIKeys where
toPath = const "/apikeys"
instance ToQuery ImportAPIKeys where
toQuery ImportAPIKeys'{..}
= mconcat
["failonwarnings" =: _iakFailOnWarnings,
"format" =: _iakFormat, "mode=import"]
data ImportAPIKeysResponse = ImportAPIKeysResponse'
{ _iakrsIds :: !(Maybe [Text])
, _iakrsWarnings :: !(Maybe [Text])
, _iakrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
importAPIKeysResponse
:: Int
-> ImportAPIKeysResponse
importAPIKeysResponse pResponseStatus_ =
ImportAPIKeysResponse'
{ _iakrsIds = Nothing
, _iakrsWarnings = Nothing
, _iakrsResponseStatus = pResponseStatus_
}
iakrsIds :: Lens' ImportAPIKeysResponse [Text]
iakrsIds = lens _iakrsIds (\ s a -> s{_iakrsIds = a}) . _Default . _Coerce;
iakrsWarnings :: Lens' ImportAPIKeysResponse [Text]
iakrsWarnings = lens _iakrsWarnings (\ s a -> s{_iakrsWarnings = a}) . _Default . _Coerce;
iakrsResponseStatus :: Lens' ImportAPIKeysResponse Int
iakrsResponseStatus = lens _iakrsResponseStatus (\ s a -> s{_iakrsResponseStatus = a});
instance NFData ImportAPIKeysResponse