- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateDataSourceCommand
Creates a data source connector for an Amazon Q Business application.
CreateDataSource
is a synchronous operation. The operation returns 200 if the data source was successfully created. Otherwise, an exception is raised.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { QBusinessClient, CreateDataSourceCommand } from "@aws-sdk/client-qbusiness"; // ES Modules import
// const { QBusinessClient, CreateDataSourceCommand } = require("@aws-sdk/client-qbusiness"); // CommonJS import
const client = new QBusinessClient(config);
const input = { // CreateDataSourceRequest
applicationId: "STRING_VALUE", // required
indexId: "STRING_VALUE", // required
displayName: "STRING_VALUE", // required
configuration: "DOCUMENT_VALUE", // required
vpcConfiguration: { // DataSourceVpcConfiguration
subnetIds: [ // SubnetIds // required
"STRING_VALUE",
],
securityGroupIds: [ // SecurityGroupIds // required
"STRING_VALUE",
],
},
description: "STRING_VALUE",
tags: [ // Tags
{ // Tag
key: "STRING_VALUE", // required
value: "STRING_VALUE", // required
},
],
syncSchedule: "STRING_VALUE",
roleArn: "STRING_VALUE",
clientToken: "STRING_VALUE",
documentEnrichmentConfiguration: { // DocumentEnrichmentConfiguration
inlineConfigurations: [ // InlineDocumentEnrichmentConfigurations
{ // InlineDocumentEnrichmentConfiguration
condition: { // DocumentAttributeCondition
key: "STRING_VALUE", // required
operator: "GREATER_THAN" || "GREATER_THAN_OR_EQUALS" || "LESS_THAN" || "LESS_THAN_OR_EQUALS" || "EQUALS" || "NOT_EQUALS" || "CONTAINS" || "NOT_CONTAINS" || "EXISTS" || "NOT_EXISTS" || "BEGINS_WITH", // required
value: { // DocumentAttributeValue Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [ // DocumentAttributeStringListValue
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
target: { // DocumentAttributeTarget
key: "STRING_VALUE", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
attributeValueOperator: "DELETE",
},
documentContentOperator: "DELETE",
},
],
preExtractionHookConfiguration: { // HookConfiguration
invocationCondition: {
key: "STRING_VALUE", // required
operator: "GREATER_THAN" || "GREATER_THAN_OR_EQUALS" || "LESS_THAN" || "LESS_THAN_OR_EQUALS" || "EQUALS" || "NOT_EQUALS" || "CONTAINS" || "NOT_CONTAINS" || "EXISTS" || "NOT_EXISTS" || "BEGINS_WITH", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
lambdaArn: "STRING_VALUE",
s3BucketName: "STRING_VALUE",
roleArn: "STRING_VALUE",
},
postExtractionHookConfiguration: {
invocationCondition: {
key: "STRING_VALUE", // required
operator: "GREATER_THAN" || "GREATER_THAN_OR_EQUALS" || "LESS_THAN" || "LESS_THAN_OR_EQUALS" || "EQUALS" || "NOT_EQUALS" || "CONTAINS" || "NOT_CONTAINS" || "EXISTS" || "NOT_EXISTS" || "BEGINS_WITH", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
lambdaArn: "STRING_VALUE",
s3BucketName: "STRING_VALUE",
roleArn: "STRING_VALUE",
},
},
mediaExtractionConfiguration: { // MediaExtractionConfiguration
imageExtractionConfiguration: { // ImageExtractionConfiguration
imageExtractionStatus: "ENABLED" || "DISABLED", // required
},
},
};
const command = new CreateDataSourceCommand(input);
const response = await client.send(command);
// { // CreateDataSourceResponse
// dataSourceId: "STRING_VALUE",
// dataSourceArn: "STRING_VALUE",
// };
CreateDataSourceCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
applicationId Required | string | undefined | The identifier of the Amazon Q Business application the data source will be attached to. |
configuration Required | __DocumentType | undefined | Configuration information to connect your data source repository to Amazon Q Business. Use this parameter to provide a JSON schema with configuration information specific to your data source connector. Each data source has a JSON schema provided by Amazon Q Business that you must use. For example, the Amazon S3 and Web Crawler connectors require the following JSON schemas: You can find configuration templates for your specific data source using the following steps:
|
displayName Required | string | undefined | A name for the data source connector. |
indexId Required | string | undefined | The identifier of the index that you want to use with the data source connector. |
clientToken | string | undefined | A token you provide to identify a request to create a data source connector. Multiple calls to the |
description | string | undefined | A description for the data source connector. |
documentEnrichmentConfiguration | DocumentEnrichmentConfiguration | undefined | Provides the configuration information for altering document metadata and content during the document ingestion process. For more information, see Custom document enrichment . |
mediaExtractionConfiguration | MediaExtractionConfiguration | undefined | The configuration for extracting information from media in documents during ingestion. |
roleArn | string | undefined | The Amazon Resource Name (ARN) of an IAM role with permission to access the data source and required resources. |
syncSchedule | string | undefined | Sets the frequency for Amazon Q Business to check the documents in your data source repository and update your index. If you don't set a schedule, Amazon Q Business won't periodically update the index. Specify a |
tags | Tag[] | undefined | A list of key-value pairs that identify or categorize the data source connector. You can also use tags to help control access to the data source connector. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - . |
vpcConfiguration | DataSourceVpcConfiguration | undefined | Configuration information for an Amazon VPC (Virtual Private Cloud) to connect to your data source. For more information, see Using Amazon VPC with Amazon Q Business connectors . |
CreateDataSourceCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
dataSourceArn | string | undefined | The Amazon Resource Name (ARN) of a data source in an Amazon Q Business application. |
dataSourceId | string | undefined | The identifier of the data source connector. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again. |
ConflictException | client | You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again. |
InternalServerException | server | An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help. |
ResourceNotFoundException | client | The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again. |
ServiceQuotaExceededException | client | You have exceeded the set limits for your Amazon Q Business service. |
ThrottlingException | client | The request was denied due to throttling. Reduce the number of requests and try again. |
ValidationException | client | The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again. |
QBusinessServiceException | Base exception class for all service exceptions from QBusiness service. |