Skip to content

Commit

Permalink
MAINT: add json property description into obfuscate processor (opense…
Browse files Browse the repository at this point in the history
…arch-project#4706)

* MAINT: add json property description

Signed-off-by: George Chen <[email protected]>
  • Loading branch information
chenqi0805 authored Jul 13, 2024
1 parent 67f3595 commit b1300c3
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.opensearch.dataprepper.plugins.processor.obfuscation;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.opensearch.dataprepper.expression.ExpressionEvaluator;
Expand All @@ -17,6 +18,7 @@
public class ObfuscationProcessorConfig {

@JsonProperty("source")
@JsonPropertyDescription("The source field to obfuscate.")
@NotEmpty
@NotNull
private String source;
Expand All @@ -25,18 +27,29 @@ public class ObfuscationProcessorConfig {
private List<String> patterns;

@JsonProperty("target")
@JsonPropertyDescription("The new field in which to store the obfuscated value. " +
"This leaves the original source field unchanged. " +
"When no `target` is provided, the source field updates with the obfuscated value.")
private String target;

@JsonProperty("action")
@JsonPropertyDescription("The obfuscation action. As of Data Prepper 2.3, only the `mask` action is supported.")
private PluginModel action;

@JsonProperty("obfuscate_when")
@JsonPropertyDescription("Specifies under what condition the Obfuscate processor should perform matching. " +
"Default is no condition.")
private String obfuscateWhen;

@JsonProperty("tags_on_match_failure")
@JsonPropertyDescription("The tag to add to an event if the obfuscate processor fails to match the pattern.")
private List<String> tagsOnMatchFailure;

@JsonProperty("single_word_only")
@JsonPropertyDescription("When set to `true`, a word boundary `\b` is 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. " +
"Can be used for Data Prepper 2.8 or greater.")
private boolean singleWordOnly = false;

public ObfuscationProcessorConfig() {
Expand Down

0 comments on commit b1300c3

Please sign in to comment.