{-# 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.GetKeyPair
(
getKeyPair
, GetKeyPair
, gkpKeyPairName
, getKeyPairResponse
, GetKeyPairResponse
, gkprsKeyPair
, gkprsResponseStatus
) 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
newtype GetKeyPair = GetKeyPair'
{ _gkpKeyPairName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getKeyPair
:: Text
-> GetKeyPair
getKeyPair pKeyPairName_ = GetKeyPair' {_gkpKeyPairName = pKeyPairName_}
gkpKeyPairName :: Lens' GetKeyPair Text
gkpKeyPairName = lens _gkpKeyPairName (\ s a -> s{_gkpKeyPairName = a})
instance AWSRequest GetKeyPair where
type Rs GetKeyPair = GetKeyPairResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
GetKeyPairResponse' <$>
(x .?> "keyPair") <*> (pure (fromEnum s)))
instance Hashable GetKeyPair where
instance NFData GetKeyPair where
instance ToHeaders GetKeyPair where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.GetKeyPair" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetKeyPair where
toJSON GetKeyPair'{..}
= object
(catMaybes [Just ("keyPairName" .= _gkpKeyPairName)])
instance ToPath GetKeyPair where
toPath = const "/"
instance ToQuery GetKeyPair where
toQuery = const mempty
data GetKeyPairResponse = GetKeyPairResponse'
{ _gkprsKeyPair :: !(Maybe KeyPair)
, _gkprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getKeyPairResponse
:: Int
-> GetKeyPairResponse
getKeyPairResponse pResponseStatus_ =
GetKeyPairResponse'
{_gkprsKeyPair = Nothing, _gkprsResponseStatus = pResponseStatus_}
gkprsKeyPair :: Lens' GetKeyPairResponse (Maybe KeyPair)
gkprsKeyPair = lens _gkprsKeyPair (\ s a -> s{_gkprsKeyPair = a})
gkprsResponseStatus :: Lens' GetKeyPairResponse Int
gkprsResponseStatus = lens _gkprsResponseStatus (\ s a -> s{_gkprsResponseStatus = a})
instance NFData GetKeyPairResponse where