createDataTableAttribute method
Adds an attribute to an existing data table. Creating a new primary attribute uses the empty value for the specified value type for all existing records. This should not affect uniqueness of published data tables since the existing primary values will already be unique. Creating attributes does not create any values. System managed tables may not allow customers to create new attributes.
May throw AccessDeniedException.
May throw ConflictException.
May throw DuplicateResourceException.
May throw InternalServiceException.
May throw InvalidParameterException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
Parameter dataTableId :
The unique identifier for the data table. Must also accept the table ARN
with or without a version alias. If the version is provided as part of the
identifier or ARN, the version must be one of the two available system
managed aliases, $SAVED or $LATEST.
Parameter instanceId :
The unique identifier for the Amazon Connect instance.
Parameter name :
The name for the attribute. Must conform to Connect human readable string
specification and have 1-127 characters. Must not start with the reserved
case insensitive values 'connect:' and 'aws:'. Whitespace trimmed before
persisting. Must be unique for the data table using case-insensitive
comparison.
Parameter valueType :
The type of value allowed or the resultant type after the value's
expression is evaluated. Must be one of TEXT, TEXT_LIST, NUMBER,
NUMBER_LIST, and BOOLEAN.
Parameter description :
An optional description for the attribute. Must conform to Connect human
readable string specification and have 0-250 characters. Whitespace
trimmed before persisting.
Parameter primary :
Optional boolean that defaults to false. Determines if the value is used
to identify a record in the table. Values for primary attributes must not
be expressions.
Parameter validation :
Optional validation rules for the attribute. Borrows heavily from JSON
Schema - Draft 2020-12. The maximum length of arrays within validations
and depth of validations is 5. There are default limits that apply to all
types. Customer specified limits in excess of the default limits are not
permitted.
Implementation
Future<CreateDataTableAttributeResponse> createDataTableAttribute({
required String dataTableId,
required String instanceId,
required String name,
required DataTableAttributeValueType valueType,
String? description,
bool? primary,
Validation? validation,
}) async {
final $payload = <String, dynamic>{
'Name': name,
'ValueType': valueType.value,
if (description != null) 'Description': description,
if (primary != null) 'Primary': primary,
if (validation != null) 'Validation': validation,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/data-tables/${Uri.encodeComponent(instanceId)}/${Uri.encodeComponent(dataTableId)}/attributes',
exceptionFnMap: _exceptionFns,
);
return CreateDataTableAttributeResponse.fromJson(response);
}