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 3969b8b23f..99943b1cf9 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 @@ -12,6 +12,8 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import org.opensearch.dataprepper.model.annotations.ExampleValues; +import org.opensearch.dataprepper.model.annotations.ExampleValues.Example; import org.opensearch.dataprepper.model.event.EventKey; import org.opensearch.dataprepper.model.event.EventKeyConfiguration; import org.opensearch.dataprepper.model.event.EventKeyFactory; @@ -42,9 +44,12 @@ public static class Entry { private boolean overwriteIfToKeyExists = false; @JsonProperty("rename_when") - @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.") + @JsonPropertyDescription("A conditional expression " + + "that will be evaluated to determine whether the processor will be run on the event. " + + "By default, all events will be processed if no condition is provided.") + @ExampleValues( + @Example(value = "startsWith(/path, \"https://\")", description = "Rename the string only if it starts with an HTTPS scheme.") + ) private String renameWhen; public EventKey getFromKey() { diff --git a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SplitStringProcessorConfig.java b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SplitStringProcessorConfig.java index 11116859aa..58eedeb34c 100644 --- a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SplitStringProcessorConfig.java +++ b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SplitStringProcessorConfig.java @@ -18,6 +18,8 @@ import org.opensearch.dataprepper.model.annotations.ConditionalRequired; import org.opensearch.dataprepper.model.annotations.ConditionalRequired.IfThenElse; import org.opensearch.dataprepper.model.annotations.ConditionalRequired.SchemaProperty; +import org.opensearch.dataprepper.model.annotations.ExampleValues; +import org.opensearch.dataprepper.model.annotations.ExampleValues.Example; import org.opensearch.dataprepper.model.event.EventKey; import java.util.List; @@ -51,6 +53,9 @@ public static class Entry { @AlsoRequired(values = { @AlsoRequired.Required(name=DELIMITER_REGEX_KEY, allowedValues = {"null", "\"\""}) }) + @ExampleValues( + @Example(value = "/", description = "Split a file path.") + ) private String delimiter; @JsonProperty("delimiter_regex") @@ -59,11 +64,17 @@ public static class Entry { @AlsoRequired(values = { @AlsoRequired.Required(name="delimiter", allowedValues = {"null", "\"\""}) }) + @ExampleValues( + @Example(value = "(file:///|/+)", description = "Split a file URI, treating multiple slashes as a single slash.") + ) private String delimiterRegex; @JsonProperty("split_when") @JsonPropertyDescription("Specifies under what condition the split_string processor should perform splitting. " + "Default is no condition.") + @ExampleValues( + @Example(value = "startsWith(/path, \"file://\")", description = "Split a string only if it starts with the file URI scheme.") + ) private String splitWhen; public EventKey getSource() { diff --git a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SubstituteStringProcessorConfig.java b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SubstituteStringProcessorConfig.java index f2c3c3f820..a0a1f2e97a 100644 --- a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SubstituteStringProcessorConfig.java +++ b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/SubstituteStringProcessorConfig.java @@ -10,6 +10,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import jakarta.validation.constraints.NotNull; +import org.opensearch.dataprepper.model.annotations.ExampleValues; +import org.opensearch.dataprepper.model.annotations.ExampleValues.Example; import org.opensearch.dataprepper.model.event.EventKey; import java.util.List; @@ -27,15 +29,22 @@ public static class Entry { "be escaped using \\\\ when using double quotes and \\ when using single quotes. " + "See Java Patterns " + "for more information.") + @ExampleValues({ + @Example(value = "/+", description = "Matches at least one forward slash and can be used to normalize a path."), + @Example(value = "'[?&#=]'", description = "Matches some special characters common in URIs.") + }) private String from; @JsonPropertyDescription("The string to be substituted for each match of from.") private String to; @JsonProperty("substitute_when") - @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.") + @JsonPropertyDescription("A conditional expression " + + "that will be evaluated to determine whether the processor will be run on the event. " + + "By default, all events will be processed if no condition is provided.") + @ExampleValues( + @Example(value = "startsWith(/request_uri, \"https://\")", description = "Substitute on the string only if it starts with an HTTPS scheme.") + ) private String substituteWhen; public EventKey getSource() { diff --git a/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessorConfig.java b/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessorConfig.java index 0b7f263b65..65d843632a 100644 --- a/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessorConfig.java +++ b/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessorConfig.java @@ -13,6 +13,8 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.AssertTrue; import jakarta.validation.Valid; +import org.opensearch.dataprepper.model.annotations.ExampleValues; +import org.opensearch.dataprepper.model.annotations.ExampleValues.Example; import java.util.List; @@ -41,8 +43,11 @@ public static class Entry { private Boolean recurse = false; @JsonProperty("truncate_when") - @JsonPropertyDescription("A conditional expression such as /test != false. " + - "If specified, the truncate processor will only run on events when the expression evaluates to true. ") + @JsonPropertyDescription("A conditional expression. " + + "If specified, the truncate processor will only run on events when the expression evaluates to true.") + @ExampleValues( + @Example(value = "length(/node_name) > 10", description = "Truncate if the value of node_name is greater than 10 characters.") + ) private String truncateWhen; public Entry(final List sourceKeys, final Integer startAt, final Integer length, final String truncateWhen, final Boolean recurse) {