{-# 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.Lightsail.ImportKeyPair
(
importKeyPair
, ImportKeyPair
, ikpKeyPairName
, ikpPublicKeyBase64
, importKeyPairResponse
, ImportKeyPairResponse
, ikprsOperation
, ikprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Lightsail.Types
import Network.AWS.Lightsail.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ImportKeyPair = ImportKeyPair'
{ _ikpKeyPairName :: !Text
, _ikpPublicKeyBase64 :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
importKeyPair
:: Text
-> Text
-> ImportKeyPair
importKeyPair pKeyPairName_ pPublicKeyBase64_ =
ImportKeyPair'
{_ikpKeyPairName = pKeyPairName_, _ikpPublicKeyBase64 = pPublicKeyBase64_}
ikpKeyPairName :: Lens' ImportKeyPair Text
ikpKeyPairName = lens _ikpKeyPairName (\ s a -> s{_ikpKeyPairName = a})
ikpPublicKeyBase64 :: Lens' ImportKeyPair Text
ikpPublicKeyBase64 = lens _ikpPublicKeyBase64 (\ s a -> s{_ikpPublicKeyBase64 = a})
instance AWSRequest ImportKeyPair where
type Rs ImportKeyPair = ImportKeyPairResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
ImportKeyPairResponse' <$>
(x .?> "operation") <*> (pure (fromEnum s)))
instance Hashable ImportKeyPair where
instance NFData ImportKeyPair where
instance ToHeaders ImportKeyPair where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.ImportKeyPair" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ImportKeyPair where
toJSON ImportKeyPair'{..}
= object
(catMaybes
[Just ("keyPairName" .= _ikpKeyPairName),
Just ("publicKeyBase64" .= _ikpPublicKeyBase64)])
instance ToPath ImportKeyPair where
toPath = const "/"
instance ToQuery ImportKeyPair where
toQuery = const mempty
data ImportKeyPairResponse = ImportKeyPairResponse'
{ _ikprsOperation :: !(Maybe Operation)
, _ikprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
importKeyPairResponse
:: Int
-> ImportKeyPairResponse
importKeyPairResponse pResponseStatus_ =
ImportKeyPairResponse'
{_ikprsOperation = Nothing, _ikprsResponseStatus = pResponseStatus_}
ikprsOperation :: Lens' ImportKeyPairResponse (Maybe Operation)
ikprsOperation = lens _ikprsOperation (\ s a -> s{_ikprsOperation = a})
ikprsResponseStatus :: Lens' ImportKeyPairResponse Int
ikprsResponseStatus = lens _ikprsResponseStatus (\ s a -> s{_ikprsResponseStatus = a})
instance NFData ImportKeyPairResponse where