{-# 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.CloudFront.UpdatePublicKey
(
updatePublicKey
, UpdatePublicKey
, upkIfMatch
, upkPublicKeyConfig
, upkId
, updatePublicKeyResponse
, UpdatePublicKeyResponse
, upkrsETag
, upkrsPublicKey
, upkrsResponseStatus
) where
import Network.AWS.CloudFront.Types
import Network.AWS.CloudFront.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdatePublicKey = UpdatePublicKey'
{ _upkIfMatch :: !(Maybe Text)
, _upkPublicKeyConfig :: !PublicKeyConfig
, _upkId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updatePublicKey
:: PublicKeyConfig
-> Text
-> UpdatePublicKey
updatePublicKey pPublicKeyConfig_ pId_ =
UpdatePublicKey'
{ _upkIfMatch = Nothing
, _upkPublicKeyConfig = pPublicKeyConfig_
, _upkId = pId_
}
upkIfMatch :: Lens' UpdatePublicKey (Maybe Text)
upkIfMatch = lens _upkIfMatch (\ s a -> s{_upkIfMatch = a})
upkPublicKeyConfig :: Lens' UpdatePublicKey PublicKeyConfig
upkPublicKeyConfig = lens _upkPublicKeyConfig (\ s a -> s{_upkPublicKeyConfig = a})
upkId :: Lens' UpdatePublicKey Text
upkId = lens _upkId (\ s a -> s{_upkId = a})
instance AWSRequest UpdatePublicKey where
type Rs UpdatePublicKey = UpdatePublicKeyResponse
request = putXML cloudFront
response
= receiveXML
(\ s h x ->
UpdatePublicKeyResponse' <$>
(h .#? "ETag") <*> (parseXML x) <*>
(pure (fromEnum s)))
instance Hashable UpdatePublicKey where
instance NFData UpdatePublicKey where
instance ToElement UpdatePublicKey where
toElement
= mkElement
"{http://cloudfront.amazonaws.com/doc/2017-10-30/}PublicKeyConfig"
.
_upkPublicKeyConfig
instance ToHeaders UpdatePublicKey where
toHeaders UpdatePublicKey'{..}
= mconcat ["If-Match" =# _upkIfMatch]
instance ToPath UpdatePublicKey where
toPath UpdatePublicKey'{..}
= mconcat
["/2017-10-30/public-key/", toBS _upkId, "/config"]
instance ToQuery UpdatePublicKey where
toQuery = const mempty
data UpdatePublicKeyResponse = UpdatePublicKeyResponse'
{ _upkrsETag :: !(Maybe Text)
, _upkrsPublicKey :: !(Maybe PublicKey)
, _upkrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updatePublicKeyResponse
:: Int
-> UpdatePublicKeyResponse
updatePublicKeyResponse pResponseStatus_ =
UpdatePublicKeyResponse'
{ _upkrsETag = Nothing
, _upkrsPublicKey = Nothing
, _upkrsResponseStatus = pResponseStatus_
}
upkrsETag :: Lens' UpdatePublicKeyResponse (Maybe Text)
upkrsETag = lens _upkrsETag (\ s a -> s{_upkrsETag = a})
upkrsPublicKey :: Lens' UpdatePublicKeyResponse (Maybe PublicKey)
upkrsPublicKey = lens _upkrsPublicKey (\ s a -> s{_upkrsPublicKey = a})
upkrsResponseStatus :: Lens' UpdatePublicKeyResponse Int
upkrsResponseStatus = lens _upkrsResponseStatus (\ s a -> s{_upkrsResponseStatus = a})
instance NFData UpdatePublicKeyResponse where