diff --git a/aws-kendra-datasource/aws-kendra-datasource.json b/aws-kendra-datasource/aws-kendra-datasource.json
index 14d01dd..a12d86d 100644
--- a/aws-kendra-datasource/aws-kendra-datasource.json
+++ b/aws-kendra-datasource/aws-kendra-datasource.json
@@ -1032,6 +1032,74 @@
"IndexFieldName"
]
},
+ "GoogleDriveConfiguration": {
+ "type": "object",
+ "properties": {
+ "SecretArn": {
+ "$ref": "#/definitions/SecretArn"
+ },
+ "InclusionPatterns": {
+ "$ref": "#/definitions/DataSourceInclusionsExclusionsStrings"
+ },
+ "ExclusionPatterns": {
+ "$ref": "#/definitions/DataSourceInclusionsExclusionsStrings"
+ },
+ "FieldMappings": {
+ "$ref": "#/definitions/DataSourceToIndexFieldMappingList"
+ },
+ "ExcludeMimeTypes": {
+ "$ref": "#/definitions/ExcludeMimeTypesList"
+ },
+ "ExcludeUserAccounts": {
+ "$ref": "#/definitions/ExcludeUserAccountsList"
+ },
+ "ExcludeSharedDrives": {
+ "$ref": "#/definitions/ExcludeSharedDrivesList"
+ }
+ },
+ "required": [
+ "SecretArn"
+ ]
+ },
+ "ExcludeMimeTypesList": {
+ "type": "array",
+ "minLength": 0,
+ "maxLength": 30,
+ "items": {
+ "$ref": "#/definitions/MimeType"
+ }
+ },
+ "MimeType": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 256
+ },
+ "ExcludeUserAccountsList": {
+ "type": "array",
+ "minLength": 0,
+ "maxLength": 100,
+ "items": {
+ "$ref": "#/definitions/UserAccount"
+ }
+ },
+ "UserAccount": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 256
+ },
+ "ExcludeSharedDrivesList": {
+ "type": "array",
+ "minLength": 0,
+ "maxLength": 100,
+ "items": {
+ "$ref": "#/definitions/SharedDriveId"
+ }
+ },
+ "SharedDriveId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 256
+ },
"ConfluenceAttachmentFieldName": {
"type": "string",
"enum": [
@@ -1071,6 +1139,9 @@
},
"ConfluenceConfiguration": {
"$ref": "#/definitions/ConfluenceConfiguration"
+ },
+ "GoogleDriveConfiguration": {
+ "$ref": "#/definitions/GoogleDriveConfiguration"
}
},
"oneOf": [
@@ -1108,6 +1179,11 @@
"required": [
"ConfluenceConfiguration"
]
+ },
+ {
+ "required": [
+ "GoogleDriveConfiguration"
+ ]
}
]
},
@@ -1128,7 +1204,8 @@
"SERVICENOW",
"DATABASE",
"CUSTOM",
- "CONFLUENCE"
+ "CONFLUENCE",
+ "GOOGLEDRIVE"
]
},
"Description": {
diff --git a/aws-kendra-datasource/pom.xml b/aws-kendra-datasource/pom.xml
index 5edb9b9..b5552df 100644
--- a/aws-kendra-datasource/pom.xml
+++ b/aws-kendra-datasource/pom.xml
@@ -22,7 +22,7 @@
software.amazon.awssdk
kendra
- 2.15.23
+ 2.15.58
diff --git a/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/Translator.java b/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/Translator.java
index df2bc18..9bc24e7 100644
--- a/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/Translator.java
+++ b/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/Translator.java
@@ -14,6 +14,7 @@
import software.amazon.awssdk.services.kendra.model.UntagResourceRequest;
import software.amazon.awssdk.services.kendra.model.UpdateDataSourceRequest;
import software.amazon.kendra.datasource.convert.DatabaseConverter;
+import software.amazon.kendra.datasource.convert.GoogleDriveConverter;
import software.amazon.kendra.datasource.convert.ListConverter;
import software.amazon.kendra.datasource.convert.OneDriveConverter;
import software.amazon.kendra.datasource.convert.S3Converter;
@@ -217,6 +218,7 @@ static software.amazon.awssdk.services.kendra.model.DataSourceConfiguration toSd
modelDataSourceConfiguration.serviceNowConfiguration(ServiceNowConverter.toSdkDataSourceConfiguration(dataSourceConfiguration.getServiceNowConfiguration()));
modelDataSourceConfiguration.oneDriveConfiguration(OneDriveConverter.toSdkDataSourceConfiguration(dataSourceConfiguration.getOneDriveConfiguration()));
modelDataSourceConfiguration.confluenceConfiguration(ConfluenceConverter.toSdkDataSourceConfiguration(dataSourceConfiguration.getConfluenceConfiguration()));
+ modelDataSourceConfiguration.googleDriveConfiguration(GoogleDriveConverter.toSdkDataSourceConfiguration(dataSourceConfiguration.getGoogleDriveConfiguration()));
return modelDataSourceConfiguration.build();
}
@@ -236,6 +238,8 @@ static DataSourceConfiguration toModelDataSourceConfiguration(
return OneDriveConverter.toModelDataSourceConfiguration(dataSourceConfiguration.oneDriveConfiguration());
} else if (DataSourceType.CONFLUENCE.toString().equals(dataSourceType)) {
return ConfluenceConverter.toModelDataSourceConfiguration(dataSourceConfiguration.confluenceConfiguration());
+ } else if (DataSourceType.GOOGLEDRIVE.toString().equals(dataSourceType)) {
+ return GoogleDriveConverter.toModelDataSourceConfiguration(dataSourceConfiguration.googleDriveConfiguration());
} else {
return null;
}
diff --git a/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/convert/GoogleDriveConverter.java b/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/convert/GoogleDriveConverter.java
new file mode 100644
index 0000000..28e979c
--- /dev/null
+++ b/aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/convert/GoogleDriveConverter.java
@@ -0,0 +1,64 @@
+package software.amazon.kendra.datasource.convert;
+
+import software.amazon.kendra.datasource.DataSourceConfiguration;
+import software.amazon.kendra.datasource.GoogleDriveConfiguration;
+
+/**
+ * GoogleDriveConverter is responsible for converting between the RPK models used
+ * by CloudFormation and those used by the AWS Sdk.
+ *
+ * @see software.amazon.kendra.datasource.Translator - where this class is used
+ */
+public class GoogleDriveConverter {
+
+ /**
+ * Given an RPK model, return the SDK representation of that model.
+ * @param model the RPK model
+ * @return The sdk representation
+ */
+ public static software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration toSdkDataSourceConfiguration(GoogleDriveConfiguration model) {
+ if (model == null) {
+ return null;
+ }
+ return software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration.builder()
+ .secretArn(model.getSecretArn())
+ .inclusionPatterns(StringListConverter.toSdk(model.getInclusionPatterns()))
+ .exclusionPatterns(StringListConverter.toSdk(model.getExclusionPatterns()))
+ .fieldMappings(ListConverter.toSdk(model.getFieldMappings(), FieldMappingConverter::toSdk))
+ .excludeMimeTypes(StringListConverter.toSdk(model.getExcludeMimeTypes()))
+ .excludeUserAccounts(StringListConverter.toSdk(model.getExcludeUserAccounts()))
+ .excludeSharedDrives(StringListConverter.toSdk(model.getExcludeSharedDrives()))
+ .build();
+ }
+
+ /**
+ * Given an SDK model, return an RPK model representation of that model (wrapped in a DataSourceConfiguration)
+ * @param sdk the sdk model
+ * @return The rpk representation of the model in a DataSourceConfiguration
+ */
+ public static DataSourceConfiguration toModelDataSourceConfiguration(software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration sdk) {
+ return DataSourceConfiguration.builder()
+ .googleDriveConfiguration(toModel(sdk))
+ .build();
+ }
+
+ /**
+ * Converts an SDK GoogleDriveConfiguration to the same structure as an RPK model
+ * @param sdk the sdk configuration
+ * @return the same structure as an RPK model
+ */
+ private static GoogleDriveConfiguration toModel(software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration sdk) {
+ if (sdk == null) {
+ return null;
+ }
+ return GoogleDriveConfiguration.builder()
+ .secretArn(sdk.secretArn())
+ .inclusionPatterns(StringListConverter.toModel(sdk.inclusionPatterns()))
+ .exclusionPatterns(StringListConverter.toModel(sdk.exclusionPatterns()))
+ .fieldMappings(ListConverter.toModel(sdk.fieldMappings(), FieldMappingConverter::toModel))
+ .excludeMimeTypes(StringListConverter.toModel(sdk.excludeMimeTypes()))
+ .excludeUserAccounts(StringListConverter.toModel(sdk.excludeUserAccounts()))
+ .excludeSharedDrives(StringListConverter.toModel(sdk.excludeSharedDrives()))
+ .build();
+ }
+}
diff --git a/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/TranslatorTest.java b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/TranslatorTest.java
index 66e3405..6c8db0a 100644
--- a/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/TranslatorTest.java
+++ b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/TranslatorTest.java
@@ -418,6 +418,33 @@ void testTranslateToSdkConfluence() {
.build());
}
+ @Test
+ void testTranslateToModelGoogleDrive() {
+
+ software.amazon.awssdk.services.kendra.model.DataSourceConfiguration dataSourceConfiguration =
+ software.amazon.awssdk.services.kendra.model.DataSourceConfiguration.builder()
+ .googleDriveConfiguration(software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration.builder().build())
+ .build();
+
+ assertThat(Translator.toModelDataSourceConfiguration(dataSourceConfiguration, DataSourceType.GOOGLEDRIVE.toString()))
+ .isEqualTo(DataSourceConfiguration.builder()
+ .googleDriveConfiguration(GoogleDriveConfiguration.builder().build())
+ .build());
+ }
+
+ @Test
+ void testTranslateToSdkGoogleDrive() {
+ DataSourceConfiguration dataSourceConfiguration = DataSourceConfiguration
+ .builder()
+ .googleDriveConfiguration(GoogleDriveConfiguration.builder().build())
+ .build();
+
+ assertThat(Translator.toSdkDataSourceConfiguration(dataSourceConfiguration))
+ .isEqualTo(software.amazon.awssdk.services.kendra.model.DataSourceConfiguration.builder()
+ .googleDriveConfiguration(software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration.builder().build())
+ .build());
+ }
+
@Test
void translateToSdkConfiguration_WHEN_Configuration_Null(){
assertThat(Translator.toSdkDataSourceConfiguration(null))
diff --git a/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTest.java b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTest.java
new file mode 100644
index 0000000..57b2cb1
--- /dev/null
+++ b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTest.java
@@ -0,0 +1,72 @@
+package software.amazon.kendra.datasource.convert.gdrive;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import software.amazon.kendra.datasource.DataSourceConfiguration;
+import software.amazon.kendra.datasource.convert.GoogleDriveConverter;
+
+/**
+ * GoogleDriveConverterTest tests that GoogleDriveConverter properly converts between AWS SDK and RPK models.
+ * @see GoogleDriveConverter - the unit under test
+ * @see GoogleDriveConverterTestCases - test cases for this class
+ */
+public class GoogleDriveConverterTest {
+
+ /**
+ * Given an SDK input, assert the converter produces the proper RPK output.
+ */
+ @ParameterizedTest
+ @MethodSource("provideModelToSdkTests")
+ public void testModelToSdk(GoogleDriveConverterTestCase testCase) {
+ Assertions.assertThat(GoogleDriveConverter.toSdkDataSourceConfiguration(testCase.getInput().asModel()))
+ .as(testCase.getDescription())
+ .isEqualTo(testCase.getExpectedOutput().asSdk());
+ }
+
+ /**
+ * Given an RPK input, assert the converter produces the proper SDK output.
+ */
+ @ParameterizedTest
+ @MethodSource("provideSdkToModelTests")
+ public void testSdkToModel(GoogleDriveConverterTestCase testCase) {
+ assertThat(GoogleDriveConverter.toModelDataSourceConfiguration(testCase.getInput().asSdk()))
+ .as(testCase.getDescription())
+ .isEqualTo(DataSourceConfiguration.builder()
+ .googleDriveConfiguration(testCase.getExpectedOutput().asModel())
+ .build());
+ }
+
+ /**
+ * @return All (model -> sdk) tests.
+ */
+ private static Stream provideModelToSdkTests() {
+ return provideTestCases(false);
+ }
+
+ /**
+ * @return All (sdk -> model) tests.
+ */
+ private static Stream provideSdkToModelTests() {
+ return provideTestCases(true);
+ }
+
+ /**
+ * Utility method used to generate a list of test cases for either (sdk -> model) or (model -> sdk).
+ * @param sdkInput - If this is true then the "mode" of this method is (sdk -> model) otherwise (model -> sdk)
+ * @return All test cases for the desired input mode.
+ */
+ private static Stream provideTestCases(boolean sdkInput) {
+ return Arrays.stream(GoogleDriveConverterTestCases.TEST_CASES)
+ // either the test case has the proper input, or it does not but is symmetrical
+ .filter(testCase -> testCase.getInput().isSdk() == sdkInput || testCase.isSymmetrical())
+ // if the test case has the proper input then it's a straightforward test, otherwise test in the opposite direction
+ .map(testCase -> testCase.getInput().isSdk() == sdkInput ? testCase : testCase.symmetricalTestCase());
+ }
+}
diff --git a/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCase.java b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCase.java
new file mode 100644
index 0000000..14aadf3
--- /dev/null
+++ b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCase.java
@@ -0,0 +1,104 @@
+package software.amazon.kendra.datasource.convert.gdrive;
+
+import lombok.Builder;
+import lombok.NonNull;
+import lombok.Value;
+
+/**
+ * GoogleDriveConverterTestCase represents a test case to be used in GoogleDriveConverterTest.
+ *
+ * Each instance of this class represents a conversion between
+ * sdk -> model or model -> sdk depending on the types of input and expectedOutput.
+ *
+ * If an instance of this class is defined to be symmetrical (which is true by default), then it states that
+ * conversions in the opposite direction (eg output -> input) is a valid test case.
+ *
+ * @see GoogleDriveConverterTest - how this class is used
+ * @see GoogleDriveConverterTestCases - collection of test cases
+ */
+@Value
+@Builder
+public class GoogleDriveConverterTestCase {
+
+ // human readable description of this test case
+ @NonNull private final String description;
+
+ // given this data
+ @NonNull private final Data input;
+
+ // the converter should return this data
+ @NonNull private final Data expectedOutput;
+
+ // if this is true, the test case can also be done in reverse
+ @Builder.Default
+ private final boolean isSymmetrical = true;
+
+ /**
+ * Produces a test case that is identical to this test case, but in the opposite direction.
+ */
+ public GoogleDriveConverterTestCase symmetricalTestCase() {
+ return GoogleDriveConverterTestCase.builder()
+ .input(expectedOutput)
+ .expectedOutput(input)
+ .isSymmetrical(isSymmetrical)
+ .description(String.format("Symmetrical(%s)", description))
+ .build();
+ }
+
+ /**
+ * Data represents a either a SDK GoogleDriveConfiguration or RPK GoogleDriveConfiguration.
+ * @see SdkData - sdk configuration
+ * @see ModelData - rpk configuration
+ */
+ public interface Data {
+
+ /**
+ * True iff this is a SdkData class.
+ */
+ default boolean isSdk() {
+ return this instanceof SdkData;
+ }
+
+ /**
+ * Returns this class as an SDK GoogleDriveConfiguration iff it is an instanceof SdkData.
+ */
+ default software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration asSdk() {
+ throw new IllegalStateException("Not an SdkData");
+ }
+
+ /**
+ * Returns this class as an RPK GoogleDriveConfiguration iff it is an instanceof ModelData.
+ */
+ default software.amazon.kendra.datasource.GoogleDriveConfiguration asModel() {
+ throw new IllegalStateException("Not a ModelData");
+ }
+ }
+
+ /**
+ * An Sdk representation of a GoogleDriveConfiguration.
+ */
+ @Value
+ public static final class SdkData implements Data {
+
+ private final software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration data;
+
+ @Override
+ public software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration asSdk() {
+ return this.data;
+ }
+ }
+
+ /**
+ * An RPK representation of a GoogleDriveConfiguration.
+ */
+ @Value
+ public static final class ModelData implements Data {
+
+ private final software.amazon.kendra.datasource.GoogleDriveConfiguration data;
+
+ @Override
+ public software.amazon.kendra.datasource.GoogleDriveConfiguration asModel() {
+ return this.data;
+ }
+ }
+}
diff --git a/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCaseConstants.java b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCaseConstants.java
new file mode 100644
index 0000000..637d943
--- /dev/null
+++ b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCaseConstants.java
@@ -0,0 +1,68 @@
+package software.amazon.kendra.datasource.convert.gdrive;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import software.amazon.awssdk.services.kendra.model.DataSourceToIndexFieldMapping;
+
+/**
+ * GoogleDriveConverterTestCaseConstants holds constant data used for test cases.
+ * @see GoogleDriveConverterTestCases - where this data is consumed
+ */
+public final class GoogleDriveConverterTestCaseConstants {
+
+ static final String SECRET_ARN = "SECRET_ARN";
+
+ static final List INCLUSION_PATTERNS = Arrays.asList("INC1", "INC2", "INC3");
+ static final List INCLUSION_PATTERNS_SINGLE = Collections.singletonList("INC1");
+ static final List INCLUSION_PATTERNS_EMPTY = Collections.emptyList();
+
+ static final List EXCLUSION_PATTERNS = Arrays.asList("EXC1", "EXC2", "EXC3");
+ static final List EXCLUSION_PATTERNS_SINGLE = Collections.singletonList("EXC1");
+ static final List EXCLUSION_PATTERNS_EMPTY = Collections.emptyList();
+
+ static final List FIELD_MAPPINGS_SDK = Arrays.asList(
+ DataSourceToIndexFieldMapping.builder().dataSourceFieldName("DSFN1").indexFieldName("IFN1").dateFieldFormat("DFF1").build(),
+ DataSourceToIndexFieldMapping.builder().dataSourceFieldName("DSFN2").indexFieldName("IFN2").dateFieldFormat("DFF2").build(),
+ DataSourceToIndexFieldMapping.builder().dataSourceFieldName("DSFN3").indexFieldName("IFN3").dateFieldFormat("DFF3").build()
+ );
+
+ static final List FIELD_MAPPINGS_SDK_SINGLE = Collections.singletonList(
+ DataSourceToIndexFieldMapping.builder().dataSourceFieldName("DSFN1").indexFieldName("IFN1").dateFieldFormat("DFF1").build()
+ );
+
+ static final List FIELD_MAPPINGS_SDK_EMPTY = Collections.emptyList();
+
+ static final List FIELD_MAPPINGS_MODEL = Arrays.asList(
+ software.amazon.kendra.datasource.DataSourceToIndexFieldMapping.builder()
+ .dataSourceFieldName("DSFN1").indexFieldName("IFN1").dateFieldFormat("DFF1").build(),
+ software.amazon.kendra.datasource.DataSourceToIndexFieldMapping.builder()
+ .dataSourceFieldName("DSFN2").indexFieldName("IFN2").dateFieldFormat("DFF2").build(),
+ software.amazon.kendra.datasource.DataSourceToIndexFieldMapping.builder()
+ .dataSourceFieldName("DSFN3").indexFieldName("IFN3").dateFieldFormat("DFF3").build()
+ );
+
+ static final List FIELD_MAPPINGS_MODEL_SINGLE = Collections.singletonList(
+ software.amazon.kendra.datasource.DataSourceToIndexFieldMapping.builder()
+ .dataSourceFieldName("DSFN1").indexFieldName("IFN1").dateFieldFormat("DFF1").build()
+ );
+
+ static final List FIELD_MAPPINGS_MODEL_EMPTY = Collections.emptyList();
+
+ static final List EXCLUDE_MIME_TYPES = Arrays.asList("EXC_MT1", "EXC_MT2", "EXC_MT3");
+ static final List EXCLUDE_MIME_TYPES_SINGLE = Collections.singletonList("EXC_MT1");
+ static final List EXCLUDE_MIME_TYPES_EMPTY = Collections.emptyList();
+
+ static final List EXCLUDE_USER_ACCOUNTS = Arrays.asList("EXC_UA1", "EXC_UA2", "EXC_UA3");
+ static final List EXCLUDE_USER_ACCOUNTS_SINGLE = Collections.singletonList("EXC_UA1");
+ static final List EXCLUDE_USER_ACCOUNTS_EMPTY = Collections.emptyList();
+
+ static final List EXCLUDE_SHARED_DRIVES = Arrays.asList("EXC_SD1", "EXC_SD2", "EXC_SD3");
+ static final List EXCLUDE_SHARED_DRIVES_SINGLE = Collections.singletonList("EXC_SD1");
+ static final List EXCLUDE_SHARED_DRIVES_EMPTY = Collections.emptyList();
+
+ private GoogleDriveConverterTestCaseConstants() {
+ // utility class
+ }
+}
diff --git a/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCases.java b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCases.java
new file mode 100644
index 0000000..4dcd6e3
--- /dev/null
+++ b/aws-kendra-datasource/src/test/java/software/amazon/kendra/datasource/convert/gdrive/GoogleDriveConverterTestCases.java
@@ -0,0 +1,169 @@
+package software.amazon.kendra.datasource.convert.gdrive;
+
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_MIME_TYPES;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_MIME_TYPES_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_MIME_TYPES_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_SHARED_DRIVES;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_SHARED_DRIVES_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_SHARED_DRIVES_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_USER_ACCOUNTS;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_USER_ACCOUNTS_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUDE_USER_ACCOUNTS_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUSION_PATTERNS;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUSION_PATTERNS_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.EXCLUSION_PATTERNS_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.FIELD_MAPPINGS_MODEL;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.FIELD_MAPPINGS_MODEL_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.FIELD_MAPPINGS_MODEL_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.FIELD_MAPPINGS_SDK;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.FIELD_MAPPINGS_SDK_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.FIELD_MAPPINGS_SDK_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.INCLUSION_PATTERNS;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.INCLUSION_PATTERNS_EMPTY;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.INCLUSION_PATTERNS_SINGLE;
+import static software.amazon.kendra.datasource.convert.gdrive.GoogleDriveConverterTestCaseConstants.SECRET_ARN;
+
+import software.amazon.awssdk.services.kendra.model.GoogleDriveConfiguration;
+
+/**
+ * GoogleDriveConverterTestCases contains all test cases used by GoogleDriveConverterTest.
+ * @see GoogleDriveConverterTestCase - how singular test cases are represented
+ * @see GoogleDriveConverterTest - consumer of this class' data
+ * @see GoogleDriveConverterTestCaseConstants - constants uses in this class
+ */
+public final class GoogleDriveConverterTestCases {
+
+ static final GoogleDriveConverterTestCase[] TEST_CASES = {
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Null")
+ .input(new GoogleDriveConverterTestCase.SdkData(null))
+ .expectedOutput(new GoogleDriveConverterTestCase.ModelData(null))
+ .build(),
+ //
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Null fields")
+ .input(new GoogleDriveConverterTestCase.SdkData(
+ GoogleDriveConfiguration.builder()
+ .build()))
+ .expectedOutput(new GoogleDriveConverterTestCase.ModelData(
+ software.amazon.kendra.datasource.GoogleDriveConfiguration.builder()
+ .build()))
+ .build(),
+ //
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Full configuration, multi-value lists")
+ .input(new GoogleDriveConverterTestCase.SdkData(
+ GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS)
+ .exclusionPatterns(EXCLUSION_PATTERNS)
+ .fieldMappings(FIELD_MAPPINGS_SDK)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES)
+ .build()))
+ .expectedOutput(new GoogleDriveConverterTestCase.ModelData(
+ software.amazon.kendra.datasource.GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS)
+ .exclusionPatterns(EXCLUSION_PATTERNS)
+ .fieldMappings(FIELD_MAPPINGS_MODEL)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES)
+ .build()))
+ .build(),
+ //
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Full configuration, single-value lists")
+ .input(new GoogleDriveConverterTestCase.SdkData(
+ GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS_SINGLE)
+ .exclusionPatterns(EXCLUSION_PATTERNS_SINGLE)
+ .fieldMappings(FIELD_MAPPINGS_SDK_SINGLE)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES_SINGLE)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS_SINGLE)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES_SINGLE)
+ .build()))
+ .expectedOutput(new GoogleDriveConverterTestCase.ModelData(
+ software.amazon.kendra.datasource.GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS_SINGLE)
+ .exclusionPatterns(EXCLUSION_PATTERNS_SINGLE)
+ .fieldMappings(FIELD_MAPPINGS_MODEL_SINGLE)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES_SINGLE)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS_SINGLE)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES_SINGLE)
+ .build()))
+ .build(),
+ //
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Base configuration")
+ .input(new GoogleDriveConverterTestCase.SdkData(
+ GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .build()))
+ .expectedOutput(new GoogleDriveConverterTestCase.ModelData(
+ software.amazon.kendra.datasource.GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .build()))
+ .build(),
+ //
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Empty sdk lists -> null model lists")
+ .isSymmetrical(false)
+ .input(new GoogleDriveConverterTestCase.SdkData(
+ GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS_EMPTY)
+ .exclusionPatterns(EXCLUSION_PATTERNS_EMPTY)
+ .fieldMappings(FIELD_MAPPINGS_SDK_EMPTY)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES_EMPTY)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS_EMPTY)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES_EMPTY)
+ .build()))
+ .expectedOutput(new GoogleDriveConverterTestCase.ModelData(
+ software.amazon.kendra.datasource.GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .build()))
+ .build(),
+ //
+ //
+ GoogleDriveConverterTestCase.builder()
+ .description("Empty model lists -> empty sdk lists")
+ .isSymmetrical(false)
+ .input(new GoogleDriveConverterTestCase.ModelData(
+ software.amazon.kendra.datasource.GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS_EMPTY)
+ .exclusionPatterns(EXCLUSION_PATTERNS_EMPTY)
+ .fieldMappings(FIELD_MAPPINGS_MODEL_EMPTY)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES_EMPTY)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS_EMPTY)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES_EMPTY)
+ .build()))
+ .expectedOutput(new GoogleDriveConverterTestCase.SdkData(
+ GoogleDriveConfiguration.builder()
+ .secretArn(SECRET_ARN)
+ .inclusionPatterns(INCLUSION_PATTERNS_EMPTY)
+ .exclusionPatterns(EXCLUSION_PATTERNS_EMPTY)
+ .fieldMappings(FIELD_MAPPINGS_SDK_EMPTY)
+ .excludeMimeTypes(EXCLUDE_MIME_TYPES_EMPTY)
+ .excludeUserAccounts(EXCLUDE_USER_ACCOUNTS_EMPTY)
+ .excludeSharedDrives(EXCLUDE_SHARED_DRIVES_EMPTY)
+ .build()))
+ .build(),
+ //
+ };
+
+ private GoogleDriveConverterTestCases() {
+ // utility class
+ }
+}