createKnowledgeBase method
Creates a knowledge base.
For example, you're programmatically managing your external knowledge base, and you want to add or remove one of the fields that is being ingested from Salesforce. Do the following:
- Call DeleteKnowledgeBase.
- Call DeleteDataIntegration.
- Call CreateDataIntegration to recreate the DataIntegration or a create different one.
- Call CreateKnowledgeBase.
May throw AccessDeniedException.
May throw ConflictException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter knowledgeBaseType :
The type of knowledge base. Only CUSTOM knowledge bases allow you to
upload your own content. EXTERNAL knowledge bases support integrations
with third-party systems whose content is synchronized automatically.
Parameter name :
The name of the knowledge base.
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.
Parameter renderingConfiguration :
Information about how to render the content.
Parameter serverSideEncryptionConfiguration :
The configuration information for the customer managed key used for
encryption.
This KMS 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.
For more information about setting up a customer managed key for Wisdom, see Enable Amazon Connect Wisdom for your instance.
Parameter sourceConfiguration :
The source of the knowledge base content. Only set this argument for
EXTERNAL knowledge bases.
Parameter tags :
The tags used to organize, track, or control access for this resource.
Implementation
Future<CreateKnowledgeBaseResponse> createKnowledgeBase({
required KnowledgeBaseType knowledgeBaseType,
required String name,
String? clientToken,
String? description,
RenderingConfiguration? renderingConfiguration,
ServerSideEncryptionConfiguration? serverSideEncryptionConfiguration,
SourceConfiguration? sourceConfiguration,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'knowledgeBaseType': knowledgeBaseType.value,
'name': name,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (renderingConfiguration != null)
'renderingConfiguration': renderingConfiguration,
if (serverSideEncryptionConfiguration != null)
'serverSideEncryptionConfiguration': serverSideEncryptionConfiguration,
if (sourceConfiguration != null)
'sourceConfiguration': sourceConfiguration,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/knowledgeBases',
exceptionFnMap: _exceptionFns,
);
return CreateKnowledgeBaseResponse.fromJson(response);
}