importTable method

Future<ImportTableOutput> importTable({
  1. required InputFormat inputFormat,
  2. required S3BucketSource s3BucketSource,
  3. required TableCreationParameters tableCreationParameters,
  4. String? clientToken,
  5. InputCompressionType? inputCompressionType,
  6. InputFormatOptions? inputFormatOptions,
})

Imports table data from an S3 bucket.

May throw ImportConflictException. May throw LimitExceededException. May throw ResourceInUseException.

Parameter inputFormat : The format of the source data. Valid values for ImportFormat are CSV, DYNAMODB_JSON or ION.

Parameter s3BucketSource : The S3 bucket that provides the source for the import.

Parameter tableCreationParameters : Parameters for the table to import the data into.

Parameter clientToken : Providing a ClientToken makes the call to ImportTableInput 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 inputCompressionType : Type of compression to be used on the input coming from the imported table.

Parameter inputFormatOptions : Additional properties that specify how the input is formatted,

Implementation

Future<ImportTableOutput> importTable({
  required InputFormat inputFormat,
  required S3BucketSource s3BucketSource,
  required TableCreationParameters tableCreationParameters,
  String? clientToken,
  InputCompressionType? inputCompressionType,
  InputFormatOptions? inputFormatOptions,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'DynamoDB_20120810.ImportTable'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InputFormat': inputFormat.value,
      'S3BucketSource': s3BucketSource,
      'TableCreationParameters': tableCreationParameters,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (inputCompressionType != null)
        'InputCompressionType': inputCompressionType.value,
      if (inputFormatOptions != null)
        'InputFormatOptions': inputFormatOptions,
    },
  );

  return ImportTableOutput.fromJson(jsonResponse.body);
}