{-# 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.DynamoDB.RestoreTableFromBackup
(
restoreTableFromBackup
, RestoreTableFromBackup
, rtfbTargetTableName
, rtfbBackupARN
, restoreTableFromBackupResponse
, RestoreTableFromBackupResponse
, rtfbrsTableDescription
, rtfbrsResponseStatus
) where
import Network.AWS.DynamoDB.Types
import Network.AWS.DynamoDB.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data RestoreTableFromBackup = RestoreTableFromBackup'
{ _rtfbTargetTableName :: !Text
, _rtfbBackupARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
restoreTableFromBackup
:: Text
-> Text
-> RestoreTableFromBackup
restoreTableFromBackup pTargetTableName_ pBackupARN_ =
RestoreTableFromBackup'
{_rtfbTargetTableName = pTargetTableName_, _rtfbBackupARN = pBackupARN_}
rtfbTargetTableName :: Lens' RestoreTableFromBackup Text
rtfbTargetTableName = lens _rtfbTargetTableName (\ s a -> s{_rtfbTargetTableName = a})
rtfbBackupARN :: Lens' RestoreTableFromBackup Text
rtfbBackupARN = lens _rtfbBackupARN (\ s a -> s{_rtfbBackupARN = a})
instance AWSRequest RestoreTableFromBackup where
type Rs RestoreTableFromBackup =
RestoreTableFromBackupResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
RestoreTableFromBackupResponse' <$>
(x .?> "TableDescription") <*> (pure (fromEnum s)))
instance Hashable RestoreTableFromBackup where
instance NFData RestoreTableFromBackup where
instance ToHeaders RestoreTableFromBackup where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.RestoreTableFromBackup" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON RestoreTableFromBackup where
toJSON RestoreTableFromBackup'{..}
= object
(catMaybes
[Just ("TargetTableName" .= _rtfbTargetTableName),
Just ("BackupArn" .= _rtfbBackupARN)])
instance ToPath RestoreTableFromBackup where
toPath = const "/"
instance ToQuery RestoreTableFromBackup where
toQuery = const mempty
data RestoreTableFromBackupResponse = RestoreTableFromBackupResponse'
{ _rtfbrsTableDescription :: !(Maybe TableDescription)
, _rtfbrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
restoreTableFromBackupResponse
:: Int
-> RestoreTableFromBackupResponse
restoreTableFromBackupResponse pResponseStatus_ =
RestoreTableFromBackupResponse'
{ _rtfbrsTableDescription = Nothing
, _rtfbrsResponseStatus = pResponseStatus_
}
rtfbrsTableDescription :: Lens' RestoreTableFromBackupResponse (Maybe TableDescription)
rtfbrsTableDescription = lens _rtfbrsTableDescription (\ s a -> s{_rtfbrsTableDescription = a})
rtfbrsResponseStatus :: Lens' RestoreTableFromBackupResponse Int
rtfbrsResponseStatus = lens _rtfbrsResponseStatus (\ s a -> s{_rtfbrsResponseStatus = a})
instance NFData RestoreTableFromBackupResponse where