{-# 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.EC2.CreateKeyPair
(
createKeyPair
, CreateKeyPair
, ckpDryRun
, ckpKeyName
, createKeyPairResponse
, CreateKeyPairResponse
, ckprsResponseStatus
, ckprsKeyName
, ckprsKeyFingerprint
, ckprsKeyMaterial
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateKeyPair = CreateKeyPair'
{ _ckpDryRun :: !(Maybe Bool)
, _ckpKeyName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createKeyPair
:: Text
-> CreateKeyPair
createKeyPair pKeyName_ =
CreateKeyPair'
{ _ckpDryRun = Nothing
, _ckpKeyName = pKeyName_
}
ckpDryRun :: Lens' CreateKeyPair (Maybe Bool)
ckpDryRun = lens _ckpDryRun (\ s a -> s{_ckpDryRun = a});
ckpKeyName :: Lens' CreateKeyPair Text
ckpKeyName = lens _ckpKeyName (\ s a -> s{_ckpKeyName = a});
instance AWSRequest CreateKeyPair where
type Rs CreateKeyPair = CreateKeyPairResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CreateKeyPairResponse' <$>
(pure (fromEnum s)) <*> (x .@ "keyName") <*>
(x .@ "keyFingerprint")
<*> (x .@ "keyMaterial"))
instance Hashable CreateKeyPair
instance NFData CreateKeyPair
instance ToHeaders CreateKeyPair where
toHeaders = const mempty
instance ToPath CreateKeyPair where
toPath = const "/"
instance ToQuery CreateKeyPair where
toQuery CreateKeyPair'{..}
= mconcat
["Action" =: ("CreateKeyPair" :: ByteString),
"Version" =: ("2016-04-01" :: ByteString),
"DryRun" =: _ckpDryRun, "KeyName" =: _ckpKeyName]
data CreateKeyPairResponse = CreateKeyPairResponse'
{ _ckprsResponseStatus :: !Int
, _ckprsKeyName :: !Text
, _ckprsKeyFingerprint :: !Text
, _ckprsKeyMaterial :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createKeyPairResponse
:: Int
-> Text
-> Text
-> Text
-> CreateKeyPairResponse
createKeyPairResponse pResponseStatus_ pKeyName_ pKeyFingerprint_ pKeyMaterial_ =
CreateKeyPairResponse'
{ _ckprsResponseStatus = pResponseStatus_
, _ckprsKeyName = pKeyName_
, _ckprsKeyFingerprint = pKeyFingerprint_
, _ckprsKeyMaterial = pKeyMaterial_
}
ckprsResponseStatus :: Lens' CreateKeyPairResponse Int
ckprsResponseStatus = lens _ckprsResponseStatus (\ s a -> s{_ckprsResponseStatus = a});
ckprsKeyName :: Lens' CreateKeyPairResponse Text
ckprsKeyName = lens _ckprsKeyName (\ s a -> s{_ckprsKeyName = a});
ckprsKeyFingerprint :: Lens' CreateKeyPairResponse Text
ckprsKeyFingerprint = lens _ckprsKeyFingerprint (\ s a -> s{_ckprsKeyFingerprint = a});
ckprsKeyMaterial :: Lens' CreateKeyPairResponse Text
ckprsKeyMaterial = lens _ckprsKeyMaterial (\ s a -> s{_ckprsKeyMaterial = a});
instance NFData CreateKeyPairResponse