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