Connecting Amazon Q Business to GoogleDrive using APIs
You use the CreateDataSource action to connect a data source to your Amazon Q application.
Then, you use the
configuration
parameter to provide a JSON schema with all other configuration
information specific to your data source connector.
For an example of the API request, see CreateDataSource in the Amazon Q API Reference.
Google Drive JSON schema
The following is the Google Drive JSON schema:
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "connectionConfiguration": { "type": "object", "properties": { "repositoryEndpointMetadata": { "type": "object", "properties": { "authType": { "type": "string", "enum": [ "serviceAccount", "OAuth2" ] } }, "required": [ "authType" ] } }, "required": [ "repositoryEndpointMetadata" ] }, "repositoryConfigurations": { "type": "object", "properties": { "file": { "type": "object", "properties": { "fieldMappings": { "type": "array", "items": [ { "type": "object", "properties": { "indexFieldName": { "type": "string" }, "indexFieldType": { "type": "string", "enum": [ "STRING", "DATE", "STRING_LIST", "LONG" ] }, "dataSourceFieldName": { "type": "string" }, "dateFieldFormat": { "type": "string", "pattern": "yyyy-MM-dd'T'HH:mm:ss'Z'" } }, "required": [ "indexFieldName", "indexFieldType", "dataSourceFieldName" ] } ] } }, "required": [ "fieldMappings" ] }, "comment": { "type": "object", "properties": { "fieldMappings": { "type": "array", "items": [ { "type": "object", "properties": { "indexFieldName": { "type": "string" }, "indexFieldType": { "type": "string", "enum": [ "STRING", "DATE", "STRING_LIST" ] }, "dataSourceFieldName": { "type": "string" }, "dateFieldFormat": { "type": "string", "pattern": "yyyy-MM-dd'T'HH:mm:ss'Z'" } }, "required": [ "indexFieldName", "indexFieldType", "dataSourceFieldName" ] } ] } }, "required": [ "fieldMappings" ] } } }, "additionalProperties": { "type": "object", "properties": { "maxFileSizeInMegaBytes": { "type": "string" }, "isCrawlComment": { "type": "boolean" }, "isCrawlMyDriveAndSharedWithMe": { "type": "boolean" }, "isCrawlSharedDrives": { "type": "boolean" }, "isCrawlAcl": { "type": "boolean" }, "fieldForUserId": { "type": "string" }, "excludeUserAccounts": { "type": "array", "items": { "type": "string" } }, "excludeSharedDrives": { "type": "array", "items": { "type": "string" } }, "excludeMimeTypes": { "type": "array", "items": { "type": "string" } }, "includeUserAccounts": { "type": "array", "items": { "type": "string" } }, "includeSharedDrives": { "type": "array", "items": { "type": "string" } }, "includeMimeTypes": { "type": "array", "items": { "type": "string" } }, "includeTargetAudienceGroup": { "type": "array", "items": { "type": "string" } }, "inclusionFileTypePatterns": { "type": "array", "items": { "type": "string" } }, "inclusionFileNamePatterns": { "type": "array", "items": { "type": "string" } }, "exclusionFileTypePatterns": { "type": "array", "items": { "type": "string" } }, "exclusionFileNamePatterns": { "type": "array", "items": { "type": "string" } }, "inclusionFilePathFilter": { "type": "array", "items": { "type": "string" } }, "exclusionFilePathFilter": { "type": "array", "items": { "type": "string" } } } }, "type": { "type": "string", "enum": [ "GOOGLEDRIVEV2", "GOOGLEDRIVE" ] }, "enableIdentityCrawler": { "type": "boolean" }, "syncMode": { "type": "string", "enum": [ "FORCED_FULL_CRAWL", "FULL_CRAWL", "CHANGE_LOG" ] }, "secretArn": { "type": "string", "minLength": 20, "maxLength": 2048 } }, "version": { "type": "string", "anyOf": [ { "pattern": "1.0.0" } ] }, "required": [ "connectionConfiguration", "repositoryConfigurations", "syncMode", "additionalProperties", "secretArn", "type" ] }
The following table provides information about important JSON keys to configure.
Configuration | Description |
---|---|
connectionConfiguration |
Configuration information for the data source. |
repositoryEndpointMetadata |
The endpoint information for the data source. This data source doesn't specify an
endpoint. You choose your authentication type: serviceAccount and
OAuth2 . The connection information is included in an AWS Secrets Manager secret that you provide the secretArn . |
authType |
Choose between serviceAccount and OAuth2 , based on your
use case. |
repositoryConfigurations |
Configuration information for the content of the data source. For example, configuring specific types of content and field mappings. |
|
A list of objects that map the attributes or field names of your Google Drive to Amazon Q index field names. |
additionalProperties |
Additional configuration options for your content in your data source |
isCrawlAcl |
Specify true to crawl access control information by default from
documents. NoteAmazon Q Business crawls ACL information to ensure responses are generated only from documents your end users have access to. See Authorization for more details. |
fieldForUserId |
Specify field to use for UserId for ACL crawling. |
maxFileSizeInMegaBytes |
Specify the maximum single file size limit in MBs that Amazon Q will crawl. Amazon Q will crawl only the files within the size limit you define. The default file size is 50MB. The maximum file size should be greater than 0MB and less than or equal to 50MB. |
|
true to index comments in your Google Drive data
source. |
|
true to index MyDrive and Shared With Me Drives in your Google
Drive data source. |
|
true to index Shared Drives in your Google Drive data
source. |
|
A list of regular expression patterns to exclude specific files in your Google Drive data source. Files that match the patterns are excluded from the index. Files that don't match the patterns are included in the index. If a file matches both an exclusion and inclusion pattern, the exclusion pattern takes precedence, and the file isn't included in the index. |
|
A list of regular expression patterns to include specific files in your Google Drive data source. Files that match the patterns are included in the index. Files that don't match the patterns are excluded from the index. If a file matches both an inclusion and exclusion pattern, the exclusion pattern takes precedence, and the file isn't included in the index. |
type |
The type of data source. Specify GOOOGLEDRIVEV2 as your data source
type. |
enableIdentityCrawler |
true to activate identity crawler. Identity crawler is activated by
default. Crawling identity information on users and groups with access to certain
documents is useful for user context filtering. Search results are filtered based on the
user or their group access to documents. NoteAmazon Q Business crawls identity information from your data source by default to ensure responses are generated only from documents end users have access to. For more information, see Identity crawler. |
syncMode |
Specify whether Amazon Q should update your index by syncing all
documents or only new, modified, and deleted documents. You can choose between the
following options:
|
secretARN |
The Amazon Resource Name (ARN) of an AWS Secrets Manager secret that contains
the key-value pairs required to connect to your Google Drive. The secret
must contain a JSON structure with the following keys: If using Google Service Account authentication:
If using OAuth 2.0 authentication:
|
version |
The version of this template that's currently supported. |