{-# 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.AppSync.UpdateAPIKey
(
updateAPIKey
, UpdateAPIKey
, uakExpires
, uakDescription
, uakApiId
, uakId
, updateAPIKeyResponse
, UpdateAPIKeyResponse
, uakrsApiKey
, uakrsResponseStatus
) where
import Network.AWS.AppSync.Types
import Network.AWS.AppSync.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateAPIKey = UpdateAPIKey'
{ _uakExpires :: !(Maybe Integer)
, _uakDescription :: !(Maybe Text)
, _uakApiId :: !Text
, _uakId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateAPIKey
:: Text
-> Text
-> UpdateAPIKey
updateAPIKey pApiId_ pId_ =
UpdateAPIKey'
{ _uakExpires = Nothing
, _uakDescription = Nothing
, _uakApiId = pApiId_
, _uakId = pId_
}
uakExpires :: Lens' UpdateAPIKey (Maybe Integer)
uakExpires = lens _uakExpires (\ s a -> s{_uakExpires = a})
uakDescription :: Lens' UpdateAPIKey (Maybe Text)
uakDescription = lens _uakDescription (\ s a -> s{_uakDescription = a})
uakApiId :: Lens' UpdateAPIKey Text
uakApiId = lens _uakApiId (\ s a -> s{_uakApiId = a})
uakId :: Lens' UpdateAPIKey Text
uakId = lens _uakId (\ s a -> s{_uakId = a})
instance AWSRequest UpdateAPIKey where
type Rs UpdateAPIKey = UpdateAPIKeyResponse
request = postJSON appSync
response
= receiveJSON
(\ s h x ->
UpdateAPIKeyResponse' <$>
(x .?> "apiKey") <*> (pure (fromEnum s)))
instance Hashable UpdateAPIKey where
instance NFData UpdateAPIKey where
instance ToHeaders UpdateAPIKey where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateAPIKey where
toJSON UpdateAPIKey'{..}
= object
(catMaybes
[("expires" .=) <$> _uakExpires,
("description" .=) <$> _uakDescription])
instance ToPath UpdateAPIKey where
toPath UpdateAPIKey'{..}
= mconcat
["/v1/apis/", toBS _uakApiId, "/apikeys/",
toBS _uakId]
instance ToQuery UpdateAPIKey where
toQuery = const mempty
data UpdateAPIKeyResponse = UpdateAPIKeyResponse'
{ _uakrsApiKey :: !(Maybe APIKey)
, _uakrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateAPIKeyResponse
:: Int
-> UpdateAPIKeyResponse
updateAPIKeyResponse pResponseStatus_ =
UpdateAPIKeyResponse'
{_uakrsApiKey = Nothing, _uakrsResponseStatus = pResponseStatus_}
uakrsApiKey :: Lens' UpdateAPIKeyResponse (Maybe APIKey)
uakrsApiKey = lens _uakrsApiKey (\ s a -> s{_uakrsApiKey = a})
uakrsResponseStatus :: Lens' UpdateAPIKeyResponse Int
uakrsResponseStatus = lens _uakrsResponseStatus (\ s a -> s{_uakrsResponseStatus = a})
instance NFData UpdateAPIKeyResponse where