exportTableToPointInTime method

Future<ExportTableToPointInTimeOutput> exportTableToPointInTime({
  1. required String s3Bucket,
  2. required String tableArn,
  3. String? clientToken,
  4. ExportFormat? exportFormat,
  5. DateTime? exportTime,
  6. String? s3BucketOwner,
  7. String? s3Prefix,
  8. S3SseAlgorithm? s3SseAlgorithm,
  9. String? s3SseKmsKeyId,
})

Exports table data to an S3 bucket. The table must have point in time recovery enabled, and you can export data from any time within the point in time recovery window.

May throw TableNotFoundException. May throw PointInTimeRecoveryUnavailableException. May throw LimitExceededException. May throw InvalidExportTimeException. May throw ExportConflictException. May throw InternalServerError.

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

Parameter tableArn : The Amazon Resource Name (ARN) associated with the table to export.

Parameter clientToken : Providing a ClientToken makes the call to ExportTableToPointInTimeInput idempotent, meaning that multiple identical calls have the same effect as one single call.

A client token is valid for 8 hours after the first request that uses it is completed. After 8 hours, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 8 hours, or the result might not be idempotent.

If you submit a request with the same client token but a change in other parameters within the 8-hour idempotency window, DynamoDB returns an IdempotentParameterMismatch exception.

Parameter exportFormat : The format for the exported data. Valid values for ExportFormat are DYNAMODB_JSON or ION.

Parameter exportTime : Time in the past from which to export table data. The table export will be a snapshot of the table's state at this point in time.

Parameter s3BucketOwner : The ID of the AWS account that owns the bucket the export will be stored in.

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

Parameter s3SseAlgorithm : Type of encryption used on the bucket where export data will be stored. Valid values for S3SseAlgorithm are:

  • AES256 - server-side encryption with Amazon S3 managed keys
  • KMS - server-side encryption with AWS KMS managed keys

Parameter s3SseKmsKeyId : The ID of the AWS KMS managed key used to encrypt the S3 bucket where export data will be stored (if applicable).

Implementation

Future<ExportTableToPointInTimeOutput> exportTableToPointInTime({
  required String s3Bucket,
  required String tableArn,
  String? clientToken,
  ExportFormat? exportFormat,
  DateTime? exportTime,
  String? s3BucketOwner,
  String? s3Prefix,
  S3SseAlgorithm? s3SseAlgorithm,
  String? s3SseKmsKeyId,
}) async {
  ArgumentError.checkNotNull(s3Bucket, 's3Bucket');
  ArgumentError.checkNotNull(tableArn, 'tableArn');
  _s.validateStringLength(
    's3SseKmsKeyId',
    s3SseKmsKeyId,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'DynamoDB_20120810.ExportTableToPointInTime'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'S3Bucket': s3Bucket,
      'TableArn': tableArn,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (exportFormat != null) 'ExportFormat': exportFormat.toValue(),
      if (exportTime != null) 'ExportTime': unixTimestampToJson(exportTime),
      if (s3BucketOwner != null) 'S3BucketOwner': s3BucketOwner,
      if (s3Prefix != null) 'S3Prefix': s3Prefix,
      if (s3SseAlgorithm != null) 'S3SseAlgorithm': s3SseAlgorithm.toValue(),
      if (s3SseKmsKeyId != null) 'S3SseKmsKeyId': s3SseKmsKeyId,
    },
  );

  return ExportTableToPointInTimeOutput.fromJson(jsonResponse.body);
}