createIndex method

Future<CreateIndexResponse> createIndex({
  1. required String directoryArn,
  2. required bool isUnique,
  3. required List<AttributeKey> orderedIndexedAttributeList,
  4. String? linkName,
  5. ObjectReference? parentReference,
})

Creates an index object. See Indexing and search for more information.

May throw AccessDeniedException. May throw DirectoryNotEnabledException. May throw FacetValidationException. May throw InternalServiceException. May throw InvalidArnException. May throw LimitExceededException. May throw LinkNameAlreadyInUseException. May throw ResourceNotFoundException. May throw RetryableConflictException. May throw UnsupportedIndexTypeException. May throw ValidationException.

Parameter directoryArn : The ARN of the directory where the index should be created.

Parameter isUnique : Indicates whether the attribute that is being indexed has unique values or not.

Parameter orderedIndexedAttributeList : Specifies the attributes that should be indexed on. Currently only a single attribute is supported.

Parameter linkName : The name of the link between the parent object and the index object.

Parameter parentReference : A reference to the parent object that contains the index object.

Implementation

Future<CreateIndexResponse> createIndex({
  required String directoryArn,
  required bool isUnique,
  required List<AttributeKey> orderedIndexedAttributeList,
  String? linkName,
  ObjectReference? parentReference,
}) async {
  final headers = <String, String>{
    'x-amz-data-partition': directoryArn.toString(),
  };
  final $payload = <String, dynamic>{
    'IsUnique': isUnique,
    'OrderedIndexedAttributeList': orderedIndexedAttributeList,
    if (linkName != null) 'LinkName': linkName,
    if (parentReference != null) 'ParentReference': parentReference,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/amazonclouddirectory/2017-01-11/index',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateIndexResponse.fromJson(response);
}