createAssistant method
Creates an Amazon Connect Wisdom assistant.
May throw AccessDeniedException.
May throw ConflictException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter name :
The name of the assistant.
Parameter type :
The type of assistant.
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 description :
The description of the assistant.
Parameter serverSideEncryptionConfiguration :
The configuration information for the customer managed key used for
encryption.
The customer managed key must have a policy that allows
kms:CreateGrant, kms:DescribeKey, and
kms:Decrypt/kms:GenerateDataKey permissions to the IAM
identity using the key to invoke Wisdom. To use Wisdom with chat, the key
policy must also allow kms:Decrypt,
kms:GenerateDataKey*, and kms:DescribeKey
permissions to the connect.amazonaws.com service principal.
For more information about setting up a customer managed key for Wisdom, see Enable Amazon Connect Wisdom for your instance.
Parameter tags :
The tags used to organize, track, or control access for this resource.
Implementation
Future<CreateAssistantResponse> createAssistant({
required String name,
required AssistantType type,
String? clientToken,
String? description,
ServerSideEncryptionConfiguration? serverSideEncryptionConfiguration,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'name': name,
'type': type.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (serverSideEncryptionConfiguration != null)
'serverSideEncryptionConfiguration': serverSideEncryptionConfiguration,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/assistants',
exceptionFnMap: _exceptionFns,
);
return CreateAssistantResponse.fromJson(response);
}