deleteDBCluster method

Future<DeleteDBClusterResult> deleteDBCluster({
  1. required String dBClusterIdentifier,
  2. String? finalDBSnapshotIdentifier,
  3. bool? skipFinalSnapshot,
})

The DeleteDBCluster action deletes a previously provisioned DB cluster. When you delete a DB cluster, all automated backups for that DB cluster are deleted and can't be recovered. Manual DB cluster snapshots of the specified DB cluster are not deleted.

Note that the DB Cluster cannot be deleted if deletion protection is enabled. To delete it, you must first set its DeletionProtection field to False.

May throw DBClusterNotFoundFault. May throw InvalidDBClusterStateFault. May throw DBClusterSnapshotAlreadyExistsFault. May throw SnapshotQuotaExceededFault. May throw InvalidDBClusterSnapshotStateFault.

Parameter dBClusterIdentifier : The DB cluster identifier for the DB cluster to be deleted. This parameter isn't case-sensitive.

Constraints:

  • Must match an existing DBClusterIdentifier.

Parameter finalDBSnapshotIdentifier : The DB cluster snapshot identifier of the new DB cluster snapshot created when SkipFinalSnapshot is set to false. Constraints:

  • Must be 1 to 255 letters, numbers, or hyphens.
  • First character must be a letter
  • Cannot end with a hyphen or contain two consecutive hyphens

Parameter skipFinalSnapshot : Determines whether a final DB cluster snapshot is created before the DB cluster is deleted. If true is specified, no DB cluster snapshot is created. If false is specified, a DB cluster snapshot is created before the DB cluster is deleted. Default: false

Implementation

Future<DeleteDBClusterResult> deleteDBCluster({
  required String dBClusterIdentifier,
  String? finalDBSnapshotIdentifier,
  bool? skipFinalSnapshot,
}) async {
  ArgumentError.checkNotNull(dBClusterIdentifier, 'dBClusterIdentifier');
  final $request = <String, dynamic>{};
  $request['DBClusterIdentifier'] = dBClusterIdentifier;
  finalDBSnapshotIdentifier
      ?.also((arg) => $request['FinalDBSnapshotIdentifier'] = arg);
  skipFinalSnapshot?.also((arg) => $request['SkipFinalSnapshot'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'DeleteDBCluster',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DeleteDBClusterMessage'],
    shapes: shapes,
    resultWrapper: 'DeleteDBClusterResult',
  );
  return DeleteDBClusterResult.fromXml($result);
}