{-# 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.CreateBackup
(
createBackup
, CreateBackup
, cbTableName
, cbBackupName
, createBackupResponse
, CreateBackupResponse
, cbrsBackupDetails
, cbrsResponseStatus
) 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 CreateBackup = CreateBackup'
{ _cbTableName :: !Text
, _cbBackupName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createBackup
:: Text
-> Text
-> CreateBackup
createBackup pTableName_ pBackupName_ =
CreateBackup' {_cbTableName = pTableName_, _cbBackupName = pBackupName_}
cbTableName :: Lens' CreateBackup Text
cbTableName = lens _cbTableName (\ s a -> s{_cbTableName = a})
cbBackupName :: Lens' CreateBackup Text
cbBackupName = lens _cbBackupName (\ s a -> s{_cbBackupName = a})
instance AWSRequest CreateBackup where
type Rs CreateBackup = CreateBackupResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
CreateBackupResponse' <$>
(x .?> "BackupDetails") <*> (pure (fromEnum s)))
instance Hashable CreateBackup where
instance NFData CreateBackup where
instance ToHeaders CreateBackup where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.CreateBackup" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON CreateBackup where
toJSON CreateBackup'{..}
= object
(catMaybes
[Just ("TableName" .= _cbTableName),
Just ("BackupName" .= _cbBackupName)])
instance ToPath CreateBackup where
toPath = const "/"
instance ToQuery CreateBackup where
toQuery = const mempty
data CreateBackupResponse = CreateBackupResponse'
{ _cbrsBackupDetails :: !(Maybe BackupDetails)
, _cbrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createBackupResponse
:: Int
-> CreateBackupResponse
createBackupResponse pResponseStatus_ =
CreateBackupResponse'
{_cbrsBackupDetails = Nothing, _cbrsResponseStatus = pResponseStatus_}
cbrsBackupDetails :: Lens' CreateBackupResponse (Maybe BackupDetails)
cbrsBackupDetails = lens _cbrsBackupDetails (\ s a -> s{_cbrsBackupDetails = a})
cbrsResponseStatus :: Lens' CreateBackupResponse Int
cbrsResponseStatus = lens _cbrsResponseStatus (\ s a -> s{_cbrsResponseStatus = a})
instance NFData CreateBackupResponse where