createKnowledgeBase method

Future<CreateKnowledgeBaseResponse> createKnowledgeBase({
  1. required String awsAccountId,
  2. required String dataSourceArn,
  3. required KnowledgeBaseConfiguration knowledgeBaseConfiguration,
  4. required String knowledgeBaseId,
  5. required String name,
  6. AccessControlConfiguration? accessControlConfiguration,
  7. String? description,
  8. MediaExtractionConfiguration? mediaExtractionConfiguration,
  9. List<ResourcePermission>? permissions,
  10. String? primaryOwnerArn,
  11. List<Tag>? tags,
})

Creates a knowledge base from a specified data source. Supported data source connector types include:

  • S3_KNOWLEDGE_BASE – Uses an Amazon S3 bucket as the data source.
  • WEB_CRAWLER – Uses web pages indexed by the built-in web crawler as the data source.
  • GOOGLE_DRIVE – Uses Google Drive as the data source. Supports service account authentication only.
  • SHAREPOINT – Uses SharePoint as the data source. Supports two-legged OAuth only.
  • ONE_DRIVE – Uses OneDrive as the data source. Supports two-legged OAuth only.

May throw AccessDeniedException. May throw InternalFailureException. May throw InvalidParameterValueException. May throw InvalidRequestException. May throw LimitExceededException. May throw PreconditionNotMetException. May throw ResourceExistsException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter awsAccountId : The ID of the Amazon Web Services account that contains the knowledge base.

Parameter dataSourceArn : The Amazon Resource Name (ARN) of the data source for the knowledge base.

Parameter knowledgeBaseId : The unique identifier for the knowledge base.

Parameter name : The name of the knowledge base.

Parameter accessControlConfiguration : The access control configuration for the knowledge base. If you don't specify this parameter, document-level ACLs are disabled.

Parameter description : A description for the knowledge base. If you don't specify a description, the knowledge base is created without one.

Parameter permissions : A list of resource permissions on the knowledge base. Each entry grants a specified Amazon QuickSight principal either owner or viewer access. If you don't specify permissions, only the primary owner (if provided) receives owner access.

Parameter primaryOwnerArn : The Amazon Resource Name (ARN) of the primary owner for the knowledge base. The specified user is always granted owner access, regardless of what is specified in the Permissions field. If you don't specify a primary owner, the knowledge base is created without one.

Parameter tags : The tags to assign to the knowledge base. If you don't specify tags, the knowledge base is created without tags.

Implementation

Future<CreateKnowledgeBaseResponse> createKnowledgeBase({
  required String awsAccountId,
  required String dataSourceArn,
  required KnowledgeBaseConfiguration knowledgeBaseConfiguration,
  required String knowledgeBaseId,
  required String name,
  AccessControlConfiguration? accessControlConfiguration,
  String? description,
  MediaExtractionConfiguration? mediaExtractionConfiguration,
  List<ResourcePermission>? permissions,
  String? primaryOwnerArn,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'DataSourceArn': dataSourceArn,
    'KnowledgeBaseConfiguration': knowledgeBaseConfiguration,
    'KnowledgeBaseId': knowledgeBaseId,
    'Name': name,
    if (accessControlConfiguration != null)
      'AccessControlConfiguration': accessControlConfiguration,
    if (description != null) 'Description': description,
    if (mediaExtractionConfiguration != null)
      'MediaExtractionConfiguration': mediaExtractionConfiguration,
    if (permissions != null) 'Permissions': permissions,
    if (primaryOwnerArn != null) 'PrimaryOwnerArn': primaryOwnerArn,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v1/accounts/${Uri.encodeComponent(awsAccountId)}/knowledge-bases',
    exceptionFnMap: _exceptionFns,
  );
  return CreateKnowledgeBaseResponse.fromJson(response);
}