{-# 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.RestoreTableToPointInTime
(
restoreTableToPointInTime
, RestoreTableToPointInTime
, rttpitUseLatestRestorableTime
, rttpitRestoreDateTime
, rttpitSourceTableName
, rttpitTargetTableName
, restoreTableToPointInTimeResponse
, RestoreTableToPointInTimeResponse
, rttpitrsTableDescription
, rttpitrsResponseStatus
) 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 RestoreTableToPointInTime = RestoreTableToPointInTime'
{ _rttpitUseLatestRestorableTime :: !(Maybe Bool)
, _rttpitRestoreDateTime :: !(Maybe POSIX)
, _rttpitSourceTableName :: !Text
, _rttpitTargetTableName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
restoreTableToPointInTime
:: Text
-> Text
-> RestoreTableToPointInTime
restoreTableToPointInTime pSourceTableName_ pTargetTableName_ =
RestoreTableToPointInTime'
{ _rttpitUseLatestRestorableTime = Nothing
, _rttpitRestoreDateTime = Nothing
, _rttpitSourceTableName = pSourceTableName_
, _rttpitTargetTableName = pTargetTableName_
}
rttpitUseLatestRestorableTime :: Lens' RestoreTableToPointInTime (Maybe Bool)
rttpitUseLatestRestorableTime = lens _rttpitUseLatestRestorableTime (\ s a -> s{_rttpitUseLatestRestorableTime = a})
rttpitRestoreDateTime :: Lens' RestoreTableToPointInTime (Maybe UTCTime)
rttpitRestoreDateTime = lens _rttpitRestoreDateTime (\ s a -> s{_rttpitRestoreDateTime = a}) . mapping _Time
rttpitSourceTableName :: Lens' RestoreTableToPointInTime Text
rttpitSourceTableName = lens _rttpitSourceTableName (\ s a -> s{_rttpitSourceTableName = a})
rttpitTargetTableName :: Lens' RestoreTableToPointInTime Text
rttpitTargetTableName = lens _rttpitTargetTableName (\ s a -> s{_rttpitTargetTableName = a})
instance AWSRequest RestoreTableToPointInTime where
type Rs RestoreTableToPointInTime =
RestoreTableToPointInTimeResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
RestoreTableToPointInTimeResponse' <$>
(x .?> "TableDescription") <*> (pure (fromEnum s)))
instance Hashable RestoreTableToPointInTime where
instance NFData RestoreTableToPointInTime where
instance ToHeaders RestoreTableToPointInTime where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.RestoreTableToPointInTime" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON RestoreTableToPointInTime where
toJSON RestoreTableToPointInTime'{..}
= object
(catMaybes
[("UseLatestRestorableTime" .=) <$>
_rttpitUseLatestRestorableTime,
("RestoreDateTime" .=) <$> _rttpitRestoreDateTime,
Just ("SourceTableName" .= _rttpitSourceTableName),
Just ("TargetTableName" .= _rttpitTargetTableName)])
instance ToPath RestoreTableToPointInTime where
toPath = const "/"
instance ToQuery RestoreTableToPointInTime where
toQuery = const mempty
data RestoreTableToPointInTimeResponse = RestoreTableToPointInTimeResponse'
{ _rttpitrsTableDescription :: !(Maybe TableDescription)
, _rttpitrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
restoreTableToPointInTimeResponse
:: Int
-> RestoreTableToPointInTimeResponse
restoreTableToPointInTimeResponse pResponseStatus_ =
RestoreTableToPointInTimeResponse'
{ _rttpitrsTableDescription = Nothing
, _rttpitrsResponseStatus = pResponseStatus_
}
rttpitrsTableDescription :: Lens' RestoreTableToPointInTimeResponse (Maybe TableDescription)
rttpitrsTableDescription = lens _rttpitrsTableDescription (\ s a -> s{_rttpitrsTableDescription = a})
rttpitrsResponseStatus :: Lens' RestoreTableToPointInTimeResponse Int
rttpitrsResponseStatus = lens _rttpitrsResponseStatus (\ s a -> s{_rttpitrsResponseStatus = a})
instance NFData RestoreTableToPointInTimeResponse
where