createAssistantAssociation method
Creates an association between an Amazon Q in Connect 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 Amazon Q in Connect 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);
}