createIndex method

Future<CreateIndexResponse> createIndex({
  1. required String applicationId,
  2. required String displayName,
  3. IndexCapacityConfiguration? capacityConfiguration,
  4. String? clientToken,
  5. String? description,
  6. List<Tag>? tags,
  7. IndexType? type,
})

Creates an Amazon Q Business index.

To determine if index creation has completed, check the Status field returned from a call to DescribeIndex. The Status field is set to ACTIVE when the index is ready to use.

Once the index is active, you can index your documents using the BatchPutDocument API or the CreateDataSource API.

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

Parameter applicationId : The identifier of the Amazon Q Business application using the index.

Parameter displayName : A name for the Amazon Q Business index.

Parameter capacityConfiguration : The capacity units you want to provision for your index. You can add and remove capacity to fit your usage needs.

Parameter clientToken : A token that you provide to identify the request to create an index. Multiple calls to the CreateIndex API with the same client token will create only one index.

Parameter description : A description for the Amazon Q Business index.

Parameter tags : A list of key-value pairs that identify or categorize the index. You can also use tags to help control access to the index. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

Parameter type : The index type that's suitable for your needs. For more information on what's included in each type of index, see Amazon Q Business tiers.

Implementation

Future<CreateIndexResponse> createIndex({
  required String applicationId,
  required String displayName,
  IndexCapacityConfiguration? capacityConfiguration,
  String? clientToken,
  String? description,
  List<Tag>? tags,
  IndexType? type,
}) async {
  final $payload = <String, dynamic>{
    'displayName': displayName,
    if (capacityConfiguration != null)
      'capacityConfiguration': capacityConfiguration,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
    if (type != null) 'type': type.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/applications/${Uri.encodeComponent(applicationId)}/indices',
    exceptionFnMap: _exceptionFns,
  );
  return CreateIndexResponse.fromJson(response);
}