統一匹配器 API (proto)

.xds.type.matcher.v3.Matcher

[.xds.type.matcher.v3.Matcher proto]

一個匹配器,它可能會遍歷一個匹配樹,以產生一個匹配動作。在匹配期間,將遍歷該樹,直到找到匹配項,或者如果未找到匹配項,則將評估最特定的 on_no_match 指定的動作。由於 on_no_match 可能導致評估另一個匹配樹,因此此過程可能會重複多次,直到決定最終的 OnMatch (或不匹配)。

{
  "matcher_list": {...},
  "matcher_tree": {...},
  "on_no_match": {...}
}
matcher_list

(.xds.type.matcher.v3.Matcher.MatcherList) 要評估的匹配器線性列表。

只能設定 matcher_list, matcher_tree 中的一個。

matcher_tree

(.xds.type.matcher.v3.Matcher.MatcherTree) 要評估的匹配樹。

只能設定 matcher_list, matcher_tree 中的一個。

on_no_match

(.xds.type.matcher.v3.Matcher.OnMatch) 如果上面的匹配器沒有匹配(例如,如果上面沒有指定匹配器,或者如果上面指定的任何匹配都沒有成功),則可選使用的 OnMatch。如果上面的匹配器沒有匹配且此欄位未填寫,則該匹配將被視為不成功。

.xds.type.matcher.v3.Matcher.OnMatch

[.xds.type.matcher.v3.Matcher.OnMatch proto]

如果匹配成功,該怎麼做。

{
  "matcher": {...},
  "action": {...}
}
matcher

(.xds.type.matcher.v3.Matcher) 要評估的巢狀匹配器。如果巢狀匹配器不匹配且未指定 on_no_match,則認為此匹配器沒有匹配,即使此層級或以上的謂詞返回 true。

必須設定 matcher, action 中的一個。

action

(.xds.core.v3.TypedExtensionConfig) 要採取的協定特定動作。

必須設定 matcher, action 中的一個。

.xds.type.matcher.v3.Matcher.MatcherList

[.xds.type.matcher.v3.Matcher.MatcherList proto]

欄位匹配器的線性列表。依序評估欄位匹配器,第一個匹配的獲勝。

{
  "matchers": []
}
matchers

(repeated .xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher, REQUIRED) 匹配器的列表。第一個匹配的獲勝。

.xds.type.matcher.v3.Matcher.MatcherList.Predicate

[.xds.type.matcher.v3.Matcher.MatcherList.Predicate proto]

判斷匹配是否成功的謂詞。

{
  "single_predicate": {...},
  "or_matcher": {...},
  "and_matcher": {...},
  "not_matcher": {...}
}
single_predicate

(.xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate) 要評估的單個謂詞。

必須設定 single_predicate, or_matcher, and_matcher, not_matcher 中的一個。

or_matcher

(.xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList) 要一起進行 OR 運算的謂詞列表。

必須設定 single_predicate, or_matcher, and_matcher, not_matcher 中的一個。

and_matcher

(.xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList) 要一起進行 AND 運算的謂詞列表。

必須設定 single_predicate, or_matcher, and_matcher, not_matcher 中的一個。

not_matcher

(.xds.type.matcher.v3.Matcher.MatcherList.Predicate) 謂詞的反轉

必須設定 single_predicate, or_matcher, and_matcher, not_matcher 中的一個。

.xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate

[.xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate proto]

單個輸入欄位的謂詞。

{
  "input": {...},
  "value_match": {...},
  "custom_match": {...}
}
input

(.xds.core.v3.TypedExtensionConfig, REQUIRED) 要匹配的輸入欄位的協定特定規範。

提示

此擴展類別具有以下已知擴展

value_match

(.xds.type.matcher.v3.StringMatcher) 內建字串匹配器。

必須設定 value_match, custom_match 中的一個。

custom_match

(.xds.core.v3.TypedExtensionConfig) 用於自訂匹配邏輯的擴展。

必須設定 value_match, custom_match 中的一個。

.xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList

[.xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList proto]

兩個或多個匹配器的列表。用於允許在一個 oneof 中使用列表。

{
  "predicate": []
}
predicate

(repeated .xds.type.matcher.v3.Matcher.MatcherList.Predicate, REQUIRED)

.xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher

[.xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher proto]

單個匹配器。

{
  "predicate": {...},
  "on_match": {...}
}
predicate

(.xds.type.matcher.v3.Matcher.MatcherList.Predicate, REQUIRED) 確定匹配是否成功。

on_match

(.xds.type.matcher.v3.Matcher.OnMatch, REQUIRED) 如果匹配成功,該怎麼做。

.xds.type.matcher.v3.Matcher.MatcherTree

[.xds.type.matcher.v3.Matcher.MatcherTree proto]

{
  "input": {...},
  "exact_match_map": {...},
  "prefix_match_map": {...},
  "custom_match": {...}
}
input

(.xds.core.v3.TypedExtensionConfig, REQUIRED) 要匹配的輸入欄位的協定特定規範。

exact_match_map

(.xds.type.matcher.v3.Matcher.MatcherTree.MatchMap) 用於查找輸入值的精確或前綴匹配映射。如果查找成功,則認為匹配成功,並使用對應的 OnMatch。

必須設定 exact_match_map, prefix_match_map, custom_match 中的一個。

prefix_match_map

(.xds.type.matcher.v3.Matcher.MatcherTree.MatchMap) 最長匹配前綴獲勝。

用於查找輸入值的精確或前綴匹配映射。如果查找成功,則認為匹配成功,並使用對應的 OnMatch。

必須設定 exact_match_map, prefix_match_map, custom_match 中的一個。

custom_match

(.xds.core.v3.TypedExtensionConfig) 用於自訂匹配邏輯的擴展。

用於查找輸入值的精確或前綴匹配映射。如果查找成功,則認為匹配成功,並使用對應的 OnMatch。

必須設定 exact_match_map, prefix_match_map, custom_match 中的一個。

.xds.type.matcher.v3.Matcher.MatcherTree.MatchMap

[.xds.type.matcher.v3.Matcher.MatcherTree.MatchMap proto]

已配置匹配器的映射。用於允許在一個 oneof 中使用映射。

{
  "map": {...}
}
map

(repeated map<string, .xds.type.matcher.v3.Matcher.OnMatch>)