module Network.AWS.DynamoDB.UpdateTable
(
updateTable
, UpdateTable
, utAttributeDefinitions
, utProvisionedThroughput
, utGlobalSecondaryIndexUpdates
, utStreamSpecification
, utTableName
, updateTableResponse
, UpdateTableResponse
, utrsTableDescription
, utrsResponseStatus
) 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 UpdateTable = UpdateTable'
{ _utAttributeDefinitions :: !(Maybe [AttributeDefinition])
, _utProvisionedThroughput :: !(Maybe ProvisionedThroughput)
, _utGlobalSecondaryIndexUpdates :: !(Maybe [GlobalSecondaryIndexUpdate])
, _utStreamSpecification :: !(Maybe StreamSpecification)
, _utTableName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateTable
:: Text
-> UpdateTable
updateTable pTableName_ =
UpdateTable'
{ _utAttributeDefinitions = Nothing
, _utProvisionedThroughput = Nothing
, _utGlobalSecondaryIndexUpdates = Nothing
, _utStreamSpecification = Nothing
, _utTableName = pTableName_
}
utAttributeDefinitions :: Lens' UpdateTable [AttributeDefinition]
utAttributeDefinitions = lens _utAttributeDefinitions (\ s a -> s{_utAttributeDefinitions = a}) . _Default . _Coerce;
utProvisionedThroughput :: Lens' UpdateTable (Maybe ProvisionedThroughput)
utProvisionedThroughput = lens _utProvisionedThroughput (\ s a -> s{_utProvisionedThroughput = a});
utGlobalSecondaryIndexUpdates :: Lens' UpdateTable [GlobalSecondaryIndexUpdate]
utGlobalSecondaryIndexUpdates = lens _utGlobalSecondaryIndexUpdates (\ s a -> s{_utGlobalSecondaryIndexUpdates = a}) . _Default . _Coerce;
utStreamSpecification :: Lens' UpdateTable (Maybe StreamSpecification)
utStreamSpecification = lens _utStreamSpecification (\ s a -> s{_utStreamSpecification = a});
utTableName :: Lens' UpdateTable Text
utTableName = lens _utTableName (\ s a -> s{_utTableName = a});
instance AWSRequest UpdateTable where
type Rs UpdateTable = UpdateTableResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
UpdateTableResponse' <$>
(x .?> "TableDescription") <*> (pure (fromEnum s)))
instance Hashable UpdateTable
instance NFData UpdateTable
instance ToHeaders UpdateTable where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.UpdateTable" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON UpdateTable where
toJSON UpdateTable'{..}
= object
(catMaybes
[("AttributeDefinitions" .=) <$>
_utAttributeDefinitions,
("ProvisionedThroughput" .=) <$>
_utProvisionedThroughput,
("GlobalSecondaryIndexUpdates" .=) <$>
_utGlobalSecondaryIndexUpdates,
("StreamSpecification" .=) <$>
_utStreamSpecification,
Just ("TableName" .= _utTableName)])
instance ToPath UpdateTable where
toPath = const "/"
instance ToQuery UpdateTable where
toQuery = const mempty
data UpdateTableResponse = UpdateTableResponse'
{ _utrsTableDescription :: !(Maybe TableDescription)
, _utrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateTableResponse
:: Int
-> UpdateTableResponse
updateTableResponse pResponseStatus_ =
UpdateTableResponse'
{ _utrsTableDescription = Nothing
, _utrsResponseStatus = pResponseStatus_
}
utrsTableDescription :: Lens' UpdateTableResponse (Maybe TableDescription)
utrsTableDescription = lens _utrsTableDescription (\ s a -> s{_utrsTableDescription = a});
utrsResponseStatus :: Lens' UpdateTableResponse Int
utrsResponseStatus = lens _utrsResponseStatus (\ s a -> s{_utrsResponseStatus = a});
instance NFData UpdateTableResponse