createTable method

Future<CreateTableResponse> createTable({
  1. required String databaseName,
  2. required String tableName,
  3. MagneticStoreWriteProperties? magneticStoreWriteProperties,
  4. RetentionProperties? retentionProperties,
  5. Schema? schema,
  6. List<Tag>? tags,
})

Adds a new table to an existing database in your account. In an Amazon Web Services account, table names must be at least unique within each Region if they are in the same database. You might have identical table names in the same Region if the tables are in separate databases. While creating the table, you must specify the table name, database name, and the retention properties. Service quotas apply. See code sample for details.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw InvalidEndpointException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter databaseName : The name of the Timestream database.

Parameter tableName : The name of the Timestream table.

Parameter magneticStoreWriteProperties : Contains properties to set on the table when enabling magnetic store writes.

Parameter retentionProperties : The duration for which your time-series data must be stored in the memory store and the magnetic store.

Parameter schema : The schema of the table.

Parameter tags : A list of key-value pairs to label the table.

Implementation

Future<CreateTableResponse> createTable({
  required String databaseName,
  required String tableName,
  MagneticStoreWriteProperties? magneticStoreWriteProperties,
  RetentionProperties? retentionProperties,
  Schema? schema,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'Timestream_20181101.CreateTable'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatabaseName': databaseName,
      'TableName': tableName,
      if (magneticStoreWriteProperties != null)
        'MagneticStoreWriteProperties': magneticStoreWriteProperties,
      if (retentionProperties != null)
        'RetentionProperties': retentionProperties,
      if (schema != null) 'Schema': schema,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateTableResponse.fromJson(jsonResponse.body);
}