Skip to content

Commit 43ea4e3

Browse files
docs: clean up matcher docs and make it consistent (#39919)
## Description This PR have some cleanup in metadata matcher proto docs for consistency. We are using the note annotations and the backticks inconsistently throughout right now. --- **Commit Message:** docs: clean up metadata matcher docs and make it consistent **Additional Description:** Minor clean up for added clarity on the metadata matcher docs. **Risk Level:** N/A **Testing:** N/A **Docs Changes:** N/A **Release Notes:** N/A --------- Signed-off-by: Rohit Agrawal <[email protected]> Co-authored-by: phlax <[email protected]> Mirrored from https://github.com/envoyproxy/envoy @ 70880edde9c916318de0ab986daf9ea4d21a917a
1 parent 8cc4e58 commit 43ea4e3

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

envoy/config/common/matcher/v3/matcher.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ message Matcher {
9595
// A list of predicates to be AND-ed together.
9696
PredicateList and_matcher = 3;
9797

98-
// The invert of a predicate
98+
// The inverse of a predicate
9999
Predicate not_matcher = 4;
100100
}
101101
}
@@ -148,8 +148,8 @@ message Matcher {
148148
MatcherTree matcher_tree = 2;
149149
}
150150

151-
// Optional OnMatch to use if the matcher failed.
152-
// If specified, the OnMatch is used, and the matcher is considered
151+
// Optional ``OnMatch`` to use if the matcher failed.
152+
// If specified, the ``OnMatch`` is used, and the matcher is considered
153153
// to have matched.
154154
// If not specified, the matcher is considered not to have matched.
155155
OnMatch on_no_match = 3;
@@ -215,9 +215,9 @@ message HttpHeadersMatch {
215215
//
216216
// .. attention::
217217
//
218-
// Searching for patterns in HTTP body is potentially cpu intensive. For each specified pattern, http body is scanned byte by byte to find a match.
218+
// Searching for patterns in HTTP body is potentially CPU-intensive. For each specified pattern, HTTP body is scanned byte by byte to find a match.
219219
// If multiple patterns are specified, the process is repeated for each pattern. If location of a pattern is known, ``bytes_limit`` should be specified
220-
// to scan only part of the http body.
220+
// to scan only part of the HTTP body.
221221
message HttpGenericBodyMatch {
222222
message GenericTextMatch {
223223
oneof rule {

envoy/type/matcher/v3/metadata.proto

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
1616

1717
// [#protodoc-title: Metadata matcher]
1818

19-
// MetadataMatcher provides a general interface to check if a given value is matched in
20-
// :ref:`Metadata <envoy_v3_api_msg_config.core.v3.Metadata>`. It uses `filter` and `path` to retrieve the value
21-
// from the Metadata and then check if it's matched to the specified value.
19+
// ``MetadataMatcher`` provides a general interface to check if a given value is matched in
20+
// :ref:`Metadata <envoy_v3_api_msg_config.core.v3.Metadata>`. It uses ``filter`` and ``path`` to retrieve the value
21+
// from the ``Metadata`` and then check if it's matched to the specified value.
2222
//
23-
// For example, for the following Metadata:
23+
// For example, for the following ``Metadata``:
2424
//
2525
// .. code-block:: yaml
2626
//
@@ -41,8 +41,8 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
4141
// - string_value: m
4242
// - string_value: n
4343
//
44-
// The following MetadataMatcher is matched as the path [a, b, c] will retrieve a string value "pro"
45-
// from the Metadata which is matched to the specified prefix match.
44+
// The following ``MetadataMatcher`` is matched as the path ``[a, b, c]`` will retrieve a string value ``pro``
45+
// from the ``Metadata`` which is matched to the specified prefix match.
4646
//
4747
// .. code-block:: yaml
4848
//
@@ -55,7 +55,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
5555
// string_match:
5656
// prefix: pr
5757
//
58-
// The following MetadataMatcher is matched as the code will match one of the string values in the
58+
// The following ``MetadataMatcher`` is matched as the code will match one of the string values in the
5959
// list at the path [a, t].
6060
//
6161
// .. code-block:: yaml
@@ -70,7 +70,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
7070
// string_match:
7171
// exact: m
7272
//
73-
// An example use of MetadataMatcher is specifying additional metadata in envoy.filters.http.rbac to
73+
// An example use of ``MetadataMatcher`` is specifying additional metadata in ``envoy.filters.http.rbac`` to
7474
// enforce access control based on dynamic metadata in a request. See :ref:`Permission
7575
// <envoy_v3_api_msg_config.rbac.v3.Permission>` and :ref:`Principal
7676
// <envoy_v3_api_msg_config.rbac.v3.Principal>`.
@@ -79,28 +79,30 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
7979
message MetadataMatcher {
8080
option (udpa.annotations.versioning).previous_message_type = "envoy.type.matcher.MetadataMatcher";
8181

82-
// Specifies the segment in a path to retrieve value from Metadata.
83-
// Note: Currently it's not supported to retrieve a value from a list in Metadata. This means that
84-
// if the segment key refers to a list, it has to be the last segment in a path.
82+
// Specifies the segment in a path to retrieve value from ``Metadata``.
83+
//
84+
// .. note::
85+
// Currently it's not supported to retrieve a value from a list in ``Metadata``. This means that
86+
// if the segment key refers to a list, it has to be the last segment in a path.
8587
message PathSegment {
8688
option (udpa.annotations.versioning).previous_message_type =
8789
"envoy.type.matcher.MetadataMatcher.PathSegment";
8890

8991
oneof segment {
9092
option (validate.required) = true;
9193

92-
// If specified, use the key to retrieve the value in a Struct.
94+
// If specified, use the key to retrieve the value in a ``Struct``.
9395
string key = 1 [(validate.rules).string = {min_len: 1}];
9496
}
9597
}
9698

97-
// The filter name to retrieve the Struct from the Metadata.
99+
// The filter name to retrieve the ``Struct`` from the ``Metadata``.
98100
string filter = 1 [(validate.rules).string = {min_len: 1}];
99101

100-
// The path to retrieve the Value from the Struct.
102+
// The path to retrieve the ``Value`` from the ``Struct``.
101103
repeated PathSegment path = 2 [(validate.rules).repeated = {min_items: 1}];
102104

103-
// The MetadataMatcher is matched if the value retrieved by path is matched to this value.
105+
// The ``MetadataMatcher`` is matched if the value retrieved by path is matched to this value.
104106
ValueMatcher value = 3 [(validate.rules).message = {required: true}];
105107

106108
// If true, the match result will be inverted.

0 commit comments

Comments
 (0)