{-# 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.UpdateAPIKey
(
updateAPIKey
, UpdateAPIKey
, uakPatchOperations
, uakApiKey
, apiKey
, APIKey
, akEnabled
, akValue
, akCustomerId
, akCreatedDate
, akName
, akId
, akStageKeys
, akLastUpdatedDate
, akDescription
) 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 UpdateAPIKey = UpdateAPIKey'
{ _uakPatchOperations :: !(Maybe [PatchOperation])
, _uakApiKey :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateAPIKey
:: Text
-> UpdateAPIKey
updateAPIKey pApiKey_ =
UpdateAPIKey'
{ _uakPatchOperations = Nothing
, _uakApiKey = pApiKey_
}
uakPatchOperations :: Lens' UpdateAPIKey [PatchOperation]
uakPatchOperations = lens _uakPatchOperations (\ s a -> s{_uakPatchOperations = a}) . _Default . _Coerce;
uakApiKey :: Lens' UpdateAPIKey Text
uakApiKey = lens _uakApiKey (\ s a -> s{_uakApiKey = a});
instance AWSRequest UpdateAPIKey where
type Rs UpdateAPIKey = APIKey
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateAPIKey
instance NFData UpdateAPIKey
instance ToHeaders UpdateAPIKey where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateAPIKey where
toJSON UpdateAPIKey'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _uakPatchOperations])
instance ToPath UpdateAPIKey where
toPath UpdateAPIKey'{..}
= mconcat ["/apikeys/", toBS _uakApiKey]
instance ToQuery UpdateAPIKey where
toQuery = const mempty