createAssistantAssociation method

Future<CreateAssistantAssociationResponse> createAssistantAssociation({
  1. required String assistantId,
  2. required AssistantAssociationInputData association,
  3. required AssociationType associationType,
  4. String? clientToken,
  5. Map<String, String>? tags,
})

Creates an association between an Amazon Connect Wisdom assistant and another resource. Currently, the only supported association is with a knowledge base. An assistant can have only a single association.

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

Parameter assistantId : The identifier of the Wisdom assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.

Parameter association : The identifier of the associated resource.

Parameter associationType : The type of association.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

Parameter tags : The tags used to organize, track, or control access for this resource.

Implementation

Future<CreateAssistantAssociationResponse> createAssistantAssociation({
  required String assistantId,
  required AssistantAssociationInputData association,
  required AssociationType associationType,
  String? clientToken,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'association': association,
    'associationType': associationType.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/assistants/${Uri.encodeComponent(assistantId)}/associations',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAssistantAssociationResponse.fromJson(response);
}