From c8124b868470d3bca686c10e3512a95903e1eb49 Mon Sep 17 00:00:00 2001 From: Chase Engelbrecht Date: Mon, 12 Feb 2024 09:32:26 -0800 Subject: [PATCH] Rename enable_detector_scan to detector_scan Signed-off-by: Chase Engelbrecht --- .../opensearch/bulk/BulkApiWrapperFactory.java | 2 +- .../opensearch/index/IndexConfiguration.java | 18 +++++++++--------- .../bulk/BulkApiWrapperFactoryTest.java | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactory.java b/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactory.java index 321bcd7cf1..d2b09a8e80 100644 --- a/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactory.java +++ b/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactory.java @@ -9,7 +9,7 @@ public class BulkApiWrapperFactory { public static BulkApiWrapper getWrapper(final IndexConfiguration indexConfiguration, final OpenSearchClient openSearchClient, final RestHighLevelClient restHighLevelClient) { - if (indexConfiguration.isEnableDetectorScan()) { + if (indexConfiguration.isDetectorScan()) { return new OpenSearchDetectorScanBulkApiWrapper(restHighLevelClient); } diff --git a/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/index/IndexConfiguration.java b/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/index/IndexConfiguration.java index e998e94745..b928c0c6f1 100644 --- a/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/index/IndexConfiguration.java +++ b/data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/index/IndexConfiguration.java @@ -74,7 +74,7 @@ public class IndexConfiguration { public static final String DOCUMENT_VERSION_EXPRESSION = "document_version"; public static final String DOCUMENT_VERSION_TYPE = "document_version_type"; public static final String NORMALIZE_INDEX = "normalize_index"; - public static final String ENABLE_DETECTOR_SCAN = "enable_detector_scan"; + public static final String DETECTOR_SCAN = "detector_scan"; private IndexType indexType; private TemplateType templateType; @@ -101,7 +101,7 @@ public class IndexConfiguration { private final String versionExpression; private final VersionType versionType; private final boolean normalizeIndex; - private final boolean enableDetectorScan; + private final boolean detectorScan; private static final String S3_PREFIX = "s3://"; private static final String DEFAULT_AWS_REGION = "us-east-1"; @@ -119,7 +119,7 @@ private IndexConfiguration(final Builder builder) { this.versionExpression = builder.versionExpression; this.versionType = builder.versionType; this.normalizeIndex = builder.normalizeIndex; - this.enableDetectorScan = builder.enableDetectorScan; + this.detectorScan = builder.detectorScan; determineTemplateType(builder); @@ -242,8 +242,8 @@ public static IndexConfiguration readIndexConfig(final PluginSetting pluginSetti final boolean normalizeIndex = pluginSetting.getBooleanOrDefault(NORMALIZE_INDEX, false); builder = builder.withNormalizeIndex(normalizeIndex); - final boolean enableDetectorScan = pluginSetting.getBooleanOrDefault(ENABLE_DETECTOR_SCAN, false); - builder = builder.withEnableDetectorScan(enableDetectorScan); + final boolean detectorScan = pluginSetting.getBooleanOrDefault(DETECTOR_SCAN, false); + builder = builder.withDetectorScan(detectorScan); builder = builder.withVersionExpression(versionExpression); if (versionExpression != null && (!expressionEvaluator.isValidFormatExpression(versionExpression))) { @@ -400,7 +400,7 @@ public String getDocumentRootKey() { public boolean isNormalizeIndex() { return normalizeIndex; } - public boolean isEnableDetectorScan() { return enableDetectorScan; } + public boolean isDetectorScan() { return detectorScan; } /** * This method is used in the creation of IndexConfiguration object. It takes in the template file path @@ -486,7 +486,7 @@ public static class Builder { private VersionType versionType; private String versionExpression; private boolean normalizeIndex; - private boolean enableDetectorScan; + private boolean detectorScan; public Builder withIndexAlias(final String indexAlias) { checkArgument(indexAlias != null, "indexAlias cannot be null."); @@ -665,8 +665,8 @@ public Builder withNormalizeIndex(final boolean normalizeIndex) { return this; } - public Builder withEnableDetectorScan(final boolean enableDetectorScan) { - this.enableDetectorScan = enableDetectorScan; + public Builder withDetectorScan(final boolean detectorScan) { + this.detectorScan = detectorScan; return this; } diff --git a/data-prepper-plugins/opensearch/src/test/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactoryTest.java b/data-prepper-plugins/opensearch/src/test/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactoryTest.java index 35e97e1d55..5d01cb9e0a 100644 --- a/data-prepper-plugins/opensearch/src/test/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactoryTest.java +++ b/data-prepper-plugins/opensearch/src/test/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/BulkApiWrapperFactoryTest.java @@ -40,7 +40,7 @@ void testGetOpenSearchDefaultBulkApiWrapper() { @Test void testGetEnableDetectorScanBulkApiWrapper() { - when(indexConfiguration.isEnableDetectorScan()).thenReturn(true); + when(indexConfiguration.isDetectorScan()).thenReturn(true); assertThat(BulkApiWrapperFactory.getWrapper(indexConfiguration, openSearchClient, restHighLevelClient), instanceOf(OpenSearchDetectorScanBulkApiWrapper.class)); }