{-# 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.GetPublicKey
(
getPublicKey
, GetPublicKey
, gpkId
, getPublicKeyResponse
, GetPublicKeyResponse
, gpkrsETag
, gpkrsPublicKey
, gpkrsResponseStatus
) 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
newtype GetPublicKey = GetPublicKey'
{ _gpkId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPublicKey
:: Text
-> GetPublicKey
getPublicKey pId_ = GetPublicKey' {_gpkId = pId_}
gpkId :: Lens' GetPublicKey Text
gpkId = lens _gpkId (\ s a -> s{_gpkId = a})
instance AWSRequest GetPublicKey where
type Rs GetPublicKey = GetPublicKeyResponse
request = get cloudFront
response
= receiveXML
(\ s h x ->
GetPublicKeyResponse' <$>
(h .#? "ETag") <*> (parseXML x) <*>
(pure (fromEnum s)))
instance Hashable GetPublicKey where
instance NFData GetPublicKey where
instance ToHeaders GetPublicKey where
toHeaders = const mempty
instance ToPath GetPublicKey where
toPath GetPublicKey'{..}
= mconcat ["/2017-10-30/public-key/", toBS _gpkId]
instance ToQuery GetPublicKey where
toQuery = const mempty
data GetPublicKeyResponse = GetPublicKeyResponse'
{ _gpkrsETag :: !(Maybe Text)
, _gpkrsPublicKey :: !(Maybe PublicKey)
, _gpkrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPublicKeyResponse
:: Int
-> GetPublicKeyResponse
getPublicKeyResponse pResponseStatus_ =
GetPublicKeyResponse'
{ _gpkrsETag = Nothing
, _gpkrsPublicKey = Nothing
, _gpkrsResponseStatus = pResponseStatus_
}
gpkrsETag :: Lens' GetPublicKeyResponse (Maybe Text)
gpkrsETag = lens _gpkrsETag (\ s a -> s{_gpkrsETag = a})
gpkrsPublicKey :: Lens' GetPublicKeyResponse (Maybe PublicKey)
gpkrsPublicKey = lens _gpkrsPublicKey (\ s a -> s{_gpkrsPublicKey = a})
gpkrsResponseStatus :: Lens' GetPublicKeyResponse Int
gpkrsResponseStatus = lens _gpkrsResponseStatus (\ s a -> s{_gpkrsResponseStatus = a})
instance NFData GetPublicKeyResponse where