| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package xds.type.matcher.v3; |
| 4 |
|
| 5 |
import "xds/core/v3/extension.proto"; |
| 6 |
import "xds/type/matcher/v3/regex.proto"; |
| 7 |
|
| 8 |
import "validate/validate.proto"; |
| 9 |
|
| 10 |
option java_package = "com.github.xds.type.matcher.v3"; |
| 11 |
option java_outer_classname = "StringProto"; |
| 12 |
option java_multiple_files = true; |
| 13 |
option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; |
| 14 |
|
| 15 |
// [#protodoc-title: String matcher] |
| 16 |
|
| 17 |
// Specifies the way to match a string. |
| 18 |
// [#next-free-field: 9] |
| 19 |
message StringMatcher { |
| 20 |
oneof match_pattern { |
| 21 |
option (validate.required) = true; |
| 22 |
|
| 23 |
// The input string must match exactly the string specified here. |
| 24 |
// |
| 25 |
// Examples: |
| 26 |
// |
| 27 |
// * *abc* only matches the value *abc*. |
| 28 |
string exact = 1; |
| 29 |
|
| 30 |
// The input string must have the prefix specified here. |
| 31 |
// Note: empty prefix is not allowed, please use regex instead. |
| 32 |
// |
| 33 |
// Examples: |
| 34 |
// |
| 35 |
// * *abc* matches the value *abc.xyz* |
| 36 |
string prefix = 2 [(validate.rules).string = {min_len: 1}]; |
| 37 |
|
| 38 |
// The input string must have the suffix specified here. |
| 39 |
// Note: empty prefix is not allowed, please use regex instead. |
| 40 |
// |
| 41 |
// Examples: |
| 42 |
// |
| 43 |
// * *abc* matches the value *xyz.abc* |
| 44 |
string suffix = 3 [(validate.rules).string = {min_len: 1}]; |
| 45 |
|
| 46 |
// The input string must match the regular expression specified here. |
| 47 |
RegexMatcher safe_regex = 5 [(validate.rules).message = {required: true}]; |
| 48 |
|
| 49 |
// The input string must have the substring specified here. |
| 50 |
// Note: empty contains match is not allowed, please use regex instead. |
| 51 |
// |
| 52 |
// Examples: |
| 53 |
// |
| 54 |
// * *abc* matches the value *xyz.abc.def* |
| 55 |
string contains = 7 [(validate.rules).string = {min_len: 1}]; |
| 56 |
|
| 57 |
// Use an extension as the matcher type. |
| 58 |
// [#extension-category: envoy.string_matcher] |
| 59 |
xds.core.v3.TypedExtensionConfig custom = 8; |
| 60 |
} |
| 61 |
|
| 62 |
// If true, indicates the exact/prefix/suffix matching should be case insensitive. This has no |
| 63 |
// effect for the safe_regex match. |
| 64 |
// For example, the matcher *data* will match both input string *Data* and *data* if set to true. |
| 65 |
bool ignore_case = 6; |
| 66 |
} |
| 67 |
|
| 68 |
// Specifies a list of ways to match a string. |
| 69 |
message ListStringMatcher { |
| 70 |
repeated StringMatcher patterns = 1 [(validate.rules).repeated = {min_items: 1}]; |
| 71 |
} |