From d2377473520aba19de38bd0c076993670d02fba0 Mon Sep 17 00:00:00 2001 From: Jeff Registre Date: Thu, 18 Jan 2024 12:55:14 -0500 Subject: [PATCH] Add LanguageCode to FAQ resource. (#109) --- aws-kendra-faq/aws-kendra-faq.json | 10 ++++++++++ .../java/software/amazon/kendra/faq/Translator.java | 6 ++++-- .../software/amazon/kendra/faq/TranslatorTest.java | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/aws-kendra-faq/aws-kendra-faq.json b/aws-kendra-faq/aws-kendra-faq.json index 86e7499c..1ac52888 100644 --- a/aws-kendra-faq/aws-kendra-faq.json +++ b/aws-kendra-faq/aws-kendra-faq.json @@ -46,6 +46,13 @@ "minLength": 1, "maxLength": 1000 }, + "LanguageCode": { + "description": "The code for a language.", + "type": "string", + "minLength": 2, + "maxLength": 10, + "pattern": "[a-zA-Z-]*" + }, "FileFormat": { "description": "Format of the input file", "enum": [ @@ -135,6 +142,9 @@ "Arn": { "type": "string", "maxLength": 1000 + }, + "LanguageCode": { + "$ref": "#/definitions/LanguageCode" } }, "required": [ diff --git a/aws-kendra-faq/src/main/java/software/amazon/kendra/faq/Translator.java b/aws-kendra-faq/src/main/java/software/amazon/kendra/faq/Translator.java index 2c156b70..38663947 100644 --- a/aws-kendra-faq/src/main/java/software/amazon/kendra/faq/Translator.java +++ b/aws-kendra-faq/src/main/java/software/amazon/kendra/faq/Translator.java @@ -35,7 +35,8 @@ static CreateFaqRequest translateToCreateRequest(final ResourceModel model) { .description(model.getDescription()) .name(model.getName()) .roleArn(model.getRoleArn()) - .fileFormat(model.getFileFormat()); + .fileFormat(model.getFileFormat()) + .languageCode(model.getLanguageCode()); if (model.getS3Path() != null) { builder.s3Path( S3Path.builder() @@ -65,7 +66,8 @@ static ResourceModel translateFromReadResponse(final DescribeFaqResponse describ .description(describeFaqResponse.description()) .name(describeFaqResponse.name()) .roleArn(describeFaqResponse.roleArn()) - .fileFormat(describeFaqResponse.fileFormatAsString()); + .fileFormat(describeFaqResponse.fileFormatAsString()) + .languageCode(describeFaqResponse.languageCode()); if (describeFaqResponse.s3Path() != null) { builder.s3Path(software.amazon.kendra.faq.S3Path.builder() .key(describeFaqResponse.s3Path().key()) diff --git a/aws-kendra-faq/src/test/java/software/amazon/kendra/faq/TranslatorTest.java b/aws-kendra-faq/src/test/java/software/amazon/kendra/faq/TranslatorTest.java index 39487c62..4d360822 100644 --- a/aws-kendra-faq/src/test/java/software/amazon/kendra/faq/TranslatorTest.java +++ b/aws-kendra-faq/src/test/java/software/amazon/kendra/faq/TranslatorTest.java @@ -42,6 +42,7 @@ void testCreateFaqRequest() { .s3Path(s3Path) .roleArn(roleArn) .tags(Arrays.asList(Tag.builder().key(tagKey).value(tagValue).build())) + .languageCode("de") .build(); CreateFaqRequest createFaqRequest = CreateFaqRequest @@ -56,6 +57,7 @@ void testCreateFaqRequest() { .bucket(s3Bucket) .build()) .roleArn(roleArn) + .languageCode("de") .tags(Arrays.asList(software.amazon.awssdk.services.kendra.model.Tag .builder().key(tagKey).value(tagValue).build())) .build();