deleteTable method
The DeleteTable
operation deletes a table and all of its
items. After a DeleteTable
request, the specified table is in
the DELETING
state until DynamoDB completes the deletion. If
the table is in the ACTIVE
state, you can delete it. If a
table is in CREATING
or UPDATING
states, then
DynamoDB returns a ResourceInUseException
. If the specified
table does not exist, DynamoDB returns a
ResourceNotFoundException
. If table is already in the
DELETING
state, no error is returned.
When you delete a table, any indexes on that table are also deleted.
If you have DynamoDB Streams enabled on the table, then the corresponding
stream on that table goes into the DISABLED
state, and the
stream is automatically deleted after 24 hours.
Use the DescribeTable
action to check the status of the
table.
May throw ResourceInUseException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw InternalServerError.
Parameter tableName
:
The name of the table to delete.
Implementation
Future<DeleteTableOutput> deleteTable({
required String tableName,
}) async {
ArgumentError.checkNotNull(tableName, 'tableName');
_s.validateStringLength(
'tableName',
tableName,
3,
255,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'DynamoDB_20120810.DeleteTable'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'TableName': tableName,
},
);
return DeleteTableOutput.fromJson(jsonResponse.body);
}