startExportTask method

Future<ExportTask> startExportTask({
  1. required String exportTaskIdentifier,
  2. required String iamRoleArn,
  3. required String kmsKeyId,
  4. required String s3BucketName,
  5. required String sourceArn,
  6. List<String>? exportOnly,
  7. String? s3Prefix,
})

Starts an export of a snapshot to Amazon S3. The provided IAM role must have access to the S3 bucket.

May throw DBSnapshotNotFoundFault. May throw DBClusterSnapshotNotFoundFault. May throw ExportTaskAlreadyExistsFault. May throw InvalidS3BucketFault. May throw IamRoleNotFoundFault. May throw IamRoleMissingPermissionsFault. May throw InvalidExportOnlyFault. May throw KMSKeyNotAccessibleFault. May throw InvalidExportSourceStateFault.

Parameter exportTaskIdentifier : A unique identifier for the snapshot export task. This ID isn't an identifier for the Amazon S3 bucket where the snapshot is to be exported to.

Parameter iamRoleArn : The name of the IAM role to use for writing to the Amazon S3 bucket when exporting a snapshot.

Parameter kmsKeyId : The ID of the AWS KMS customer master key (CMK) to use to encrypt the snapshot exported to Amazon S3. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the AWS KMS customer master key (CMK). The caller of this operation must be authorized to execute the following operations. These can be set in the AWS KMS key policy:

  • GrantOperation.Encrypt
  • GrantOperation.Decrypt
  • GrantOperation.GenerateDataKey
  • GrantOperation.GenerateDataKeyWithoutPlaintext
  • GrantOperation.ReEncryptFrom
  • GrantOperation.ReEncryptTo
  • GrantOperation.CreateGrant
  • GrantOperation.DescribeKey
  • GrantOperation.RetireGrant

Parameter s3BucketName : The name of the Amazon S3 bucket to export the snapshot to.

Parameter sourceArn : The Amazon Resource Name (ARN) of the snapshot to export to Amazon S3.

Parameter exportOnly : The data to be exported from the snapshot. If this parameter is not provided, all the snapshot data is exported. Valid values are the following:

  • database - Export all the data from a specified database.
  • database.table table-name - Export a table of the snapshot. This format is valid only for RDS for MySQL, RDS for MariaDB, and Aurora MySQL.
  • database.schema schema-name - Export a database schema of the snapshot. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.
  • database.schema.table table-name - Export a table of the database schema. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.

Parameter s3Prefix : The Amazon S3 bucket prefix to use as the file name and path of the exported snapshot.

Implementation

Future<ExportTask> startExportTask({
  required String exportTaskIdentifier,
  required String iamRoleArn,
  required String kmsKeyId,
  required String s3BucketName,
  required String sourceArn,
  List<String>? exportOnly,
  String? s3Prefix,
}) async {
  ArgumentError.checkNotNull(exportTaskIdentifier, 'exportTaskIdentifier');
  ArgumentError.checkNotNull(iamRoleArn, 'iamRoleArn');
  ArgumentError.checkNotNull(kmsKeyId, 'kmsKeyId');
  ArgumentError.checkNotNull(s3BucketName, 's3BucketName');
  ArgumentError.checkNotNull(sourceArn, 'sourceArn');
  final $request = <String, dynamic>{};
  $request['ExportTaskIdentifier'] = exportTaskIdentifier;
  $request['IamRoleArn'] = iamRoleArn;
  $request['KmsKeyId'] = kmsKeyId;
  $request['S3BucketName'] = s3BucketName;
  $request['SourceArn'] = sourceArn;
  exportOnly?.also((arg) => $request['ExportOnly'] = arg);
  s3Prefix?.also((arg) => $request['S3Prefix'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'StartExportTask',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['StartExportTaskMessage'],
    shapes: shapes,
    resultWrapper: 'StartExportTaskResult',
  );
  return ExportTask.fromXml($result);
}