From 76b06ef239d742892f849c736c82e857f327cf6e Mon Sep 17 00:00:00 2001 From: Katherine Shen <40495707+shenkw1@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:30:26 -0500 Subject: [PATCH] Add examples and reorder some processor configurations in schemas (#5216) * update schemas according to review Signed-off-by: Katherine Shen * fix build Signed-off-by: Katherine Shen --------- Signed-off-by: Katherine Shen --- .../processor/csv/CsvProcessorConfig.java | 10 ++++---- .../processor/date/DateProcessorConfig.java | 3 +++ .../decompress/DecompressProcessorConfig.java | 3 +++ .../processor/grok/GrokProcessorConfig.java | 15 +++++------- .../mutateevent/AddEntryProcessorConfig.java | 2 +- .../ConvertEntryTypeProcessorConfig.java | 4 ++-- .../mutateevent/CopyValueProcessorConfig.java | 4 ++-- .../mutateevent/ListToMapProcessorConfig.java | 5 +++- .../mutateevent/MapToListProcessorConfig.java | 6 ----- .../mutateevent/RenameKeyProcessorConfig.java | 3 +++ .../ObfuscationProcessorConfig.java | 10 ++++---- .../obfuscation/action/MaskActionConfig.java | 2 +- .../parse/ion/ParseIonProcessorConfig.java | 24 +++++++++---------- .../parse/json/ParseJsonProcessorConfig.java | 16 ++++++------- .../parse/xml/ParseXmlProcessorConfig.java | 16 ++++++------- 15 files changed, 63 insertions(+), 60 deletions(-) diff --git a/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessorConfig.java b/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessorConfig.java index 940c6e3a9e..0e9b37c015 100644 --- a/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessorConfig.java +++ b/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessorConfig.java @@ -37,7 +37,7 @@ public class CsvProcessorConfig { @JsonPropertyDescription("The character separating each column. Default value is ,.") private String delimiter = DEFAULT_DELIMITER; - @JsonProperty("delete_header") + @JsonProperty(value = "delete_header", defaultValue = "true") @JsonPropertyDescription("If specified, the event header (column_names_source_key) is deleted after the event " + "is parsed. If there is no event header, no action is taken. Default value is true.") private Boolean deleteHeader = DEFAULT_DELETE_HEADERS; @@ -68,6 +68,10 @@ public class CsvProcessorConfig { }) private List columnNames; + @JsonPropertyDescription("If true, the configured source field will be deleted after the CSV data is parsed into separate fields.") + @JsonProperty + private boolean deleteSource = false; + @JsonProperty("csv_when") @JsonPropertyDescription("A conditional expression such as /some_key == \"test\". " + "If specified, the csv processor will only run on events when the expression evaluates to true. ") @@ -76,10 +80,6 @@ public class CsvProcessorConfig { }) private String csvWhen; - @JsonPropertyDescription("If true, the configured source field will be deleted after the CSV data is parsed into separate fields.") - @JsonProperty - private boolean deleteSource = false; - /** * The field of the Event that contains the CSV data to be processed. * diff --git a/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java b/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java index f66303a170..f813a8fa1f 100644 --- a/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java +++ b/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java @@ -198,6 +198,9 @@ public static boolean isValidPattern(final String pattern) { @JsonProperty("date_when") @JsonPropertyDescription("Specifies under what condition the date processor should perform matching. " + "Default is no condition.") + @ExampleValues({ + @Example(value = "/some_key == null", description = "Only runs the date processor on the Event if some_key is null or doesn't exist.") + }) private String dateWhen; @JsonIgnore diff --git a/data-prepper-plugins/decompress-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/decompress/DecompressProcessorConfig.java b/data-prepper-plugins/decompress-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/decompress/DecompressProcessorConfig.java index d7b9d81e3c..44d9b37089 100644 --- a/data-prepper-plugins/decompress-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/decompress/DecompressProcessorConfig.java +++ b/data-prepper-plugins/decompress-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/decompress/DecompressProcessorConfig.java @@ -33,6 +33,9 @@ public class DecompressProcessorConfig { @JsonPropertyDescription("The type of decompression to use for the keys in the event. Only gzip is supported.") @JsonProperty("type") @NotNull + @ExampleValues({ + @Example(value = "gzip", description = "GZIP decompression.") + }) private DecompressionType decompressionType; @JsonPropertyDescription("A list of strings with which to tag events when the processor fails to decompress the keys inside an event. Defaults to _decompression_failure.") diff --git a/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessorConfig.java b/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessorConfig.java index adae6918d2..28ff49946c 100644 --- a/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessorConfig.java +++ b/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessorConfig.java @@ -114,11 +114,14 @@ public class GrokProcessorConfig { @JsonProperty(TAGS_ON_TIMEOUT) @JsonPropertyDescription("The tags to add to the event metadata if the grok match times out.") - @ExampleValues({ - @Example(value = "_timeout", description = "Events are tagged with this string if grok match times out.") - }) private List tagsOnTimeout = Collections.emptyList(); + @JsonProperty(INCLUDE_PERFORMANCE_METADATA) + @JsonPropertyDescription("A boolean value to determine whether to include performance metadata into event metadata. " + + "If set to true, the events coming out of grok will have new fields such as _total_grok_patterns_attempted and _total_grok_processing_time." + + "You can use this metadata to perform performance testing and tuning of your grok patterns. By default, it is not included.") + private boolean includePerformanceMetadata = false; + @JsonProperty(GROK_WHEN) @ExampleValues({ @Example(value = "/type == \"ipv4\"", description = "When the IP type is IPV4, the processor will perform matching.") @@ -127,12 +130,6 @@ public class GrokProcessorConfig { "If specified, the grok processor will only run on events when the expression evaluates to true. ") private String grokWhen; - @JsonProperty(INCLUDE_PERFORMANCE_METADATA) - @JsonPropertyDescription("A boolean value to determine whether to include performance metadata into event metadata. " + - "If set to true, the events coming out of grok will have new fields such as _total_grok_patterns_attempted and _total_grok_processing_time." + - "You can use this metadata to perform performance testing and tuning of your grok patterns. By default, it is not included.") - private boolean includePerformanceMetadata = false; - public boolean isBreakOnMatch() { return breakOnMatch; } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessorConfig.java index 63e73be1b4..5529428ecb 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessorConfig.java @@ -66,7 +66,7 @@ public class AddEntryProcessorConfig { public static class Entry { @JsonPropertyDescription("The key of the new entry to be added. Some examples of keys include my_key, " + "myKey, and object/sub_Key. The key can also be a format expression, for example, ${/key1} to " + - "use the value of field key1 as the key.") + "use the value of field key1 as the key. Either one of key or metadata_key is required.") @AlsoRequired(values = { @AlsoRequired.Required(name=METADATA_KEY_KEY, allowedValues = {"null"}) }) diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessorConfig.java index 48a0d0634d..f184e02896 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessorConfig.java @@ -38,14 +38,14 @@ public class ConvertEntryTypeProcessorConfig implements ConverterArguments { static final String KEYS_KEY = "keys"; @JsonProperty(KEY_KEY) - @JsonPropertyDescription("Key whose value needs to be converted to a different type.") + @JsonPropertyDescription("Key whose value needs to be converted to a different type. Cannot be declared at the same time as keys.") @AlsoRequired(values = { @AlsoRequired.Required(name = KEYS_KEY, allowedValues = {"null"}) }) private String key; @JsonProperty(KEYS_KEY) - @JsonPropertyDescription("List of keys whose values needs to be converted to a different type.") + @JsonPropertyDescription("List of keys whose values needs to be converted to a different type. Cannot be declared at the same time as key.") @AlsoRequired(values = { @AlsoRequired.Required(name = KEY_KEY, allowedValues = {"null"}) }) diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java index c4e7dae876..c7ec7683ef 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java @@ -86,14 +86,14 @@ public Entry() { private List entries; @JsonProperty(FROM_LIST_KEY) - @JsonPropertyDescription("The key of the list of objects to be copied.") + @JsonPropertyDescription("The key of the list of objects to be copied. to_list must also be defined.") @AlsoRequired(values = { @AlsoRequired.Required(name = TO_LIST_KEY) }) private String fromList; @JsonProperty(TO_LIST_KEY) - @JsonPropertyDescription("The key of the new list to be added.") + @JsonPropertyDescription("The key of the new list to be added. from_list must also be defined.") @AlsoRequired(values = { @AlsoRequired.Required(name = FROM_LIST_KEY) }) diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessorConfig.java index 1d8810b1ad..1d7c30b56c 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessorConfig.java @@ -102,7 +102,7 @@ public String getOptionValue() { private boolean extractValue = false; @NotNull - @JsonProperty("flatten") + @JsonProperty(value = "flatten", defaultValue = "false") @JsonPropertyDescription("When true, values in the generated map output flatten into single items based on " + "the flattened_element. Otherwise, objects mapped to values from the generated map appear as lists. " + "Default is false.") @@ -121,6 +121,9 @@ public String getOptionValue() { @JsonPropertyDescription("A conditional expression, " + "such as /some-key == \"test\", that will be evaluated to determine whether the processor will be " + "run on the event. By default, all events will be processed unless otherwise stated.") + @ExampleValues({ + @Example(value = "/some-key == \"test\"", description = "The operation will run when the value of the key is 'test'.") + }) private String listToMapWhen; public String getSource() { diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessorConfig.java index 37349c9498..b9111b6493 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessorConfig.java @@ -65,16 +65,10 @@ public class MapToListProcessorConfig { @JsonProperty("exclude_keys") @JsonPropertyDescription("The keys in the source map that will be excluded from processing. Default is an " + "empty list ([]).") - @ExampleValues({ - @Example(value = "[\"key1\"]", description = "When the key is 'key1', the processor will not include this key-value pair in the list and will leave it in the map.") - }) private List excludeKeys = DEFAULT_EXCLUDE_KEYS; @JsonProperty("tags_on_failure") @JsonPropertyDescription("A list of tags to add to the event metadata when the event fails to process.") - @ExampleValues({ - @Example(value = "[\"_failure\"]", description = "{\"tags\": [\"_failure\"]} will be added to the event’s metadata in the event of a processing failure.") - }) private List tagsOnFailure; @JsonProperty("map_to_list_when") diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessorConfig.java index af73e21b81..8504bea099 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessorConfig.java @@ -43,6 +43,9 @@ public static class Entry { @JsonProperty(defaultValue = FROM_KEY_REGEX) @JsonPropertyDescription("The regex pattern of the key of the entry to be renamed. " + "This field cannot be defined along with from_key.") + @ExampleValues( + @Example(value = "regex", description = "Generic regex string.") + ) @AlsoRequired(values = { @AlsoRequired.Required(name = FROM_KEY, allowedValues = {"null"}) }) diff --git a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java index 387ef9f43e..c8a5ef4e07 100644 --- a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java +++ b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java @@ -47,7 +47,7 @@ public class ObfuscationProcessorConfig { @JsonProperty("patterns") @JsonPropertyDescription("A list of regex patterns that allow you to obfuscate specific parts of a field. Only parts that match the regex pattern will obfuscate. When not provided, the processor obfuscates the whole field.") @ExampleValues({ - @Example(value = "[A-Za-z0-9+_.-]+@([\\w-]+\\.)+[\\w-]{2,4}", description = "This pattern represents an email address that will be obfuscated in the given field.") + @Example(value = "regex", description = "Generic regex pattern.") }) private List patterns; @@ -57,21 +57,21 @@ public class ObfuscationProcessorConfig { private PluginModel action; @JsonProperty("single_word_only") - @JsonPropertyDescription("When set to true, a word boundary \b is added to the pattern, " + + @JsonPropertyDescription("When set to true, a word boundary \bis added to the pattern, " + "which causes obfuscation to be applied only to words that are standalone in the input text. " + "By default, it is false, meaning obfuscation patterns are applied to all occurrences.") private boolean singleWordOnly = false; @JsonProperty("tags_on_match_failure") @JsonPropertyDescription("The tag to add to an event if the obfuscate processor fails to match the pattern.") - @ExampleValues({ - @Example(value = "[\"_failure\"]", description = "{\"tags\": [\"_failure\"]} will be added to the event if the processor fails to match the pattern.") - }) private List tagsOnMatchFailure; @JsonProperty("obfuscate_when") @JsonPropertyDescription("A conditional expression such as /is_testing_data == true. " + "If specified, the obfuscate processor will only run on events when the expression evaluates to true. ") + @ExampleValues({ + @Example(value = "/some_key != null", description = "Only runs the obfuscate processor on the Event if the existing key some_key is not null.") + }) private String obfuscateWhen; public ObfuscationProcessorConfig() { diff --git a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/action/MaskActionConfig.java b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/action/MaskActionConfig.java index fbd2eebc97..e2d7e9d326 100644 --- a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/action/MaskActionConfig.java +++ b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/action/MaskActionConfig.java @@ -21,7 +21,7 @@ public class MaskActionConfig { @JsonProperty(value = "mask_character", defaultValue = DEFAULT_MASK_CHARACTER) @Pattern(regexp = "[*#!%&@]", message = "Valid characters are *, #, $, %, &, ! and @") - @JsonPropertyDescription("The character to use to mask text. By default, this is *. Valid characters are *, #, $, %, &, ! and @") + @JsonPropertyDescription("The character to use to mask text. By default, this is *. Valid characters are *, #, $, %, &, ! and @.") private String maskCharacter = DEFAULT_MASK_CHARACTER; @JsonProperty(value = "mask_character_length", defaultValue = "" + DEFAULT_MASK_LENGTH) diff --git a/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/ion/ParseIonProcessorConfig.java b/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/ion/ParseIonProcessorConfig.java index eb930d1dba..2700eca44f 100644 --- a/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/ion/ParseIonProcessorConfig.java +++ b/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/ion/ParseIonProcessorConfig.java @@ -38,6 +38,12 @@ public class ParseIonProcessorConfig implements CommonParseConfig { @JsonPropertyDescription("The destination field of the structured object from the parsed ION. Defaults to the root of the event. Cannot be an empty string, /, or any whitespace-only string because these are not valid event fields.") private String destination; + @JsonProperty(value = "depth", defaultValue = "0") + @Min(0) + @Max(10) + @JsonPropertyDescription("Indicates the depth at which the nested values of the event are not parsed any more. Default is 0, which means all levels of nested values are parsed. If the depth is 1, only the top level keys are parsed and all its nested values are represented as strings") + private int depth = 0; + @JsonProperty("pointer") @JsonPropertyDescription("A JSON pointer to the field to be parsed. There is no pointer by default, meaning the entire source is parsed. The pointer can access JSON array indexes as well. " + "If the JSON pointer is invalid then the entire source data is parsed into the outgoing event. If the key that is pointed to already exists in the event and the destination is the root, then the pointer uses the entire path of the key.") @@ -58,13 +64,6 @@ public class ParseIonProcessorConfig implements CommonParseConfig { @JsonPropertyDescription("A list of strings specifying the tags to be set in the event that the processor fails or an unknown exception occurs during parsing.") private List tagsOnFailure; - @JsonProperty("parse_when") - @JsonPropertyDescription("A Data Prepper [conditional expression](https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/), such as /some-key == \"test\", that will be evaluated to determine whether the processor will be run on the event.") - @ExampleValues({ - @Example(value = "/some_key == null", description = "Only runs parsing on the Event if some_key is null or doesn't exist.") - }) - private String parseWhen; - @JsonProperty(value = "handle_failed_events", defaultValue = "skip") @JsonPropertyDescription("Determines how to handle events with ION processing errors. Options include 'skip', " + "which will log the error and send the event downstream to the next processor, and 'skip_silently', " + @@ -72,11 +71,12 @@ public class ParseIonProcessorConfig implements CommonParseConfig { @NotNull private HandleFailedEventsOption handleFailedEventsOption = HandleFailedEventsOption.SKIP; - @JsonProperty(value = "depth", defaultValue = "0") - @Min(0) - @Max(10) - @JsonPropertyDescription("Indicates the depth at which the nested values of the event are not parsed any more. Default is 0, which means all levels of nested values are parsed. If the depth is 1, only the top level keys are parsed and all its nested values are represented as strings") - private int depth = 0; + @JsonProperty("parse_when") + @JsonPropertyDescription("A Data Prepper [conditional expression](https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/), such as /some-key == \"test\", that will be evaluated to determine whether the processor will be run on the event.") + @ExampleValues({ + @Example(value = "/some_key == null", description = "Only runs parsing on the Event if some_key is null or doesn't exist.") + }) + private String parseWhen; @Override public String getSource() { diff --git a/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/json/ParseJsonProcessorConfig.java b/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/json/ParseJsonProcessorConfig.java index 9c6d4b74b8..5f0365d2a9 100644 --- a/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/json/ParseJsonProcessorConfig.java +++ b/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/json/ParseJsonProcessorConfig.java @@ -64,14 +64,6 @@ public class ParseJsonProcessorConfig implements CommonParseConfig { @JsonPropertyDescription("A list of strings specifying the tags to be set in the event when the processor fails or an unknown exception occurs during parsing.") private List tagsOnFailure; - @JsonProperty("parse_when") - @JsonPropertyDescription("A conditional expression such as /some_key == \"test\". " + - "If specified, the parse_json processor will only run on events when the expression evaluates to true. ") - @ExampleValues({ - @Example(value = "/some_key == null", description = "Only runs parsing on the Event if some_key is null or doesn't exist.") - }) - private String parseWhen; - @JsonProperty("handle_failed_events") @JsonPropertyDescription("Determines how to handle events with JSON processing errors. Options include 'skip', " + "which will log the error and send the event downstream to the next processor, and 'skip_silently', " + @@ -80,6 +72,14 @@ public class ParseJsonProcessorConfig implements CommonParseConfig { @NotNull private HandleFailedEventsOption handleFailedEventsOption = HandleFailedEventsOption.SKIP; + @JsonProperty("parse_when") + @JsonPropertyDescription("A conditional expression such as /some_key == \"test\". " + + "If specified, the parse_json processor will only run on events when the expression evaluates to true. ") + @ExampleValues({ + @Example(value = "/some_key == null", description = "Only runs parsing on the Event if some_key is null or doesn't exist.") + }) + private String parseWhen; + @Override public String getSource() { return source; diff --git a/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/xml/ParseXmlProcessorConfig.java b/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/xml/ParseXmlProcessorConfig.java index 3d633fd55c..ccd4c3d850 100644 --- a/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/xml/ParseXmlProcessorConfig.java +++ b/data-prepper-plugins/parse-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/parse/xml/ParseXmlProcessorConfig.java @@ -47,14 +47,6 @@ public class ParseXmlProcessorConfig implements CommonParseConfig { @JsonPropertyDescription("If true, the configured source field will be deleted after the XML data is parsed into separate fields.") private boolean deleteSource = false; - @JsonProperty("parse_when") - @JsonPropertyDescription("A conditional expression such as /some_key == \"test\". " + - "If specified, the parse_xml processor will only run on events when the expression evaluates to true. ") - @ExampleValues({ - @Example(value = "/some_key == null", description = "Only runs parsing on the Event if some_key is null or doesn't exist.") - }) - private String parseWhen; - @JsonProperty("tags_on_failure") @JsonPropertyDescription("A list of strings specifying the tags to be set in the event when the processor fails or an unknown exception occurs during parsing.") private List tagsOnFailure; @@ -67,6 +59,14 @@ public class ParseXmlProcessorConfig implements CommonParseConfig { @NotNull private HandleFailedEventsOption handleFailedEventsOption = HandleFailedEventsOption.SKIP; + @JsonProperty("parse_when") + @JsonPropertyDescription("A conditional expression such as /some_key == \"test\". " + + "If specified, the parse_xml processor will only run on events when the expression evaluates to true. ") + @ExampleValues({ + @Example(value = "/some_key == null", description = "Only runs parsing on the Event if some_key is null or doesn't exist.") + }) + private String parseWhen; + @Override public String getSource() { return source;