{-# 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.UpdateGlobalTable
(
updateGlobalTable
, UpdateGlobalTable
, ugtGlobalTableName
, ugtReplicaUpdates
, updateGlobalTableResponse
, UpdateGlobalTableResponse
, ugtrsGlobalTableDescription
, ugtrsResponseStatus
) 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 UpdateGlobalTable = UpdateGlobalTable'
{ _ugtGlobalTableName :: !Text
, _ugtReplicaUpdates :: ![ReplicaUpdate]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGlobalTable
:: Text
-> UpdateGlobalTable
updateGlobalTable pGlobalTableName_ =
UpdateGlobalTable'
{_ugtGlobalTableName = pGlobalTableName_, _ugtReplicaUpdates = mempty}
ugtGlobalTableName :: Lens' UpdateGlobalTable Text
ugtGlobalTableName = lens _ugtGlobalTableName (\ s a -> s{_ugtGlobalTableName = a})
ugtReplicaUpdates :: Lens' UpdateGlobalTable [ReplicaUpdate]
ugtReplicaUpdates = lens _ugtReplicaUpdates (\ s a -> s{_ugtReplicaUpdates = a}) . _Coerce
instance AWSRequest UpdateGlobalTable where
type Rs UpdateGlobalTable = UpdateGlobalTableResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
UpdateGlobalTableResponse' <$>
(x .?> "GlobalTableDescription") <*>
(pure (fromEnum s)))
instance Hashable UpdateGlobalTable where
instance NFData UpdateGlobalTable where
instance ToHeaders UpdateGlobalTable where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.UpdateGlobalTable" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON UpdateGlobalTable where
toJSON UpdateGlobalTable'{..}
= object
(catMaybes
[Just ("GlobalTableName" .= _ugtGlobalTableName),
Just ("ReplicaUpdates" .= _ugtReplicaUpdates)])
instance ToPath UpdateGlobalTable where
toPath = const "/"
instance ToQuery UpdateGlobalTable where
toQuery = const mempty
data UpdateGlobalTableResponse = UpdateGlobalTableResponse'
{ _ugtrsGlobalTableDescription :: !(Maybe GlobalTableDescription)
, _ugtrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGlobalTableResponse
:: Int
-> UpdateGlobalTableResponse
updateGlobalTableResponse pResponseStatus_ =
UpdateGlobalTableResponse'
{ _ugtrsGlobalTableDescription = Nothing
, _ugtrsResponseStatus = pResponseStatus_
}
ugtrsGlobalTableDescription :: Lens' UpdateGlobalTableResponse (Maybe GlobalTableDescription)
ugtrsGlobalTableDescription = lens _ugtrsGlobalTableDescription (\ s a -> s{_ugtrsGlobalTableDescription = a})
ugtrsResponseStatus :: Lens' UpdateGlobalTableResponse Int
ugtrsResponseStatus = lens _ugtrsResponseStatus (\ s a -> s{_ugtrsResponseStatus = a})
instance NFData UpdateGlobalTableResponse where