/
string.proto
77 lines (64 loc) · 2.45 KB
/
string.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
syntax = "proto3";
package envoy.type.matcher;
import "envoy/type/matcher/regex.proto";
import "envoy/annotations/deprecation.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.type.matcher";
option java_outer_classname = "StringProto";
option java_multiple_files = true;
// [#protodoc-title: StringMatcher]
// Specifies the way to match a string.
// [#next-free-field: 7]
message StringMatcher {
oneof match_pattern {
option (validate.required) = true;
// The input string must match exactly the string specified here.
//
// Examples:
//
// * *abc* only matches the value *abc*.
string exact = 1;
// The input string must have the prefix specified here.
// Note: empty prefix is not allowed, please use regex instead.
//
// Examples:
//
// * *abc* matches the value *abc.xyz*
string prefix = 2 [(validate.rules).string = {min_bytes: 1}];
// The input string must have the suffix specified here.
// Note: empty prefix is not allowed, please use regex instead.
//
// Examples:
//
// * *abc* matches the value *xyz.abc*
string suffix = 3 [(validate.rules).string = {min_bytes: 1}];
// The input string must match the regular expression specified here.
// The regex grammar is defined `here
// <https://en.cppreference.com/w/cpp/regex/ecmascript>`_.
//
// Examples:
//
// * The regex ``\d{3}`` matches the value *123*
// * The regex ``\d{3}`` does not match the value *1234*
// * The regex ``\d{3}`` does not match the value *123.456*
//
// .. attention::
// This field has been deprecated in favor of `safe_regex` as it is not safe for use with
// untrusted input in all cases.
string regex = 4 [
deprecated = true,
(validate.rules).string = {max_bytes: 1024},
(envoy.annotations.disallowed_by_default) = true
];
// The input string must match the regular expression specified here.
RegexMatcher safe_regex = 5 [(validate.rules).message = {required: true}];
}
// If true, indicates the exact/prefix/suffix matching should be case insensitive. This has no
// effect for the safe_regex match.
// For example, the matcher *data* will match both input string *Data* and *data* if set to true.
bool ignore_case = 6;
}
// Specifies a list of ways to match a string.
message ListStringMatcher {
repeated StringMatcher patterns = 1 [(validate.rules).repeated = {min_items: 1}];
}