{-# 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.UpdateGlobalTableSettings
(
updateGlobalTableSettings
, UpdateGlobalTableSettings
, ugtsGlobalTableProvisionedWriteCapacityUnits
, ugtsReplicaSettingsUpdate
, ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate
, ugtsGlobalTableName
, updateGlobalTableSettingsResponse
, UpdateGlobalTableSettingsResponse
, ugtsrsReplicaSettings
, ugtsrsGlobalTableName
, ugtsrsResponseStatus
) 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 UpdateGlobalTableSettings = UpdateGlobalTableSettings'
{ _ugtsGlobalTableProvisionedWriteCapacityUnits :: !(Maybe Nat)
, _ugtsReplicaSettingsUpdate :: !(Maybe (List1 ReplicaSettingsUpdate))
, _ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate :: !(Maybe (List1 GlobalTableGlobalSecondaryIndexSettingsUpdate))
, _ugtsGlobalTableName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGlobalTableSettings
:: Text
-> UpdateGlobalTableSettings
updateGlobalTableSettings pGlobalTableName_ =
UpdateGlobalTableSettings'
{ _ugtsGlobalTableProvisionedWriteCapacityUnits = Nothing
, _ugtsReplicaSettingsUpdate = Nothing
, _ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate = Nothing
, _ugtsGlobalTableName = pGlobalTableName_
}
ugtsGlobalTableProvisionedWriteCapacityUnits :: Lens' UpdateGlobalTableSettings (Maybe Natural)
ugtsGlobalTableProvisionedWriteCapacityUnits = lens _ugtsGlobalTableProvisionedWriteCapacityUnits (\ s a -> s{_ugtsGlobalTableProvisionedWriteCapacityUnits = a}) . mapping _Nat
ugtsReplicaSettingsUpdate :: Lens' UpdateGlobalTableSettings (Maybe (NonEmpty ReplicaSettingsUpdate))
ugtsReplicaSettingsUpdate = lens _ugtsReplicaSettingsUpdate (\ s a -> s{_ugtsReplicaSettingsUpdate = a}) . mapping _List1
ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate :: Lens' UpdateGlobalTableSettings (Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate))
ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate = lens _ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate (\ s a -> s{_ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate = a}) . mapping _List1
ugtsGlobalTableName :: Lens' UpdateGlobalTableSettings Text
ugtsGlobalTableName = lens _ugtsGlobalTableName (\ s a -> s{_ugtsGlobalTableName = a})
instance AWSRequest UpdateGlobalTableSettings where
type Rs UpdateGlobalTableSettings =
UpdateGlobalTableSettingsResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
UpdateGlobalTableSettingsResponse' <$>
(x .?> "ReplicaSettings" .!@ mempty) <*>
(x .?> "GlobalTableName")
<*> (pure (fromEnum s)))
instance Hashable UpdateGlobalTableSettings where
instance NFData UpdateGlobalTableSettings where
instance ToHeaders UpdateGlobalTableSettings where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.UpdateGlobalTableSettings" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON UpdateGlobalTableSettings where
toJSON UpdateGlobalTableSettings'{..}
= object
(catMaybes
[("GlobalTableProvisionedWriteCapacityUnits" .=) <$>
_ugtsGlobalTableProvisionedWriteCapacityUnits,
("ReplicaSettingsUpdate" .=) <$>
_ugtsReplicaSettingsUpdate,
("GlobalTableGlobalSecondaryIndexSettingsUpdate" .=)
<$>
_ugtsGlobalTableGlobalSecondaryIndexSettingsUpdate,
Just ("GlobalTableName" .= _ugtsGlobalTableName)])
instance ToPath UpdateGlobalTableSettings where
toPath = const "/"
instance ToQuery UpdateGlobalTableSettings where
toQuery = const mempty
data UpdateGlobalTableSettingsResponse = UpdateGlobalTableSettingsResponse'
{ _ugtsrsReplicaSettings :: !(Maybe [ReplicaSettingsDescription])
, _ugtsrsGlobalTableName :: !(Maybe Text)
, _ugtsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGlobalTableSettingsResponse
:: Int
-> UpdateGlobalTableSettingsResponse
updateGlobalTableSettingsResponse pResponseStatus_ =
UpdateGlobalTableSettingsResponse'
{ _ugtsrsReplicaSettings = Nothing
, _ugtsrsGlobalTableName = Nothing
, _ugtsrsResponseStatus = pResponseStatus_
}
ugtsrsReplicaSettings :: Lens' UpdateGlobalTableSettingsResponse [ReplicaSettingsDescription]
ugtsrsReplicaSettings = lens _ugtsrsReplicaSettings (\ s a -> s{_ugtsrsReplicaSettings = a}) . _Default . _Coerce
ugtsrsGlobalTableName :: Lens' UpdateGlobalTableSettingsResponse (Maybe Text)
ugtsrsGlobalTableName = lens _ugtsrsGlobalTableName (\ s a -> s{_ugtsrsGlobalTableName = a})
ugtsrsResponseStatus :: Lens' UpdateGlobalTableSettingsResponse Int
ugtsrsResponseStatus = lens _ugtsrsResponseStatus (\ s a -> s{_ugtsrsResponseStatus = a})
instance NFData UpdateGlobalTableSettingsResponse
where