stopDBInstance method

Future<StopDBInstanceResult> stopDBInstance({
  1. required String dBInstanceIdentifier,
  2. String? dBSnapshotIdentifier,
})

Stops an Amazon RDS DB instance. When you stop a DB instance, Amazon RDS retains the DB instance's metadata, including its endpoint, DB parameter group, and option group membership. Amazon RDS also retains the transaction logs so you can do a point-in-time restore if necessary.

For more information, see Stopping an Amazon RDS DB Instance Temporarily in the Amazon RDS User Guide.

May throw DBInstanceNotFoundFault. May throw InvalidDBInstanceStateFault. May throw DBSnapshotAlreadyExistsFault. May throw SnapshotQuotaExceededFault. May throw InvalidDBClusterStateFault.

Parameter dBInstanceIdentifier : The user-supplied instance identifier.

Parameter dBSnapshotIdentifier : The user-supplied instance identifier of the DB Snapshot created immediately before the DB instance is stopped.

Implementation

Future<StopDBInstanceResult> stopDBInstance({
  required String dBInstanceIdentifier,
  String? dBSnapshotIdentifier,
}) async {
  ArgumentError.checkNotNull(dBInstanceIdentifier, 'dBInstanceIdentifier');
  final $request = <String, dynamic>{};
  $request['DBInstanceIdentifier'] = dBInstanceIdentifier;
  dBSnapshotIdentifier?.also((arg) => $request['DBSnapshotIdentifier'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'StopDBInstance',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['StopDBInstanceMessage'],
    shapes: shapes,
    resultWrapper: 'StopDBInstanceResult',
  );
  return StopDBInstanceResult.fromXml($result);
}