18
matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3"
23
func MetadataStringMatcher(filter, key string, m *matcher.StringMatcher) *matcher.MetadataMatcher {
24
return MetadataValueMatcher(filter, key, &matcher.ValueMatcher{
25
MatchPattern: &matcher.ValueMatcher_StringMatch{
33
func MetadataValueMatcher(filter, key string, m *matcher.ValueMatcher) *matcher.MetadataMatcher {
34
return &matcher.MetadataMatcher{
36
Path: []*matcher.MetadataMatcher_PathSegment{
38
Segment: &matcher.MetadataMatcher_PathSegment_Key{
48
func MetadataListMatcher(filter string, keys []string, value *matcher.StringMatcher, useExtendedJwt bool) *matcher.MetadataMatcher {
49
return MetadataListValueMatcher(filter, keys, &matcher.ValueMatcher{
50
MatchPattern: &matcher.ValueMatcher_StringMatch{
57
func MetadataListValueMatcher(filter string, keys []string, value *matcher.ValueMatcher, useExtendedJwt bool) *matcher.MetadataMatcher {
58
listMatcher := &matcher.ListMatcher{
59
MatchPattern: &matcher.ListMatcher_OneOf{
64
paths := make([]*matcher.MetadataMatcher_PathSegment, 0, len(keys))
65
for _, k := range keys {
66
paths = append(paths, &matcher.MetadataMatcher_PathSegment{
67
Segment: &matcher.MetadataMatcher_PathSegment_Key{
73
out := &matcher.MetadataMatcher{
78
out.Value = &matcher.ValueMatcher{
79
MatchPattern: &matcher.ValueMatcher_OrMatch{
80
OrMatch: &matcher.OrMatcher{
81
ValueMatchers: []*matcher.ValueMatcher{
83
MatchPattern: &matcher.ValueMatcher_ListMatch{
84
ListMatch: listMatcher,
93
out.Value = &matcher.ValueMatcher{
94
MatchPattern: &matcher.ValueMatcher_ListMatch{
95
ListMatch: listMatcher,