createFaq method
Creates a set of frequently ask questions (FAQs) using a specified FAQ file stored in an Amazon S3 bucket.
Adding FAQs to an index is an asynchronous operation.
For an example of adding an FAQ to an index using Python and Java SDKs, see Using your FAQ file.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter indexId :
The identifier of the index for the FAQ.
Parameter name :
A name for the FAQ.
Parameter roleArn :
The Amazon Resource Name (ARN) of an IAM role with permission to access
the S3 bucket that contains the FAQ file. For more information, see IAM
access roles for Amazon Kendra.
Parameter s3Path :
The path to the FAQ file in S3.
Parameter clientToken :
A token that you provide to identify the request to create a FAQ. Multiple
calls to the CreateFaqRequest API with the same client token
will create only one FAQ.
Parameter description :
A description for the FAQ.
Parameter fileFormat :
The format of the FAQ input file. You can choose between a basic CSV
format, a CSV format that includes customs attributes in a header, and a
JSON format that includes custom attributes.
The default format is CSV.
The format must match the format of the file stored in the S3 bucket
identified in the S3Path parameter.
For more information, see Adding questions and answers.
Parameter languageCode :
The code for a language. This allows you to support a language for the FAQ
document. English is supported by default. For more information on
supported languages, including their codes, see Adding
documents in languages other than English.
Parameter tags :
A list of key-value pairs that identify the FAQ. You can use the tags to
identify and organize your resources and to control access to resources.
Implementation
Future<CreateFaqResponse> createFaq({
required String indexId,
required String name,
required String roleArn,
required S3Path s3Path,
String? clientToken,
String? description,
FaqFileFormat? fileFormat,
String? languageCode,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSKendraFrontendService.CreateFaq'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'IndexId': indexId,
'Name': name,
'RoleArn': roleArn,
'S3Path': s3Path,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'Description': description,
if (fileFormat != null) 'FileFormat': fileFormat.value,
if (languageCode != null) 'LanguageCode': languageCode,
if (tags != null) 'Tags': tags,
},
);
return CreateFaqResponse.fromJson(jsonResponse.body);
}