{-# 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.CreatePublicKey
(
createPublicKey
, CreatePublicKey
, cpkPublicKeyConfig
, createPublicKeyResponse
, CreatePublicKeyResponse
, cpkrsETag
, cpkrsLocation
, cpkrsPublicKey
, cpkrsResponseStatus
) 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 CreatePublicKey = CreatePublicKey'
{ _cpkPublicKeyConfig :: PublicKeyConfig
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPublicKey
:: PublicKeyConfig
-> CreatePublicKey
createPublicKey pPublicKeyConfig_ =
CreatePublicKey' {_cpkPublicKeyConfig = pPublicKeyConfig_}
cpkPublicKeyConfig :: Lens' CreatePublicKey PublicKeyConfig
cpkPublicKeyConfig = lens _cpkPublicKeyConfig (\ s a -> s{_cpkPublicKeyConfig = a})
instance AWSRequest CreatePublicKey where
type Rs CreatePublicKey = CreatePublicKeyResponse
request = postXML cloudFront
response
= receiveXML
(\ s h x ->
CreatePublicKeyResponse' <$>
(h .#? "ETag") <*> (h .#? "Location") <*>
(parseXML x)
<*> (pure (fromEnum s)))
instance Hashable CreatePublicKey where
instance NFData CreatePublicKey where
instance ToElement CreatePublicKey where
toElement
= mkElement
"{http://cloudfront.amazonaws.com/doc/2017-10-30/}PublicKeyConfig"
.
_cpkPublicKeyConfig
instance ToHeaders CreatePublicKey where
toHeaders = const mempty
instance ToPath CreatePublicKey where
toPath = const "/2017-10-30/public-key"
instance ToQuery CreatePublicKey where
toQuery = const mempty
data CreatePublicKeyResponse = CreatePublicKeyResponse'
{ _cpkrsETag :: !(Maybe Text)
, _cpkrsLocation :: !(Maybe Text)
, _cpkrsPublicKey :: !(Maybe PublicKey)
, _cpkrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPublicKeyResponse
:: Int
-> CreatePublicKeyResponse
createPublicKeyResponse pResponseStatus_ =
CreatePublicKeyResponse'
{ _cpkrsETag = Nothing
, _cpkrsLocation = Nothing
, _cpkrsPublicKey = Nothing
, _cpkrsResponseStatus = pResponseStatus_
}
cpkrsETag :: Lens' CreatePublicKeyResponse (Maybe Text)
cpkrsETag = lens _cpkrsETag (\ s a -> s{_cpkrsETag = a})
cpkrsLocation :: Lens' CreatePublicKeyResponse (Maybe Text)
cpkrsLocation = lens _cpkrsLocation (\ s a -> s{_cpkrsLocation = a})
cpkrsPublicKey :: Lens' CreatePublicKeyResponse (Maybe PublicKey)
cpkrsPublicKey = lens _cpkrsPublicKey (\ s a -> s{_cpkrsPublicKey = a})
cpkrsResponseStatus :: Lens' CreatePublicKeyResponse Int
cpkrsResponseStatus = lens _cpkrsResponseStatus (\ s a -> s{_cpkrsResponseStatus = a})
instance NFData CreatePublicKeyResponse where