{-# 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.OpsWorksCM.RestoreServer
(
restoreServer
, RestoreServer
, rsKeyPair
, rsInstanceType
, rsBackupId
, rsServerName
, restoreServerResponse
, RestoreServerResponse
, rsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.OpsWorksCM.Types
import Network.AWS.OpsWorksCM.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data RestoreServer = RestoreServer'
{ _rsKeyPair :: !(Maybe Text)
, _rsInstanceType :: !(Maybe Text)
, _rsBackupId :: !Text
, _rsServerName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
restoreServer
:: Text
-> Text
-> RestoreServer
restoreServer pBackupId_ pServerName_ =
RestoreServer'
{ _rsKeyPair = Nothing
, _rsInstanceType = Nothing
, _rsBackupId = pBackupId_
, _rsServerName = pServerName_
}
rsKeyPair :: Lens' RestoreServer (Maybe Text)
rsKeyPair = lens _rsKeyPair (\ s a -> s{_rsKeyPair = a});
rsInstanceType :: Lens' RestoreServer (Maybe Text)
rsInstanceType = lens _rsInstanceType (\ s a -> s{_rsInstanceType = a});
rsBackupId :: Lens' RestoreServer Text
rsBackupId = lens _rsBackupId (\ s a -> s{_rsBackupId = a});
rsServerName :: Lens' RestoreServer Text
rsServerName = lens _rsServerName (\ s a -> s{_rsServerName = a});
instance AWSRequest RestoreServer where
type Rs RestoreServer = RestoreServerResponse
request = postJSON opsWorksCM
response
= receiveEmpty
(\ s h x ->
RestoreServerResponse' <$> (pure (fromEnum s)))
instance Hashable RestoreServer
instance NFData RestoreServer
instance ToHeaders RestoreServer where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OpsWorksCM_V2016_11_01.RestoreServer" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON RestoreServer where
toJSON RestoreServer'{..}
= object
(catMaybes
[("KeyPair" .=) <$> _rsKeyPair,
("InstanceType" .=) <$> _rsInstanceType,
Just ("BackupId" .= _rsBackupId),
Just ("ServerName" .= _rsServerName)])
instance ToPath RestoreServer where
toPath = const "/"
instance ToQuery RestoreServer where
toQuery = const mempty
newtype RestoreServerResponse = RestoreServerResponse'
{ _rsrsResponseStatus :: Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
restoreServerResponse
:: Int
-> RestoreServerResponse
restoreServerResponse pResponseStatus_ =
RestoreServerResponse'
{ _rsrsResponseStatus = pResponseStatus_
}
rsrsResponseStatus :: Lens' RestoreServerResponse Int
rsrsResponseStatus = lens _rsrsResponseStatus (\ s a -> s{_rsrsResponseStatus = a});
instance NFData RestoreServerResponse