createDBSnapshot method

Future<CreateDBSnapshotResult> createDBSnapshot({
  1. required String dBInstanceIdentifier,
  2. required String dBSnapshotIdentifier,
  3. List<Tag>? tags,
})

Creates a snapshot of a DB instance. The source DB instance must be in the available or storage-optimization state.

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

Parameter dBInstanceIdentifier : The identifier of the DB instance that you want to create the snapshot of.

Constraints:

  • Must match the identifier of an existing DBInstance.

Parameter dBSnapshotIdentifier : The identifier for the DB snapshot.

Constraints:

  • Can't be null, empty, or blank
  • Must contain from 1 to 255 letters, numbers, or hyphens
  • First character must be a letter
  • Can't end with a hyphen or contain two consecutive hyphens
Example: my-snapshot-id

Implementation

Future<CreateDBSnapshotResult> createDBSnapshot({
  required String dBInstanceIdentifier,
  required String dBSnapshotIdentifier,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'DBInstanceIdentifier': dBInstanceIdentifier,
    'DBSnapshotIdentifier': dBSnapshotIdentifier,
    if (tags != null)
      if (tags.isEmpty)
        'Tags': ''
      else
        for (var i1 = 0; i1 < tags.length; i1++)
          for (var e3 in tags[i1].toQueryMap().entries)
            'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateDBSnapshot',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateDBSnapshotResult',
  );
  return CreateDBSnapshotResult.fromXml($result);
}