{-# 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.DeleteKeyPair
(
deleteKeyPair
, DeleteKeyPair
, dkpKeyPairName
, deleteKeyPairResponse
, DeleteKeyPairResponse
, dkprsOperation
, dkprsResponseStatus
) 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 DeleteKeyPair = DeleteKeyPair'
{ _dkpKeyPairName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
deleteKeyPair
:: Text
-> DeleteKeyPair
deleteKeyPair pKeyPairName_ = DeleteKeyPair' {_dkpKeyPairName = pKeyPairName_}
dkpKeyPairName :: Lens' DeleteKeyPair Text
dkpKeyPairName = lens _dkpKeyPairName (\ s a -> s{_dkpKeyPairName = a})
instance AWSRequest DeleteKeyPair where
type Rs DeleteKeyPair = DeleteKeyPairResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
DeleteKeyPairResponse' <$>
(x .?> "operation") <*> (pure (fromEnum s)))
instance Hashable DeleteKeyPair where
instance NFData DeleteKeyPair where
instance ToHeaders DeleteKeyPair where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.DeleteKeyPair" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DeleteKeyPair where
toJSON DeleteKeyPair'{..}
= object
(catMaybes [Just ("keyPairName" .= _dkpKeyPairName)])
instance ToPath DeleteKeyPair where
toPath = const "/"
instance ToQuery DeleteKeyPair where
toQuery = const mempty
data DeleteKeyPairResponse = DeleteKeyPairResponse'
{ _dkprsOperation :: !(Maybe Operation)
, _dkprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
deleteKeyPairResponse
:: Int
-> DeleteKeyPairResponse
deleteKeyPairResponse pResponseStatus_ =
DeleteKeyPairResponse'
{_dkprsOperation = Nothing, _dkprsResponseStatus = pResponseStatus_}
dkprsOperation :: Lens' DeleteKeyPairResponse (Maybe Operation)
dkprsOperation = lens _dkprsOperation (\ s a -> s{_dkprsOperation = a})
dkprsResponseStatus :: Lens' DeleteKeyPairResponse Int
dkprsResponseStatus = lens _dkprsResponseStatus (\ s a -> s{_dkprsResponseStatus = a})
instance NFData DeleteKeyPairResponse where