deleteRelationalDatabase method
Deletes a database in Amazon Lightsail.
The delete relational database
operation supports tag-based
access control via resource tags applied to the resource identified by
relationalDatabaseName. For more information, see the Lightsail
Dev Guide.
May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.
Parameter relationalDatabaseName
:
The name of the database that you are deleting.
Parameter finalRelationalDatabaseSnapshotName
:
The name of the database snapshot created if skip final
snapshot
is false
, which is the default value for that
parameter.
Constraints:
- Must contain from 2 to 255 alphanumeric characters, or hyphens.
- The first and last character must be a letter or number.
Parameter skipFinalSnapshot
:
Determines whether a final database snapshot is created before your
database is deleted. If true
is specified, no database
snapshot is created. If false
is specified, a database
snapshot is created before your database is deleted.
You must specify the final relational database snapshot name
parameter if the skip final snapshot
parameter is
false
.
Default: false
Implementation
Future<DeleteRelationalDatabaseResult> deleteRelationalDatabase({
required String relationalDatabaseName,
String? finalRelationalDatabaseSnapshotName,
bool? skipFinalSnapshot,
}) async {
ArgumentError.checkNotNull(
relationalDatabaseName, 'relationalDatabaseName');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.DeleteRelationalDatabase'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'relationalDatabaseName': relationalDatabaseName,
if (finalRelationalDatabaseSnapshotName != null)
'finalRelationalDatabaseSnapshotName':
finalRelationalDatabaseSnapshotName,
if (skipFinalSnapshot != null) 'skipFinalSnapshot': skipFinalSnapshot,
},
);
return DeleteRelationalDatabaseResult.fromJson(jsonResponse.body);
}