From 58e32b4e04f8dfa3295230f00b0d40185e934833 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 11:28:53 -0700 Subject: [PATCH 01/29] Add NodeStringMatch proto definitions Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 40 +- pkg/api/aggregation/v1/aggregation.pb.go | 674 ++++++++++++------ .../aggregation/v1/aggregation.pb.validate.go | 197 ++++- pkg/api/bootstrap/v1/bootstrap.pb.go | 2 +- 4 files changed, 654 insertions(+), 259 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index 69d845f7..09dd765d 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -40,6 +40,30 @@ enum NodeFieldType { NODE_LOCALITY_SUBZONE = 4; } +// TODO: can we reuse envoy's type.matcher.v3.StringMatcher instead? +message NodeStringMatch { + oneof type { + option (validate.required) = true; + + // Match on the extract string value. + string exact_match = 2; + + // Match on a regex pattern. + // TODO potentially use "safe regex" + // https://github.com/envoyproxy/envoy/blob/10f756efa17e56c8d4d1033be7b4286410db4e01/api/envoy/type/matcher/v3/regex.proto + string regex_match = 3; + } +} + +// TODO: how can we import envoy's definition of Locality? +message NodeLocalityMatch { + string region = 1; + + string zone = 2; + + string sub_zone = 3; +} + // This is a recursive structure which allows complex nested match // configurations to be built using various logical operators. // [#next-free-field: 7] @@ -53,23 +77,17 @@ message MatchPredicate { repeated string types = 1 [(validate.rules).repeated.min_items = 1]; } - // Match on a Field in Envoy's request node. + // Match on a field in Envoy's request node. // [#next-free-field: 4] message RequestNodeMatch { - - // Specifies the Envoy Request field that should be matched on. - NodeFieldType field = 1 [(validate.rules).enum.defined_only = true]; - oneof type { option (validate.required) = true; - // Match on the extract string value. - string exact_match = 2; + NodeStringMatch id_match = 1; + + NodeStringMatch cluster_match = 2; - // Match on a regex pattern. - // TODO potentially use "safe regex" - // https://github.com/envoyproxy/envoy/blob/10f756efa17e56c8d4d1033be7b4286410db4e01/api/envoy/type/matcher/v3/regex.proto - string regex_match = 3; + NodeLocalityMatch locality_match = 3; } } diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index 0b52836d..58e32657 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.go +++ b/pkg/api/aggregation/v1/aggregation.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.20.1 +// protoc-gen-go v1.23.0 // protoc v3.11.4 // source: aggregation/v1/aggregation.proto @@ -130,6 +130,155 @@ func (x *KeyerConfiguration) GetFragments() []*KeyerConfiguration_Fragment { return nil } +// TODO: can we reuse envoy's type.matcher.v3.StringMatcher instead? +type NodeStringMatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Type: + // *NodeStringMatch_ExactMatch + // *NodeStringMatch_RegexMatch + Type isNodeStringMatch_Type `protobuf_oneof:"type"` +} + +func (x *NodeStringMatch) Reset() { + *x = NodeStringMatch{} + if protoimpl.UnsafeEnabled { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeStringMatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeStringMatch) ProtoMessage() {} + +func (x *NodeStringMatch) ProtoReflect() protoreflect.Message { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeStringMatch.ProtoReflect.Descriptor instead. +func (*NodeStringMatch) Descriptor() ([]byte, []int) { + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1} +} + +func (m *NodeStringMatch) GetType() isNodeStringMatch_Type { + if m != nil { + return m.Type + } + return nil +} + +func (x *NodeStringMatch) GetExactMatch() string { + if x, ok := x.GetType().(*NodeStringMatch_ExactMatch); ok { + return x.ExactMatch + } + return "" +} + +func (x *NodeStringMatch) GetRegexMatch() string { + if x, ok := x.GetType().(*NodeStringMatch_RegexMatch); ok { + return x.RegexMatch + } + return "" +} + +type isNodeStringMatch_Type interface { + isNodeStringMatch_Type() +} + +type NodeStringMatch_ExactMatch struct { + // Match on the extract string value. + ExactMatch string `protobuf:"bytes,2,opt,name=exact_match,json=exactMatch,proto3,oneof"` +} + +type NodeStringMatch_RegexMatch struct { + // Match on a regex pattern. + // TODO potentially use "safe regex" + // https://github.com/envoyproxy/envoy/blob/10f756efa17e56c8d4d1033be7b4286410db4e01/api/envoy/type/matcher/v3/regex.proto + RegexMatch string `protobuf:"bytes,3,opt,name=regex_match,json=regexMatch,proto3,oneof"` +} + +func (*NodeStringMatch_ExactMatch) isNodeStringMatch_Type() {} + +func (*NodeStringMatch_RegexMatch) isNodeStringMatch_Type() {} + +// TODO: how can we import envoy's definition of Locality? +type NodeLocalityMatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + Zone string `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"` + SubZone string `protobuf:"bytes,3,opt,name=sub_zone,json=subZone,proto3" json:"sub_zone,omitempty"` +} + +func (x *NodeLocalityMatch) Reset() { + *x = NodeLocalityMatch{} + if protoimpl.UnsafeEnabled { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeLocalityMatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeLocalityMatch) ProtoMessage() {} + +func (x *NodeLocalityMatch) ProtoReflect() protoreflect.Message { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeLocalityMatch.ProtoReflect.Descriptor instead. +func (*NodeLocalityMatch) Descriptor() ([]byte, []int) { + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2} +} + +func (x *NodeLocalityMatch) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *NodeLocalityMatch) GetZone() string { + if x != nil { + return x.Zone + } + return "" +} + +func (x *NodeLocalityMatch) GetSubZone() string { + if x != nil { + return x.SubZone + } + return "" +} + // This is a recursive structure which allows complex nested match // configurations to be built using various logical operators. // [#next-free-field: 7] @@ -151,7 +300,7 @@ type MatchPredicate struct { func (x *MatchPredicate) Reset() { *x = MatchPredicate{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -164,7 +313,7 @@ func (x *MatchPredicate) String() string { func (*MatchPredicate) ProtoMessage() {} func (x *MatchPredicate) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -177,7 +326,7 @@ func (x *MatchPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchPredicate.ProtoReflect.Descriptor instead. func (*MatchPredicate) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{3} } func (m *MatchPredicate) GetType() isMatchPredicate_Type { @@ -298,7 +447,7 @@ type ResultPredicate struct { func (x *ResultPredicate) Reset() { *x = ResultPredicate{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -311,7 +460,7 @@ func (x *ResultPredicate) String() string { func (*ResultPredicate) ProtoMessage() {} func (x *ResultPredicate) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -324,7 +473,7 @@ func (x *ResultPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultPredicate.ProtoReflect.Descriptor instead. func (*ResultPredicate) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4} } func (m *ResultPredicate) GetType() isResultPredicate_Type { @@ -408,7 +557,7 @@ type KeyerConfiguration_Fragment struct { func (x *KeyerConfiguration_Fragment) Reset() { *x = KeyerConfiguration_Fragment{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[3] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -421,7 +570,7 @@ func (x *KeyerConfiguration_Fragment) String() string { func (*KeyerConfiguration_Fragment) ProtoMessage() {} func (x *KeyerConfiguration_Fragment) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[3] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -461,7 +610,7 @@ type KeyerConfiguration_Fragment_Rule struct { func (x *KeyerConfiguration_Fragment_Rule) Reset() { *x = KeyerConfiguration_Fragment_Rule{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[4] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -474,7 +623,7 @@ func (x *KeyerConfiguration_Fragment_Rule) String() string { func (*KeyerConfiguration_Fragment_Rule) ProtoMessage() {} func (x *KeyerConfiguration_Fragment_Rule) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[4] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -519,7 +668,7 @@ type MatchPredicate_RequestTypeMatch struct { func (x *MatchPredicate_RequestTypeMatch) Reset() { *x = MatchPredicate_RequestTypeMatch{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[5] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -532,7 +681,7 @@ func (x *MatchPredicate_RequestTypeMatch) String() string { func (*MatchPredicate_RequestTypeMatch) ProtoMessage() {} func (x *MatchPredicate_RequestTypeMatch) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[5] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -545,7 +694,7 @@ func (x *MatchPredicate_RequestTypeMatch) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchPredicate_RequestTypeMatch.ProtoReflect.Descriptor instead. func (*MatchPredicate_RequestTypeMatch) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1, 0} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{3, 0} } func (x *MatchPredicate_RequestTypeMatch) GetTypes() []string { @@ -555,25 +704,24 @@ func (x *MatchPredicate_RequestTypeMatch) GetTypes() []string { return nil } -// Match on a Field in Envoy's request node. +// Match on a field in Envoy's request node. // [#next-free-field: 4] type MatchPredicate_RequestNodeMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Specifies the Envoy Request field that should be matched on. - Field NodeFieldType `protobuf:"varint,1,opt,name=field,proto3,enum=aggregation.NodeFieldType" json:"field,omitempty"` // Types that are assignable to Type: - // *MatchPredicate_RequestNodeMatch_ExactMatch - // *MatchPredicate_RequestNodeMatch_RegexMatch + // *MatchPredicate_RequestNodeMatch_IdMatch + // *MatchPredicate_RequestNodeMatch_ClusterMatch + // *MatchPredicate_RequestNodeMatch_LocalityMatch Type isMatchPredicate_RequestNodeMatch_Type `protobuf_oneof:"type"` } func (x *MatchPredicate_RequestNodeMatch) Reset() { *x = MatchPredicate_RequestNodeMatch{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[6] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -586,7 +734,7 @@ func (x *MatchPredicate_RequestNodeMatch) String() string { func (*MatchPredicate_RequestNodeMatch) ProtoMessage() {} func (x *MatchPredicate_RequestNodeMatch) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[6] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -599,14 +747,7 @@ func (x *MatchPredicate_RequestNodeMatch) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchPredicate_RequestNodeMatch.ProtoReflect.Descriptor instead. func (*MatchPredicate_RequestNodeMatch) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1, 1} -} - -func (x *MatchPredicate_RequestNodeMatch) GetField() NodeFieldType { - if x != nil { - return x.Field - } - return NodeFieldType_NODE_ID + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{3, 1} } func (m *MatchPredicate_RequestNodeMatch) GetType() isMatchPredicate_RequestNodeMatch_Type { @@ -616,39 +757,48 @@ func (m *MatchPredicate_RequestNodeMatch) GetType() isMatchPredicate_RequestNode return nil } -func (x *MatchPredicate_RequestNodeMatch) GetExactMatch() string { - if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_ExactMatch); ok { - return x.ExactMatch +func (x *MatchPredicate_RequestNodeMatch) GetIdMatch() *NodeStringMatch { + if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_IdMatch); ok { + return x.IdMatch } - return "" + return nil } -func (x *MatchPredicate_RequestNodeMatch) GetRegexMatch() string { - if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_RegexMatch); ok { - return x.RegexMatch +func (x *MatchPredicate_RequestNodeMatch) GetClusterMatch() *NodeStringMatch { + if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_ClusterMatch); ok { + return x.ClusterMatch } - return "" + return nil +} + +func (x *MatchPredicate_RequestNodeMatch) GetLocalityMatch() *NodeLocalityMatch { + if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_LocalityMatch); ok { + return x.LocalityMatch + } + return nil } type isMatchPredicate_RequestNodeMatch_Type interface { isMatchPredicate_RequestNodeMatch_Type() } -type MatchPredicate_RequestNodeMatch_ExactMatch struct { - // Match on the extract string value. - ExactMatch string `protobuf:"bytes,2,opt,name=exact_match,json=exactMatch,proto3,oneof"` +type MatchPredicate_RequestNodeMatch_IdMatch struct { + IdMatch *NodeStringMatch `protobuf:"bytes,1,opt,name=id_match,json=idMatch,proto3,oneof"` } -type MatchPredicate_RequestNodeMatch_RegexMatch struct { - // Match on a regex pattern. - // TODO potentially use "safe regex" - // https://github.com/envoyproxy/envoy/blob/10f756efa17e56c8d4d1033be7b4286410db4e01/api/envoy/type/matcher/v3/regex.proto - RegexMatch string `protobuf:"bytes,3,opt,name=regex_match,json=regexMatch,proto3,oneof"` +type MatchPredicate_RequestNodeMatch_ClusterMatch struct { + ClusterMatch *NodeStringMatch `protobuf:"bytes,2,opt,name=cluster_match,json=clusterMatch,proto3,oneof"` +} + +type MatchPredicate_RequestNodeMatch_LocalityMatch struct { + LocalityMatch *NodeLocalityMatch `protobuf:"bytes,3,opt,name=locality_match,json=localityMatch,proto3,oneof"` } -func (*MatchPredicate_RequestNodeMatch_ExactMatch) isMatchPredicate_RequestNodeMatch_Type() {} +func (*MatchPredicate_RequestNodeMatch_IdMatch) isMatchPredicate_RequestNodeMatch_Type() {} -func (*MatchPredicate_RequestNodeMatch_RegexMatch) isMatchPredicate_RequestNodeMatch_Type() {} +func (*MatchPredicate_RequestNodeMatch_ClusterMatch) isMatchPredicate_RequestNodeMatch_Type() {} + +func (*MatchPredicate_RequestNodeMatch_LocalityMatch) isMatchPredicate_RequestNodeMatch_Type() {} // A set of match configurations used for logical operations. // [#next-free-field: 2] @@ -664,7 +814,7 @@ type MatchPredicate_MatchSet struct { func (x *MatchPredicate_MatchSet) Reset() { *x = MatchPredicate_MatchSet{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[7] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -677,7 +827,7 @@ func (x *MatchPredicate_MatchSet) String() string { func (*MatchPredicate_MatchSet) ProtoMessage() {} func (x *MatchPredicate_MatchSet) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[7] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -690,7 +840,7 @@ func (x *MatchPredicate_MatchSet) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchPredicate_MatchSet.ProtoReflect.Descriptor instead. func (*MatchPredicate_MatchSet) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1, 2} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{3, 2} } func (x *MatchPredicate_MatchSet) GetRules() []*MatchPredicate { @@ -714,7 +864,7 @@ type ResultPredicate_ResultAction struct { func (x *ResultPredicate_ResultAction) Reset() { *x = ResultPredicate_ResultAction{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[8] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -727,7 +877,7 @@ func (x *ResultPredicate_ResultAction) String() string { func (*ResultPredicate_ResultAction) ProtoMessage() {} func (x *ResultPredicate_ResultAction) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[8] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -740,7 +890,7 @@ func (x *ResultPredicate_ResultAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultPredicate_ResultAction.ProtoReflect.Descriptor instead. func (*ResultPredicate_ResultAction) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2, 0} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 0} } func (m *ResultPredicate_ResultAction) GetAction() isResultPredicate_ResultAction_Action { @@ -793,7 +943,7 @@ type ResultPredicate_AndResult struct { func (x *ResultPredicate_AndResult) Reset() { *x = ResultPredicate_AndResult{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[9] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -806,7 +956,7 @@ func (x *ResultPredicate_AndResult) String() string { func (*ResultPredicate_AndResult) ProtoMessage() {} func (x *ResultPredicate_AndResult) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[9] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -819,7 +969,7 @@ func (x *ResultPredicate_AndResult) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultPredicate_AndResult.ProtoReflect.Descriptor instead. func (*ResultPredicate_AndResult) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2, 1} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 1} } func (x *ResultPredicate_AndResult) GetResultPredicates() []*ResultPredicate { @@ -843,7 +993,7 @@ type ResultPredicate_RequestNodeFragment struct { func (x *ResultPredicate_RequestNodeFragment) Reset() { *x = ResultPredicate_RequestNodeFragment{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[10] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -856,7 +1006,7 @@ func (x *ResultPredicate_RequestNodeFragment) String() string { func (*ResultPredicate_RequestNodeFragment) ProtoMessage() {} func (x *ResultPredicate_RequestNodeFragment) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[10] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -869,7 +1019,7 @@ func (x *ResultPredicate_RequestNodeFragment) ProtoReflect() protoreflect.Messag // Deprecated: Use ResultPredicate_RequestNodeFragment.ProtoReflect.Descriptor instead. func (*ResultPredicate_RequestNodeFragment) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2, 2} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 2} } func (x *ResultPredicate_RequestNodeFragment) GetField() NodeFieldType { @@ -902,7 +1052,7 @@ type ResultPredicate_ResourceNamesFragment struct { func (x *ResultPredicate_ResourceNamesFragment) Reset() { *x = ResultPredicate_ResourceNamesFragment{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -915,7 +1065,7 @@ func (x *ResultPredicate_ResourceNamesFragment) String() string { func (*ResultPredicate_ResourceNamesFragment) ProtoMessage() {} func (x *ResultPredicate_ResourceNamesFragment) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -928,7 +1078,7 @@ func (x *ResultPredicate_ResourceNamesFragment) ProtoReflect() protoreflect.Mess // Deprecated: Use ResultPredicate_ResourceNamesFragment.ProtoReflect.Descriptor instead. func (*ResultPredicate_ResourceNamesFragment) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2, 3} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 3} } func (x *ResultPredicate_ResourceNamesFragment) GetElement() int32 { @@ -960,7 +1110,7 @@ type ResultPredicate_ResultAction_RegexAction struct { func (x *ResultPredicate_ResultAction_RegexAction) Reset() { *x = ResultPredicate_ResultAction_RegexAction{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -973,7 +1123,7 @@ func (x *ResultPredicate_ResultAction_RegexAction) String() string { func (*ResultPredicate_ResultAction_RegexAction) ProtoMessage() {} func (x *ResultPredicate_ResultAction_RegexAction) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -986,7 +1136,7 @@ func (x *ResultPredicate_ResultAction_RegexAction) ProtoReflect() protoreflect.M // Deprecated: Use ResultPredicate_ResultAction_RegexAction.ProtoReflect.Descriptor instead. func (*ResultPredicate_ResultAction_RegexAction) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2, 0, 0} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 0, 0} } func (x *ResultPredicate_ResultAction_RegexAction) GetPattern() string { @@ -1031,126 +1181,143 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0xe6, 0x05, 0x0a, 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, - 0x00, 0x52, 0x08, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x41, 0x0a, 0x08, 0x6f, - 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, - 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, - 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, 0x61, 0x6e, - 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, + 0x75, 0x6c, 0x74, 0x22, 0x64, 0x0a, 0x0f, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x65, + 0x78, 0x61, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x72, 0x65, 0x67, + 0x65, 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x0a, 0x72, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x5a, 0x0a, 0x11, 0x4e, 0x6f, 0x64, + 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, + 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, + 0x62, 0x5f, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, + 0x62, 0x5a, 0x6f, 0x6e, 0x65, 0x22, 0xad, 0x06, 0x0a, 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, + 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, + 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, + 0x74, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x41, 0x0a, + 0x08, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x3a, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x48, 0x00, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, + 0x61, 0x6e, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, + 0x52, 0x10, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x32, - 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x1a, 0xa1, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, - 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x12, 0x21, 0x0a, 0x0b, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x61, 0x63, - 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x72, - 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x47, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, - 0x65, 0x74, 0x12, 0x3b, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, - 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, - 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xe7, 0x07, 0x0a, - 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x2e, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x09, - 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x6c, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, - 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x29, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0xef, 0x01, 0x0a, 0x0c, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x05, 0x65, - 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, - 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x5a, 0x0a, 0x0c, - 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, - 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x67, - 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x53, 0x0a, 0x0b, 0x52, 0x65, 0x67, 0x65, - 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x72, 0x65, - 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x00, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x0d, 0x0a, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x60, 0x0a, 0x09, - 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x11, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x9e, - 0x01, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, - 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, - 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, - 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, - 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, - 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, - 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, - 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, - 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, - 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, - 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, - 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, - 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, - 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x1a, 0x32, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x1a, 0xe8, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x39, 0x0a, 0x08, 0x69, 0x64, 0x5f, + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x07, 0x69, 0x64, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x12, 0x43, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x47, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, + 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x48, 0x00, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, + 0x47, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x12, 0x3b, 0x0a, 0x05, 0x72, + 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, + 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, + 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, + 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xe7, 0x07, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x6e, 0x64, + 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6e, 0x64, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x09, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x30, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, + 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6c, 0x0a, 0x17, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x66, 0x72, 0x61, + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, + 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, + 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x1a, 0xef, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x05, + 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x5a, 0x0a, 0x0c, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x1a, 0x53, 0x0a, 0x0b, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x00, 0x52, 0x07, 0x72, + 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x60, 0x0a, 0x09, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, + 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x9e, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x3a, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, + 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, + 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x4b, 0x0a, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, + 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, + 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, + 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, + 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, + 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, + 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, + 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, + 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, + 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1166,48 +1333,52 @@ func file_aggregation_v1_aggregation_proto_rawDescGZIP() []byte { } var file_aggregation_v1_aggregation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_aggregation_v1_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_aggregation_v1_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ (NodeFieldType)(0), // 0: aggregation.NodeFieldType (*KeyerConfiguration)(nil), // 1: aggregation.KeyerConfiguration - (*MatchPredicate)(nil), // 2: aggregation.MatchPredicate - (*ResultPredicate)(nil), // 3: aggregation.ResultPredicate - (*KeyerConfiguration_Fragment)(nil), // 4: aggregation.KeyerConfiguration.Fragment - (*KeyerConfiguration_Fragment_Rule)(nil), // 5: aggregation.KeyerConfiguration.Fragment.Rule - (*MatchPredicate_RequestTypeMatch)(nil), // 6: aggregation.MatchPredicate.RequestTypeMatch - (*MatchPredicate_RequestNodeMatch)(nil), // 7: aggregation.MatchPredicate.RequestNodeMatch - (*MatchPredicate_MatchSet)(nil), // 8: aggregation.MatchPredicate.MatchSet - (*ResultPredicate_ResultAction)(nil), // 9: aggregation.ResultPredicate.ResultAction - (*ResultPredicate_AndResult)(nil), // 10: aggregation.ResultPredicate.AndResult - (*ResultPredicate_RequestNodeFragment)(nil), // 11: aggregation.ResultPredicate.RequestNodeFragment - (*ResultPredicate_ResourceNamesFragment)(nil), // 12: aggregation.ResultPredicate.ResourceNamesFragment - (*ResultPredicate_ResultAction_RegexAction)(nil), // 13: aggregation.ResultPredicate.ResultAction.RegexAction + (*NodeStringMatch)(nil), // 2: aggregation.NodeStringMatch + (*NodeLocalityMatch)(nil), // 3: aggregation.NodeLocalityMatch + (*MatchPredicate)(nil), // 4: aggregation.MatchPredicate + (*ResultPredicate)(nil), // 5: aggregation.ResultPredicate + (*KeyerConfiguration_Fragment)(nil), // 6: aggregation.KeyerConfiguration.Fragment + (*KeyerConfiguration_Fragment_Rule)(nil), // 7: aggregation.KeyerConfiguration.Fragment.Rule + (*MatchPredicate_RequestTypeMatch)(nil), // 8: aggregation.MatchPredicate.RequestTypeMatch + (*MatchPredicate_RequestNodeMatch)(nil), // 9: aggregation.MatchPredicate.RequestNodeMatch + (*MatchPredicate_MatchSet)(nil), // 10: aggregation.MatchPredicate.MatchSet + (*ResultPredicate_ResultAction)(nil), // 11: aggregation.ResultPredicate.ResultAction + (*ResultPredicate_AndResult)(nil), // 12: aggregation.ResultPredicate.AndResult + (*ResultPredicate_RequestNodeFragment)(nil), // 13: aggregation.ResultPredicate.RequestNodeFragment + (*ResultPredicate_ResourceNamesFragment)(nil), // 14: aggregation.ResultPredicate.ResourceNamesFragment + (*ResultPredicate_ResultAction_RegexAction)(nil), // 15: aggregation.ResultPredicate.ResultAction.RegexAction } var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ - 4, // 0: aggregation.KeyerConfiguration.fragments:type_name -> aggregation.KeyerConfiguration.Fragment - 8, // 1: aggregation.MatchPredicate.and_match:type_name -> aggregation.MatchPredicate.MatchSet - 8, // 2: aggregation.MatchPredicate.or_match:type_name -> aggregation.MatchPredicate.MatchSet - 2, // 3: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate - 6, // 4: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch - 7, // 5: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch - 10, // 6: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult - 11, // 7: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment - 12, // 8: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment - 5, // 9: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule - 2, // 10: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate - 3, // 11: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate - 0, // 12: aggregation.MatchPredicate.RequestNodeMatch.field:type_name -> aggregation.NodeFieldType - 2, // 13: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate - 13, // 14: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction - 3, // 15: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate - 0, // 16: aggregation.ResultPredicate.RequestNodeFragment.field:type_name -> aggregation.NodeFieldType - 9, // 17: aggregation.ResultPredicate.RequestNodeFragment.action:type_name -> aggregation.ResultPredicate.ResultAction - 9, // 18: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 6, // 0: aggregation.KeyerConfiguration.fragments:type_name -> aggregation.KeyerConfiguration.Fragment + 10, // 1: aggregation.MatchPredicate.and_match:type_name -> aggregation.MatchPredicate.MatchSet + 10, // 2: aggregation.MatchPredicate.or_match:type_name -> aggregation.MatchPredicate.MatchSet + 4, // 3: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate + 8, // 4: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch + 9, // 5: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch + 12, // 6: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult + 13, // 7: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment + 14, // 8: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment + 7, // 9: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule + 4, // 10: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate + 5, // 11: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate + 2, // 12: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.NodeStringMatch + 2, // 13: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.NodeStringMatch + 3, // 14: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.NodeLocalityMatch + 4, // 15: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate + 15, // 16: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction + 5, // 17: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate + 0, // 18: aggregation.ResultPredicate.RequestNodeFragment.field:type_name -> aggregation.NodeFieldType + 11, // 19: aggregation.ResultPredicate.RequestNodeFragment.action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 20: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction + 21, // [21:21] is the sub-list for method output_type + 21, // [21:21] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name } func init() { file_aggregation_v1_aggregation_proto_init() } @@ -1229,7 +1400,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MatchPredicate); i { + switch v := v.(*NodeStringMatch); i { case 0: return &v.state case 1: @@ -1241,7 +1412,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate); i { + switch v := v.(*NodeLocalityMatch); i { case 0: return &v.state case 1: @@ -1253,7 +1424,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyerConfiguration_Fragment); i { + switch v := v.(*MatchPredicate); i { case 0: return &v.state case 1: @@ -1265,7 +1436,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyerConfiguration_Fragment_Rule); i { + switch v := v.(*ResultPredicate); i { case 0: return &v.state case 1: @@ -1277,7 +1448,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MatchPredicate_RequestTypeMatch); i { + switch v := v.(*KeyerConfiguration_Fragment); i { case 0: return &v.state case 1: @@ -1289,7 +1460,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MatchPredicate_RequestNodeMatch); i { + switch v := v.(*KeyerConfiguration_Fragment_Rule); i { case 0: return &v.state case 1: @@ -1301,7 +1472,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MatchPredicate_MatchSet); i { + switch v := v.(*MatchPredicate_RequestTypeMatch); i { case 0: return &v.state case 1: @@ -1313,7 +1484,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_ResultAction); i { + switch v := v.(*MatchPredicate_RequestNodeMatch); i { case 0: return &v.state case 1: @@ -1325,7 +1496,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_AndResult); i { + switch v := v.(*MatchPredicate_MatchSet); i { case 0: return &v.state case 1: @@ -1337,7 +1508,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_RequestNodeFragment); i { + switch v := v.(*ResultPredicate_ResultAction); i { case 0: return &v.state case 1: @@ -1349,7 +1520,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_ResourceNamesFragment); i { + switch v := v.(*ResultPredicate_AndResult); i { case 0: return &v.state case 1: @@ -1361,6 +1532,30 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResultPredicate_RequestNodeFragment); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aggregation_v1_aggregation_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResultPredicate_ResourceNamesFragment); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aggregation_v1_aggregation_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultPredicate_ResultAction_RegexAction); i { case 0: return &v.state @@ -1374,6 +1569,10 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*NodeStringMatch_ExactMatch)(nil), + (*NodeStringMatch_RegexMatch)(nil), + } + file_aggregation_v1_aggregation_proto_msgTypes[3].OneofWrappers = []interface{}{ (*MatchPredicate_AndMatch)(nil), (*MatchPredicate_OrMatch)(nil), (*MatchPredicate_NotMatch)(nil), @@ -1381,17 +1580,18 @@ func file_aggregation_v1_aggregation_proto_init() { (*MatchPredicate_RequestTypeMatch_)(nil), (*MatchPredicate_RequestNodeMatch_)(nil), } - file_aggregation_v1_aggregation_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_aggregation_v1_aggregation_proto_msgTypes[4].OneofWrappers = []interface{}{ (*ResultPredicate_AndResult_)(nil), (*ResultPredicate_RequestNodeFragment_)(nil), (*ResultPredicate_ResourceNamesFragment_)(nil), (*ResultPredicate_StringFragment)(nil), } - file_aggregation_v1_aggregation_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*MatchPredicate_RequestNodeMatch_ExactMatch)(nil), - (*MatchPredicate_RequestNodeMatch_RegexMatch)(nil), - } file_aggregation_v1_aggregation_proto_msgTypes[8].OneofWrappers = []interface{}{ + (*MatchPredicate_RequestNodeMatch_IdMatch)(nil), + (*MatchPredicate_RequestNodeMatch_ClusterMatch)(nil), + (*MatchPredicate_RequestNodeMatch_LocalityMatch)(nil), + } + file_aggregation_v1_aggregation_proto_msgTypes[10].OneofWrappers = []interface{}{ (*ResultPredicate_ResultAction_Exact)(nil), (*ResultPredicate_ResultAction_RegexAction_)(nil), } @@ -1401,7 +1601,7 @@ func file_aggregation_v1_aggregation_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_aggregation_v1_aggregation_proto_rawDesc, NumEnums: 1, - NumMessages: 13, + NumMessages: 15, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/api/aggregation/v1/aggregation.pb.validate.go b/pkg/api/aggregation/v1/aggregation.pb.validate.go index e5e4101e..9694f08e 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.validate.go +++ b/pkg/api/aggregation/v1/aggregation.pb.validate.go @@ -125,6 +125,160 @@ var _ interface { ErrorName() string } = KeyerConfigurationValidationError{} +// Validate checks the field values on NodeStringMatch with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *NodeStringMatch) Validate() error { + if m == nil { + return nil + } + + switch m.Type.(type) { + + case *NodeStringMatch_ExactMatch: + // no validation rules for ExactMatch + + case *NodeStringMatch_RegexMatch: + // no validation rules for RegexMatch + + default: + return NodeStringMatchValidationError{ + field: "Type", + reason: "value is required", + } + + } + + return nil +} + +// NodeStringMatchValidationError is the validation error returned by +// NodeStringMatch.Validate if the designated constraints aren't met. +type NodeStringMatchValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e NodeStringMatchValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e NodeStringMatchValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e NodeStringMatchValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e NodeStringMatchValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e NodeStringMatchValidationError) ErrorName() string { return "NodeStringMatchValidationError" } + +// Error satisfies the builtin error interface +func (e NodeStringMatchValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sNodeStringMatch.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = NodeStringMatchValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = NodeStringMatchValidationError{} + +// Validate checks the field values on NodeLocalityMatch with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *NodeLocalityMatch) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Region + + // no validation rules for Zone + + // no validation rules for SubZone + + return nil +} + +// NodeLocalityMatchValidationError is the validation error returned by +// NodeLocalityMatch.Validate if the designated constraints aren't met. +type NodeLocalityMatchValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e NodeLocalityMatchValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e NodeLocalityMatchValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e NodeLocalityMatchValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e NodeLocalityMatchValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e NodeLocalityMatchValidationError) ErrorName() string { + return "NodeLocalityMatchValidationError" +} + +// Error satisfies the builtin error interface +func (e NodeLocalityMatchValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sNodeLocalityMatch.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = NodeLocalityMatchValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = NodeLocalityMatchValidationError{} + // Validate checks the field values on MatchPredicate with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. @@ -658,20 +812,43 @@ func (m *MatchPredicate_RequestNodeMatch) Validate() error { return nil } - if _, ok := NodeFieldType_name[int32(m.GetField())]; !ok { - return MatchPredicate_RequestNodeMatchValidationError{ - field: "Field", - reason: "value must be one of the defined enum values", + switch m.Type.(type) { + + case *MatchPredicate_RequestNodeMatch_IdMatch: + + if v, ok := interface{}(m.GetIdMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return MatchPredicate_RequestNodeMatchValidationError{ + field: "IdMatch", + reason: "embedded message failed validation", + cause: err, + } + } } - } - switch m.Type.(type) { + case *MatchPredicate_RequestNodeMatch_ClusterMatch: - case *MatchPredicate_RequestNodeMatch_ExactMatch: - // no validation rules for ExactMatch + if v, ok := interface{}(m.GetClusterMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return MatchPredicate_RequestNodeMatchValidationError{ + field: "ClusterMatch", + reason: "embedded message failed validation", + cause: err, + } + } + } - case *MatchPredicate_RequestNodeMatch_RegexMatch: - // no validation rules for RegexMatch + case *MatchPredicate_RequestNodeMatch_LocalityMatch: + + if v, ok := interface{}(m.GetLocalityMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return MatchPredicate_RequestNodeMatchValidationError{ + field: "LocalityMatch", + reason: "embedded message failed validation", + cause: err, + } + } + } default: return MatchPredicate_RequestNodeMatchValidationError{ diff --git a/pkg/api/bootstrap/v1/bootstrap.pb.go b/pkg/api/bootstrap/v1/bootstrap.pb.go index b7189749..ce2cc303 100644 --- a/pkg/api/bootstrap/v1/bootstrap.pb.go +++ b/pkg/api/bootstrap/v1/bootstrap.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.20.1 +// protoc-gen-go v1.23.0 // protoc v3.11.4 // source: bootstrap/v1/bootstrap.proto From 79b29042a63fc7798bb4ac9a70726f6c96b80470 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 11:29:30 -0700 Subject: [PATCH 02/29] Expose Locality in RequestV2 Signed-off-by: eapolinario --- internal/app/transport/request.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/app/transport/request.go b/internal/app/transport/request.go index 9d611849..7d53804d 100644 --- a/internal/app/transport/request.go +++ b/internal/app/transport/request.go @@ -2,6 +2,7 @@ package transport import ( discoveryv2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" + corev2 "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" structpb "github.com/golang/protobuf/ptypes/struct" status "google.golang.org/genproto/googleapis/rpc/status" ) @@ -22,6 +23,7 @@ type Request interface { GetError() *status.Status IsNodeEmpty() bool IsEmptyLocality() bool + GetLocality() *corev2.Locality GetRegion() string GetZone() string GetSubZone() string @@ -92,6 +94,10 @@ func (r *RequestV2) IsEmptyLocality() bool { return r.r.GetNode().Locality == nil } +func (r *RequestV2) GetLocality() *corev2.Locality { + return r.r.GetNode().Locality +} + // GetRegion gets the error details func (r *RequestV2) GetRegion() string { return r.r.GetNode().GetLocality().GetRegion() From 4292fc245583ff71f7b8ab467f66385aa3d39eba Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 12:05:55 -0700 Subject: [PATCH 03/29] Replace uses of node field type in isNodeMatch Signed-off-by: eapolinario --- internal/app/mapper/mapper.go | 62 ++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 8785a085..763eefc4 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -5,6 +5,7 @@ import ( "regexp" "strings" + corev2 "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" "github.com/envoyproxy/xds-relay/internal/app/metrics" "github.com/envoyproxy/xds-relay/internal/app/transport" @@ -124,20 +125,25 @@ func isNodeMatch(matchPredicate *matchPredicate, req transport.Request) (bool, e if predicate == nil { return false, nil } - switch predicate.GetField() { - case aggregationv1.NodeFieldType_NODE_CLUSTER: - return compare(predicate, req.GetCluster()) - case aggregationv1.NodeFieldType_NODE_ID: - return compare(predicate, req.GetNodeID()) - case aggregationv1.NodeFieldType_NODE_LOCALITY_REGION: - return compare(predicate, req.GetRegion()) - case aggregationv1.NodeFieldType_NODE_LOCALITY_ZONE: - return compare(predicate, req.GetZone()) - case aggregationv1.NodeFieldType_NODE_LOCALITY_SUBZONE: - return compare(predicate, req.GetSubZone()) - default: - return false, fmt.Errorf("RequestNodeMatch does not have a valid NodeFieldType") + + // By construction only one of these is set at any point in time, so checking one by one + // sequentially is ok. + id_match := predicate.GetIdMatch() + if id_match != nil { + return compareString(id_match, req.GetNodeID()) + } + + cluster_match := predicate.GetClusterMatch() + if cluster_match != nil { + return compareString(cluster_match, req.GetCluster()) + } + + locality_match := predicate.GetLocalityMatch() + if locality_match != nil { + return compareLocality(locality_match, req.GetLocality()) } + + return false, fmt.Errorf("RequestNodeMatch is invalid") } func isRequestTypeMatch(matchPredicate *matchPredicate, typeURL string) bool { @@ -402,16 +408,16 @@ func getResultFragmentFromAction( return replacedFragment, nil } -func compare(requestNodeMatch *aggregationv1.MatchPredicate_RequestNodeMatch, nodeValue string) (bool, error) { +func compareString(nodeStringMatch *aggregationv1.NodeStringMatch, nodeValue string) (bool, error) { if nodeValue == "" { return false, fmt.Errorf("MatchPredicate Node field cannot be empty") } - exactMatch := requestNodeMatch.GetExactMatch() + exactMatch := nodeStringMatch.GetExactMatch() if exactMatch != "" { return nodeValue == exactMatch, nil } - regexMatch := requestNodeMatch.GetRegexMatch() + regexMatch := nodeStringMatch.GetRegexMatch() if regexMatch != "" { match, err := regexp.MatchString(regexMatch, nodeValue) if err != nil { @@ -422,3 +428,27 @@ func compare(requestNodeMatch *aggregationv1.MatchPredicate_RequestNodeMatch, no return false, nil } + +func compareLocality(nodeLocalityMatch *aggregationv1.NodeLocalityMatch, reqNodeLocality *corev2.Locality) (bool, error) { + // TODO if we can reuse envoy's Locality object, make sure to use cmp.Equal + if reqNodeLocality == nil { + return false, fmt.Errorf("Locality Node field cannot be empty") + } + + regionMatch := true + if nodeLocalityMatch.Region != "" && reqNodeLocality.Region != "" { + regionMatch = nodeLocalityMatch.Region == reqNodeLocality.Region + } + + zoneMatch := true + if nodeLocalityMatch.Zone != "" && reqNodeLocality.Zone != "" { + zoneMatch = nodeLocalityMatch.Zone == reqNodeLocality.Zone + } + + subZoneMatch := true + if nodeLocalityMatch.SubZone != "" && reqNodeLocality.SubZone != "" { + subZoneMatch = nodeLocalityMatch.SubZone == reqNodeLocality.SubZone + } + + return regionMatch && zoneMatch && subZoneMatch, nil +} From cd3e7f0abaa5fb11b21c779f5cff1fe66f9259cb Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 12:10:17 -0700 Subject: [PATCH 04/29] fix mapper_test tests cases related to node cluster and node id. Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 870 +++++++++++++++-------------- 1 file changed, 463 insertions(+), 407 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 5d2ad0fd..3013f404 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -77,7 +77,7 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node id exact match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid), + getRequestNodeIdExactMatch(nodeid), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -86,43 +86,43 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node cluster exact match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, nodecluster), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "RequestNodeMatch with node region exact match", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeRegionField, noderegion), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "RequestNodeMatch with node zone exact match", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeZoneField, nodezone), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "RequestNodeMatch with node subzone exact match", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), + getRequestNodeClusterExactMatch(nodecluster), getResultStringFragment(), clusterTypeURL, stringFragment, }, }, + // { + // Description: "RequestNodeMatch with node region exact match", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeRegionField, noderegion), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "RequestNodeMatch with node zone exact match", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeZoneField, nodezone), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "RequestNodeMatch with node subzone exact match", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, { Description: "RequestNodeMatch with node id regex match", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeIDField, "n....d"), + getRequestNodeIdRegexMatch("n....d"), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -131,78 +131,78 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node cluster regex match", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeClusterField, "c*s*r"), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "RequestNodeMatch with node region regex match", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeRegionField, "^r....[n]"), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "RequestNodeMatch with node zone regex match", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeZoneField, "z..e$"), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "RequestNodeMatch with node subzone regex match", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, "[^0-9](u|v)b{1}...e"), + getRequestNodeClusterRegexMatch("c*s*r"), getResultStringFragment(), clusterTypeURL, stringFragment, }, }, + // { + // Description: "RequestNodeMatch with node region regex match", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeRegionField, "^r....[n]"), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "RequestNodeMatch with node zone regex match", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeZoneField, "z..e$"), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "RequestNodeMatch with node subzone regex match", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeSubZoneField, "[^0-9](u|v)b{1}...e"), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, { Description: "AndMatch RequestNodeMatch", Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, nodecluster), - }), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "AndMatch recursive", - Parameters: []interface{}{ - getRequestNodeAndMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, nodecluster), - }), - getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, nodezone), - }), + getRequestNodeIdExactMatch(nodeid), + getRequestNodeClusterExactMatch(nodecluster), }), getResultStringFragment(), clusterTypeURL, stringFragment, }, }, + // { + // Description: "AndMatch recursive", + // Parameters: []interface{}{ + // getRequestNodeAndMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeExactMatch(nodeIDField, nodeid), + // getRequestNodeExactMatch(nodeClusterField, nodecluster), + // }), + // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeRegexMatch(nodeRegionField, noderegion), + // getRequestNodeRegexMatch(nodeZoneField, nodezone), + // }), + // }), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, { Description: "OrMatch RequestNodeMatch first predicate", Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIdExactMatch(""), + getRequestNodeClusterExactMatch(nodecluster), }), getResultStringFragment(), clusterTypeURL, @@ -214,52 +214,52 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, ""), - }), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "OrMatch recursive", - Parameters: []interface{}{ - getRequestNodeOrMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, nodecluster), - }), - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, ""), - }), - }), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "AndMatch OrMatch recursive combined", - Parameters: []interface{}{ - getRequestNodeAndMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, nodecluster), - }), - getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, nodezone), - }), + getRequestNodeIdExactMatch(nodeid), + getRequestNodeClusterExactMatch(""), }), getResultStringFragment(), clusterTypeURL, stringFragment, }, }, + // { + // Description: "OrMatch recursive", + // Parameters: []interface{}{ + // getRequestNodeOrMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeExactMatch(nodeIDField, ""), + // getRequestNodeExactMatch(nodeClusterField, nodecluster), + // }), + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeRegexMatch(nodeRegionField, noderegion), + // getRequestNodeRegexMatch(nodeZoneField, ""), + // }), + // }), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "AndMatch OrMatch recursive combined", + // Parameters: []interface{}{ + // getRequestNodeAndMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeExactMatch(nodeIDField, ""), + // getRequestNodeExactMatch(nodeClusterField, nodecluster), + // }), + // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeRegexMatch(nodeRegionField, noderegion), + // getRequestNodeRegexMatch(nodeZoneField, nodezone), + // }), + // }), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, { Description: "NotMatch RequestType", Parameters: []interface{}{ @@ -287,56 +287,56 @@ var positiveTests = []TableEntry{ stringFragment, }, }, - { - Description: "Not Match RequestNodeMatch with node region regex", - Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeRegionField), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "Not Match RequestNodeMatch with node zone regex", - Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeZoneField), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "Not Match RequestNodeMatch with node subzone regex", - Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeSubZoneField), - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, - { - Description: "Not Match recursive", - Parameters: []interface{}{ - &MatchPredicate{ - Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeAndMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, ""), - }), - getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactNotMatch(nodeRegionField, ""), - getRequestNodeRegexMatch(nodeZoneField, nodezone), - }), - }), - }, - }, - getResultStringFragment(), - clusterTypeURL, - stringFragment, - }, - }, + // { + // Description: "Not Match RequestNodeMatch with node region regex", + // Parameters: []interface{}{ + // getRequestNodeRegexNotMatch(nodeRegionField), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "Not Match RequestNodeMatch with node zone regex", + // Parameters: []interface{}{ + // getRequestNodeRegexNotMatch(nodeZoneField), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "Not Match RequestNodeMatch with node subzone regex", + // Parameters: []interface{}{ + // getRequestNodeRegexNotMatch(nodeSubZoneField), + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, + // { + // Description: "Not Match recursive", + // Parameters: []interface{}{ + // &MatchPredicate{ + // Type: &aggregationv1.MatchPredicate_NotMatch{ + // NotMatch: getRequestNodeAndMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeExactMatch(nodeIDField, ""), + // getRequestNodeExactMatch(nodeClusterField, ""), + // }), + // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeExactNotMatch(nodeRegionField, ""), + // getRequestNodeRegexMatch(nodeZoneField, nodezone), + // }), + // }), + // }, + // }, + // getResultStringFragment(), + // clusterTypeURL, + // stringFragment, + // }, + // }, { Description: "AnyMatch With exact Node Id result", Parameters: []interface{}{ @@ -536,7 +536,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node id does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid+"{5}"), + getRequestNodeIdExactMatch(nodeid + "{5}"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -544,39 +544,39 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node cluster does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, "[^a-z]odecluster"), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "RequestNodeMatch with node region does not match", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeRegionField, noderegion+"\\d"), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "RequestNodeMatch with node zone does not match", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeZoneField, "zon[A-Z]"), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "RequestNodeMatch with node subzone does not match", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeSubZoneField, nodesubzone+"+"), + getRequestNodeClusterExactMatch("[^a-z]odecluster"), getResultStringFragment(), getDiscoveryRequest(), }, }, + // { + // Description: "RequestNodeMatch with node region does not match", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeRegionField, noderegion+"\\d"), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, + // { + // Description: "RequestNodeMatch with node zone does not match", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeZoneField, "zon[A-Z]"), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, + // { + // Description: "RequestNodeMatch with node subzone does not match", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone+"+"), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, { Description: "RequestNodeMatch with node id regex does not match", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeIDField, nodeid+"{5}"), + getRequestNodeIdRegexMatch(nodeid + "{5}"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -584,39 +584,39 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node cluster regex does not match", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeClusterField, "[^a-z]odecluster"), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "RequestNodeMatch with node region regex does not match", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeRegionField, noderegion+"\\d"), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "RequestNodeMatch with node zone regex does not match", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeZoneField, "zon[A-Z]"), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "RequestNodeMatch with node subzone regex does not match", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, nodesubzone+"\\B"), + getRequestNodeClusterRegexMatch("[^a-z]odecluster"), getResultStringFragment(), getDiscoveryRequest(), }, }, + // { + // Description: "RequestNodeMatch with node region regex does not match", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeRegionField, noderegion+"\\d"), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, + // { + // Description: "RequestNodeMatch with node zone regex does not match", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeZoneField, "zon[A-Z]"), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, + // { + // Description: "RequestNodeMatch with node subzone regex does not match", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeSubZoneField, nodesubzone+"\\B"), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, { Description: "RequestNodeMatch with exact match request node id mismatch", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid), + getRequestNodeIdExactMatch(nodeid), getResultStringFragment(), getDiscoveryRequestWithNode(getNode("mismatch", nodecluster, noderegion, nodezone, nodesubzone)), }, @@ -624,7 +624,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with regex match request node id mismatch", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeIDField, nodeid), + getRequestNodeIdRegexMatch(nodeid), getResultStringFragment(), getDiscoveryRequestWithNode(getNode("mismatch", nodecluster, noderegion, nodezone, nodesubzone)), }, @@ -632,7 +632,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with exact match request node cluster mismatch", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeClusterExactMatch(nodecluster), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, "mismatch", noderegion, nodezone, nodesubzone)), }, @@ -640,66 +640,66 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with regex match request node cluster mismatch", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeClusterField, nodecluster), + getRequestNodeClusterRegexMatch(nodecluster), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, "mismatch", noderegion, nodezone, nodesubzone)), }, }, - { - Description: "RequestNodeMatch with exact match request node region mismatch", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeRegionField, noderegion), - getResultStringFragment(), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), - }, - }, - { - Description: "RequestNodeMatch with regex match request node region mismatch", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getResultStringFragment(), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), - }, - }, - { - Description: "RequestNodeMatch with exact match request node zone mismatch", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeZoneField, nodezone), - getResultStringFragment(), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), - }, - }, - { - Description: "RequestNodeMatch with regex match request node zone mismatch", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeZoneField, nodezone), - getResultStringFragment(), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), - }, - }, - { - Description: "RequestNodeMatch with exact match request node subzone mismatch", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), - getResultStringFragment(), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), - }, - }, - { - Description: "RequestNodeMatch with regex match request node subzone mismatch", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, nodesubzone), - getResultStringFragment(), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), - }, - }, + // { + // Description: "RequestNodeMatch with exact match request node region mismatch", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeRegionField, noderegion), + // getResultStringFragment(), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), + // }, + // }, + // { + // Description: "RequestNodeMatch with regex match request node region mismatch", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeRegionField, noderegion), + // getResultStringFragment(), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), + // }, + // }, + // { + // Description: "RequestNodeMatch with exact match request node zone mismatch", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeZoneField, nodezone), + // getResultStringFragment(), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), + // }, + // }, + // { + // Description: "RequestNodeMatch with regex match request node zone mismatch", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeZoneField, nodezone), + // getResultStringFragment(), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), + // }, + // }, + // { + // Description: "RequestNodeMatch with exact match request node subzone mismatch", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), + // getResultStringFragment(), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), + // }, + // }, + // { + // Description: "RequestNodeMatch with regex match request node subzone mismatch", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeSubZoneField, nodesubzone), + // getResultStringFragment(), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), + // }, + // }, { Description: "AndMatch RequestNodeMatch does not match first predicate", Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, "nonmatchingnode"), - getRequestNodeExactMatch(nodeClusterField, nodecluster)}), + getRequestNodeIdExactMatch("nonmatchingnode"), + getRequestNodeClusterExactMatch(nodecluster)}), getResultStringFragment(), getDiscoveryRequest(), }, @@ -709,8 +709,8 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, "nomatch")}), + getRequestNodeIdExactMatch(nodeid), + getRequestNodeClusterExactMatch("nomatch")}), getResultStringFragment(), getDiscoveryRequest(), }, @@ -721,10 +721,10 @@ var negativeTests = []TableEntry{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, "nonmatchingnode"), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIdExactMatch("nonmatchingnode"), + getRequestNodeClusterExactMatch(nodecluster), }), - getRequestNodeExactMatch(nodeClusterField, nodecluster)}), + getRequestNodeClusterExactMatch(nodecluster)}), getResultStringFragment(), getDiscoveryRequest(), }, @@ -734,48 +734,48 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, "")}), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "OrMatch recursive", - Parameters: []interface{}{ - getRequestNodeOrMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, ""), - }), - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, ""), - getRequestNodeRegexMatch(nodeZoneField, ""), - }), - }), - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, - { - Description: "AndMatch OrMatch recursive combined", - Parameters: []interface{}{ - getRequestNodeAndMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, ""), - }), - getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, ""), - getRequestNodeRegexMatch(nodeZoneField, ""), - }), - }), + getRequestNodeIdExactMatch(""), + getRequestNodeClusterExactMatch("")}), getResultStringFragment(), getDiscoveryRequest(), }, }, + // { + // Description: "OrMatch recursive", + // Parameters: []interface{}{ + // getRequestNodeOrMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeIdExactMatch(""), + // getRequestNodeClusterExactMatch(""), + // }), + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeRegexMatch(nodeRegionField, ""), + // getRequestNodeRegexMatch(nodeZoneField, ""), + // }), + // }), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, + // { + // Description: "AndMatch OrMatch recursive combined", + // Parameters: []interface{}{ + // getRequestNodeAndMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeIdExactMatch(""), + // getRequestNodeClusterExactMatch(""), + // }), + // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeRegexMatch(nodeRegionField, ""), + // getRequestNodeRegexMatch(nodeZoneField, ""), + // }), + // }), + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, { Description: "NotMatch RequestType", Parameters: []interface{}{ @@ -824,28 +824,28 @@ var negativeTests = []TableEntry{ getDiscoveryRequest(), }, }, - { - Description: "Not Match recursive", - Parameters: []interface{}{ - &MatchPredicate{ - Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeAndMatch( - []*aggregationv1.MatchPredicate{ - getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, nodecluster), - }), - getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, nodezone), - }), - }), - }, - }, - getResultStringFragment(), - getDiscoveryRequest(), - }, - }, + // { + // Description: "Not Match recursive", + // Parameters: []interface{}{ + // &MatchPredicate{ + // Type: &aggregationv1.MatchPredicate_NotMatch{ + // NotMatch: getRequestNodeAndMatch( + // []*aggregationv1.MatchPredicate{ + // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeIdExactMatch(nodeid), + // getRequestNodeClusterExactMatch(nodecluster), + // }), + // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + // getRequestNodeRegexMatch(nodeRegionField, noderegion), + // getRequestNodeRegexMatch(nodeZoneField, nodezone), + // }), + // }), + // }, + // }, + // getResultStringFragment(), + // getDiscoveryRequest(), + // }, + // }, } var multiFragmentNegativeTests = []TableEntry{ @@ -861,13 +861,13 @@ var multiFragmentNegativeTests = []TableEntry{ } var regexpErrorCases = []TableEntry{ - { - Description: "Regex compilation failure in Nodefragment should return error", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), - getResultStringFragment(), - }, - }, + // { + // Description: "Regex compilation failure in Nodefragment should return error", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), + // getResultStringFragment(), + // }, + // }, { Description: "Regex compilation failure in RegexAction pattern should return error", Parameters: []interface{}{ @@ -878,24 +878,24 @@ var regexpErrorCases = []TableEntry{ } var regexpErrorCasesMultipleFragments = []TableEntry{ - { - Description: "Regex parse failure in first request predicate", - Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), - getAnyMatch(true), - getResultStringFragment(), - getResultStringFragment(), - }, - }, - { - Description: "Regex parse failure in second request predicate", - Parameters: []interface{}{ - getAnyMatch(true), - getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), - getResultStringFragment(), - getResultStringFragment(), - }, - }, + // { + // Description: "Regex parse failure in first request predicate", + // Parameters: []interface{}{ + // getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), + // getAnyMatch(true), + // getResultStringFragment(), + // getResultStringFragment(), + // }, + // }, + // { + // Description: "Regex parse failure in second request predicate", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), + // getResultStringFragment(), + // getResultStringFragment(), + // }, + // }, { Description: "Regex parse failure in first response predicate", Parameters: []interface{}{ @@ -929,7 +929,7 @@ var emptyFragmentErrorCases = []TableEntry{ { Description: "empty node id in request predicate", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid), + getRequestNodeIdExactMatch(nodeid), getResultRequestNodeFragment(nodeIDField, getExactAction()), getDiscoveryRequestWithNode(getNode("", nodecluster, noderegion, nodezone, nodesubzone)), "MatchPredicate Node field cannot be empty", @@ -938,39 +938,39 @@ var emptyFragmentErrorCases = []TableEntry{ { Description: "empty node cluster in request predicate", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeClusterExactMatch(nodecluster), getResultRequestNodeFragment(nodeIDField, getExactAction()), getDiscoveryRequestWithNode(getNode(nodeid, "", noderegion, nodezone, nodesubzone)), "MatchPredicate Node field cannot be empty", }, }, - { - Description: "empty node region in request predicate", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeRegionField, noderegion), - getResultRequestNodeFragment(nodeIDField, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), - "MatchPredicate Node field cannot be empty", - }, - }, - { - Description: "empty node zone in request predicate", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeZoneField, nodezone), - getResultRequestNodeFragment(nodeIDField, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), - "MatchPredicate Node field cannot be empty", - }, - }, - { - Description: "empty node subzone in request predicate", - Parameters: []interface{}{ - getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), - getResultRequestNodeFragment(nodeIDField, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), - "MatchPredicate Node field cannot be empty", - }, - }, + // { + // Description: "empty node region in request predicate", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeRegionField, noderegion), + // getResultRequestNodeFragment(nodeIDField, getExactAction()), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), + // "MatchPredicate Node field cannot be empty", + // }, + // }, + // { + // Description: "empty node zone in request predicate", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeZoneField, nodezone), + // getResultRequestNodeFragment(nodeIDField, getExactAction()), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), + // "MatchPredicate Node field cannot be empty", + // }, + // }, + // { + // Description: "empty node subzone in request predicate", + // Parameters: []interface{}{ + // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), + // getResultRequestNodeFragment(nodeIDField, getExactAction()), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), + // "MatchPredicate Node field cannot be empty", + // }, + // }, { Description: "empty node id in response action", Parameters: []interface{}{ @@ -1303,26 +1303,64 @@ func getRequestTypeMatch(typeurls []string) *MatchPredicate { } } -func getRequestNodeExactMatch(field aggregationv1.NodeFieldType, exact string) *MatchPredicate { +func getRequestNodeIdExactMatch(exact string) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ - Field: field, - Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ExactMatch{ - ExactMatch: exact, + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ + IdMatch: &aggregationv1.NodeStringMatch{ + Type: &aggregationv1.NodeStringMatch_ExactMatch{ + ExactMatch: exact, + }, + }, }, }, }, } } -func getRequestNodeRegexMatch(field aggregationv1.NodeFieldType, regex string) *MatchPredicate { +func getRequestNodeIdRegexMatch(regex string) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ - Field: field, - Type: &aggregationv1.MatchPredicate_RequestNodeMatch_RegexMatch{ - RegexMatch: regex, + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ + IdMatch: &aggregationv1.NodeStringMatch{ + Type: &aggregationv1.NodeStringMatch_RegexMatch{ + RegexMatch: regex, + }, + }, + }, + }, + }, + } +} + +func getRequestNodeClusterExactMatch(exact string) *MatchPredicate { + return &MatchPredicate{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ + RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ClusterMatch{ + ClusterMatch: &aggregationv1.NodeStringMatch{ + Type: &aggregationv1.NodeStringMatch_ExactMatch{ + ExactMatch: exact, + }, + }, + }, + }, + }, + } +} + +func getRequestNodeClusterRegexMatch(regex string) *MatchPredicate { + return &MatchPredicate{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ + RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ClusterMatch{ + ClusterMatch: &aggregationv1.NodeStringMatch{ + Type: &aggregationv1.NodeStringMatch_RegexMatch{ + RegexMatch: regex, + }, + }, }, }, }, @@ -1357,18 +1395,36 @@ func getRequestTypeNotMatch(typeurls []string) *MatchPredicate { } } +// TODO: this is the indication we don't need that enum in the protos, i.e. this should +// be a test-only construct. func getRequestNodeRegexNotMatch(field aggregationv1.NodeFieldType) *MatchPredicate { + var matchPredicate *aggregationv1.MatchPredicate + notMatchRegex := "notmatchregex" + switch field { + case aggregationv1.NodeFieldType_NODE_ID: + matchPredicate = getRequestNodeIdRegexMatch(notMatchRegex) + case aggregationv1.NodeFieldType_NODE_CLUSTER: + matchPredicate = getRequestNodeClusterRegexMatch(notMatchRegex) + } return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeRegexMatch(field, "notmatchregex"), + NotMatch: matchPredicate, }, } } -func getRequestNodeExactNotMatch(field aggregationv1.NodeFieldType, regex string) *MatchPredicate { +// TODO: ditto +func getRequestNodeExactNotMatch(field aggregationv1.NodeFieldType, exact string) *MatchPredicate { + var matchPredicate *aggregationv1.MatchPredicate + switch field { + case aggregationv1.NodeFieldType_NODE_ID: + matchPredicate = getRequestNodeIdExactMatch(exact) + case aggregationv1.NodeFieldType_NODE_CLUSTER: + matchPredicate = getRequestNodeClusterExactMatch(exact) + } return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeExactMatch(field, regex), + NotMatch: matchPredicate, }, } } From 683e402432738ad946ad386eb323291703ef057e Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 16:17:57 -0700 Subject: [PATCH 05/29] lint Signed-off-by: eapolinario --- internal/app/mapper/mapper.go | 21 ++++++++------- internal/app/mapper/mapper_test.go | 42 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 763eefc4..cfc51055 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -128,19 +128,19 @@ func isNodeMatch(matchPredicate *matchPredicate, req transport.Request) (bool, e // By construction only one of these is set at any point in time, so checking one by one // sequentially is ok. - id_match := predicate.GetIdMatch() - if id_match != nil { - return compareString(id_match, req.GetNodeID()) + idMatch := predicate.GetIdMatch() + if idMatch != nil { + return compareString(idMatch, req.GetNodeID()) } - cluster_match := predicate.GetClusterMatch() - if cluster_match != nil { - return compareString(cluster_match, req.GetCluster()) + clusterMatch := predicate.GetClusterMatch() + if clusterMatch != nil { + return compareString(clusterMatch, req.GetCluster()) } - locality_match := predicate.GetLocalityMatch() - if locality_match != nil { - return compareLocality(locality_match, req.GetLocality()) + localityMatch := predicate.GetLocalityMatch() + if localityMatch != nil { + return compareLocality(localityMatch, req.GetLocality()) } return false, fmt.Errorf("RequestNodeMatch is invalid") @@ -429,7 +429,8 @@ func compareString(nodeStringMatch *aggregationv1.NodeStringMatch, nodeValue str return false, nil } -func compareLocality(nodeLocalityMatch *aggregationv1.NodeLocalityMatch, reqNodeLocality *corev2.Locality) (bool, error) { +func compareLocality(nodeLocalityMatch *aggregationv1.NodeLocalityMatch, + reqNodeLocality *corev2.Locality) (bool, error) { // TODO if we can reuse envoy's Locality object, make sure to use cmp.Equal if reqNodeLocality == nil { return false, fmt.Errorf("Locality Node field cannot be empty") diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 3013f404..10517986 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -77,7 +77,7 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node id exact match", Parameters: []interface{}{ - getRequestNodeIdExactMatch(nodeid), + getRequestNodeIDExactMatch(nodeid), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -122,7 +122,7 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node id regex match", Parameters: []interface{}{ - getRequestNodeIdRegexMatch("n....d"), + getRequestNodeIDRegexMatch("n....d"), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -169,7 +169,7 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch(nodeid), + getRequestNodeIDExactMatch(nodeid), getRequestNodeClusterExactMatch(nodecluster), }), getResultStringFragment(), @@ -201,7 +201,7 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch(""), + getRequestNodeIDExactMatch(""), getRequestNodeClusterExactMatch(nodecluster), }), getResultStringFragment(), @@ -214,7 +214,7 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch(nodeid), + getRequestNodeIDExactMatch(nodeid), getRequestNodeClusterExactMatch(""), }), getResultStringFragment(), @@ -536,7 +536,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node id does not match", Parameters: []interface{}{ - getRequestNodeIdExactMatch(nodeid + "{5}"), + getRequestNodeIDExactMatch(nodeid + "{5}"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -576,7 +576,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node id regex does not match", Parameters: []interface{}{ - getRequestNodeIdRegexMatch(nodeid + "{5}"), + getRequestNodeIDRegexMatch(nodeid + "{5}"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -616,7 +616,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with exact match request node id mismatch", Parameters: []interface{}{ - getRequestNodeIdExactMatch(nodeid), + getRequestNodeIDExactMatch(nodeid), getResultStringFragment(), getDiscoveryRequestWithNode(getNode("mismatch", nodecluster, noderegion, nodezone, nodesubzone)), }, @@ -624,7 +624,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with regex match request node id mismatch", Parameters: []interface{}{ - getRequestNodeIdRegexMatch(nodeid), + getRequestNodeIDRegexMatch(nodeid), getResultStringFragment(), getDiscoveryRequestWithNode(getNode("mismatch", nodecluster, noderegion, nodezone, nodesubzone)), }, @@ -698,7 +698,7 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch("nonmatchingnode"), + getRequestNodeIDExactMatch("nonmatchingnode"), getRequestNodeClusterExactMatch(nodecluster)}), getResultStringFragment(), getDiscoveryRequest(), @@ -709,7 +709,7 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch(nodeid), + getRequestNodeIDExactMatch(nodeid), getRequestNodeClusterExactMatch("nomatch")}), getResultStringFragment(), getDiscoveryRequest(), @@ -721,7 +721,7 @@ var negativeTests = []TableEntry{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch("nonmatchingnode"), + getRequestNodeIDExactMatch("nonmatchingnode"), getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeClusterExactMatch(nodecluster)}), @@ -734,7 +734,7 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeIdExactMatch(""), + getRequestNodeIDExactMatch(""), getRequestNodeClusterExactMatch("")}), getResultStringFragment(), getDiscoveryRequest(), @@ -746,7 +746,7 @@ var negativeTests = []TableEntry{ // getRequestNodeOrMatch( // []*aggregationv1.MatchPredicate{ // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeIdExactMatch(""), + // getRequestNodeIDExactMatch(""), // getRequestNodeClusterExactMatch(""), // }), // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ @@ -764,7 +764,7 @@ var negativeTests = []TableEntry{ // getRequestNodeAndMatch( // []*aggregationv1.MatchPredicate{ // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeIdExactMatch(""), + // getRequestNodeIDExactMatch(""), // getRequestNodeClusterExactMatch(""), // }), // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ @@ -832,7 +832,7 @@ var negativeTests = []TableEntry{ // NotMatch: getRequestNodeAndMatch( // []*aggregationv1.MatchPredicate{ // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeIdExactMatch(nodeid), + // getRequestNodeIDExactMatch(nodeid), // getRequestNodeClusterExactMatch(nodecluster), // }), // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ @@ -929,7 +929,7 @@ var emptyFragmentErrorCases = []TableEntry{ { Description: "empty node id in request predicate", Parameters: []interface{}{ - getRequestNodeIdExactMatch(nodeid), + getRequestNodeIDExactMatch(nodeid), getResultRequestNodeFragment(nodeIDField, getExactAction()), getDiscoveryRequestWithNode(getNode("", nodecluster, noderegion, nodezone, nodesubzone)), "MatchPredicate Node field cannot be empty", @@ -1303,7 +1303,7 @@ func getRequestTypeMatch(typeurls []string) *MatchPredicate { } } -func getRequestNodeIdExactMatch(exact string) *MatchPredicate { +func getRequestNodeIDExactMatch(exact string) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ @@ -1319,7 +1319,7 @@ func getRequestNodeIdExactMatch(exact string) *MatchPredicate { } } -func getRequestNodeIdRegexMatch(regex string) *MatchPredicate { +func getRequestNodeIDRegexMatch(regex string) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ @@ -1402,7 +1402,7 @@ func getRequestNodeRegexNotMatch(field aggregationv1.NodeFieldType) *MatchPredic notMatchRegex := "notmatchregex" switch field { case aggregationv1.NodeFieldType_NODE_ID: - matchPredicate = getRequestNodeIdRegexMatch(notMatchRegex) + matchPredicate = getRequestNodeIDRegexMatch(notMatchRegex) case aggregationv1.NodeFieldType_NODE_CLUSTER: matchPredicate = getRequestNodeClusterRegexMatch(notMatchRegex) } @@ -1418,7 +1418,7 @@ func getRequestNodeExactNotMatch(field aggregationv1.NodeFieldType, exact string var matchPredicate *aggregationv1.MatchPredicate switch field { case aggregationv1.NodeFieldType_NODE_ID: - matchPredicate = getRequestNodeIdExactMatch(exact) + matchPredicate = getRequestNodeIDExactMatch(exact) case aggregationv1.NodeFieldType_NODE_CLUSTER: matchPredicate = getRequestNodeClusterExactMatch(exact) } From 6ac0898c82af1ed7492e8971e0836e0cc27dfca1 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 16:18:25 -0700 Subject: [PATCH 06/29] Use the new protos in tests Signed-off-by: eapolinario --- ...eyer_configuration_complete_tech_spec.yaml | 4 ++-- ...on_request_node_match_string_fragment.yaml | 4 ++-- internal/pkg/util/yamlproto/yamlproto_test.go | 22 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/integration/testdata/keyer_configuration_complete_tech_spec.yaml b/integration/testdata/keyer_configuration_complete_tech_spec.yaml index f0b31df4..f5c320e4 100644 --- a/integration/testdata/keyer_configuration_complete_tech_spec.yaml +++ b/integration/testdata/keyer_configuration_complete_tech_spec.yaml @@ -21,8 +21,8 @@ fragments: - "type.googleapis.com/envoy.api.v2.Listener" - "type.googleapis.com/envoy.api.v2.Cluster" - request_node_match: - field: 0 - exact_match: "canary" + id_match: + exact_match: "canary" result: string_fragment: "canary" - match: diff --git a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml index 0e427abc..7304648a 100644 --- a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml +++ b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml @@ -2,7 +2,7 @@ fragments: - rules: - match: request_node_match: - field: 0 - exact_match: "woooow" + id_match: + exact_match: "woooow" result: string_fragment: "abc" diff --git a/internal/pkg/util/yamlproto/yamlproto_test.go b/internal/pkg/util/yamlproto/yamlproto_test.go index e713e5e0..c8ce251e 100644 --- a/internal/pkg/util/yamlproto/yamlproto_test.go +++ b/internal/pkg/util/yamlproto/yamlproto_test.go @@ -300,17 +300,17 @@ var negativeTestsForKeyerConfigurationProto = []TableEntry{ "MatchPredicate_MatchSet.Rules: value must contain at least 2 item(s)", }, }, - { - Description: "reqesut_node_match cotaining invalid enum value", - Parameters: []interface{}{ - "keyer_configuration_request_node_match_invalid_enum.yaml", - "invalid KeyerConfiguration.Fragments[0]: embedded message failed validation | caused by: " + - "invalid KeyerConfiguration_Fragment.Rules[0]: embedded message failed validation | caused " + - "by: invalid KeyerConfiguration_Fragment_Rule.Match: embedded message failed validation | caused " + - "by: invalid MatchPredicate.RequestNodeMatch: embedded message failed validation | caused " + - "by: invalid MatchPredicate_RequestNodeMatch.Field: value must be one of the defined enum values", - }, - }, + // { + // Description: "reqesut_node_match cotaining invalid enum value", + // Parameters: []interface{}{ + // "keyer_configuration_request_node_match_invalid_enum.yaml", + // "invalid KeyerConfiguration.Fragments[0]: embedded message failed validation | caused by: " + + // "invalid KeyerConfiguration_Fragment.Rules[0]: embedded message failed validation | caused " + + // "by: invalid KeyerConfiguration_Fragment_Rule.Match: embedded message failed validation | caused " + + // "by: invalid MatchPredicate.RequestNodeMatch: embedded message failed validation | caused " + + // "by: invalid MatchPredicate_RequestNodeMatch.Field: value must be one of the defined enum values", + // }, + // }, } var _ = Describe("yamlproto tests", func() { From 1d1bd1eaf2e4e9392e79a57401cedb094f7ccc31 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 16:33:04 -0700 Subject: [PATCH 07/29] bump dependencies. Signed-off-by: eapolinario --- go.mod | 8 +++++--- go.sum | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cd23826d..f869bcb4 100644 --- a/go.mod +++ b/go.mod @@ -10,15 +10,17 @@ require ( github.com/envoyproxy/protoc-gen-validate v0.3.0 github.com/ghodss/yaml v1.0.0 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e - github.com/golang/protobuf v1.4.0-rc.4 + github.com/golang/protobuf v1.4.2 + github.com/iancoleman/strcase v0.1.1 // indirect + github.com/lyft/protoc-gen-star v0.5.1 // indirect github.com/onsi/ginkgo v1.12.0 github.com/onsi/gomega v1.9.0 github.com/spf13/cobra v1.0.0 - github.com/stretchr/testify v1.5.1 + github.com/stretchr/testify v1.6.1 github.com/uber-go/tally v3.3.15+incompatible go.uber.org/zap v1.14.0 golang.org/x/tools v0.0.0-20200527150044-688b3c5d9fa5 // indirect google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a google.golang.org/grpc v1.27.1 - google.golang.org/protobuf v1.20.1 + google.golang.org/protobuf v1.23.0 ) diff --git a/go.sum b/go.sum index 366529a2..9a252f5a 100644 --- a/go.sum +++ b/go.sum @@ -81,6 +81,10 @@ github.com/golang/protobuf v1.4.0-rc.2 h1:rn85MJyaapkaJOXLeyGQhbUqS1RMbDp1nHMZqS github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4 h1:+EOh4OY6tjM6ZueeUKinl1f0U2820HzQOuf1iqMnsks= github.com/golang/protobuf v1.4.0-rc.4/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= @@ -124,6 +128,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/iancoleman/strcase v0.1.1 h1:2I+LRClyCYB7JgZb9U0k75VHUiQe9RfknRqDyUfzp7k= +github.com/iancoleman/strcase v0.1.1/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -134,12 +140,15 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lyft/protoc-gen-star v0.5.1 h1:sImehRT+p7lW9n6R7MQc5hVgzWGEkDVZU4AsBQ4Isu8= +github.com/lyft/protoc-gen-star v0.5.1/go.mod h1:9toiA3cC7z5uVbODF7kEQ91Xn7XNFkVUl+SrEe+ZORU= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -170,6 +179,7 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -196,6 +206,8 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= @@ -213,6 +225,8 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -239,6 +253,7 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -371,6 +386,9 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.20.1 h1:ESRXHgpUBG5D2I5mmsQIyYxB/tQIZfSZ8wLyFDf/N/U= google.golang.org/protobuf v1.20.1/go.mod h1:KqelGeouBkcbcuB3HCk4/YH2tmNLk6YSWA5LIWeI/lY= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= @@ -387,6 +405,8 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 3530926cac3dbe4375144c26a08f19c72a7c4ef8 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 16:49:28 -0700 Subject: [PATCH 08/29] more tests. Signed-off-by: eapolinario --- ...figuration_request_node_match_invalid_enum.yaml | 8 -------- ...uration_request_node_match_string_fragment.yaml | 14 ++++++++++++++ internal/pkg/util/yamlproto/yamlproto_test.go | 11 ----------- 3 files changed, 14 insertions(+), 19 deletions(-) delete mode 100644 internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_invalid_enum.yaml diff --git a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_invalid_enum.yaml b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_invalid_enum.yaml deleted file mode 100644 index 7277207c..00000000 --- a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_invalid_enum.yaml +++ /dev/null @@ -1,8 +0,0 @@ -fragments: - - rules: - - match: - request_node_match: - field: 42 - exact_match: "the answer to life, universe and everything" - result: - string_fragment: "abc" diff --git a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml index 7304648a..3ceb165f 100644 --- a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml +++ b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml @@ -6,3 +6,17 @@ fragments: exact_match: "woooow" result: string_fragment: "abc" + - match: + request_node_match: + cluster_match: + exact_match: "cluster-1" + result: + string_fragment: "abc" + - match: + request_node_match: + locality_match: + region: "r1" + zone: "z1" + sub_zone: "sz-1" + result: + string_fragment: "abc" diff --git a/internal/pkg/util/yamlproto/yamlproto_test.go b/internal/pkg/util/yamlproto/yamlproto_test.go index c8ce251e..63b4b2dd 100644 --- a/internal/pkg/util/yamlproto/yamlproto_test.go +++ b/internal/pkg/util/yamlproto/yamlproto_test.go @@ -300,17 +300,6 @@ var negativeTestsForKeyerConfigurationProto = []TableEntry{ "MatchPredicate_MatchSet.Rules: value must contain at least 2 item(s)", }, }, - // { - // Description: "reqesut_node_match cotaining invalid enum value", - // Parameters: []interface{}{ - // "keyer_configuration_request_node_match_invalid_enum.yaml", - // "invalid KeyerConfiguration.Fragments[0]: embedded message failed validation | caused by: " + - // "invalid KeyerConfiguration_Fragment.Rules[0]: embedded message failed validation | caused " + - // "by: invalid KeyerConfiguration_Fragment_Rule.Match: embedded message failed validation | caused " + - // "by: invalid MatchPredicate.RequestNodeMatch: embedded message failed validation | caused " + - // "by: invalid MatchPredicate_RequestNodeMatch.Field: value must be one of the defined enum values", - // }, - // }, } var _ = Describe("yamlproto tests", func() { From eb11170f38b4e1137d648369ff96594d134d39a1 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 18:07:10 -0700 Subject: [PATCH 09/29] Fix remaining unit tests. Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 613 ++++++++++++----------------- 1 file changed, 246 insertions(+), 367 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 10517986..bd853a5d 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -92,33 +92,15 @@ var positiveTests = []TableEntry{ stringFragment, }, }, - // { - // Description: "RequestNodeMatch with node region exact match", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeRegionField, noderegion), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "RequestNodeMatch with node zone exact match", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeZoneField, nodezone), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "RequestNodeMatch with node subzone exact match", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, + { + Description: "RequestNodeMatch with node locality match", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getResultStringFragment(), + clusterTypeURL, + stringFragment, + }, + }, { Description: "RequestNodeMatch with node id regex match", Parameters: []interface{}{ @@ -137,33 +119,6 @@ var positiveTests = []TableEntry{ stringFragment, }, }, - // { - // Description: "RequestNodeMatch with node region regex match", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeRegionField, "^r....[n]"), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "RequestNodeMatch with node zone regex match", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeZoneField, "z..e$"), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "RequestNodeMatch with node subzone regex match", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeSubZoneField, "[^0-9](u|v)b{1}...e"), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, { Description: "AndMatch RequestNodeMatch", Parameters: []interface{}{ @@ -177,25 +132,24 @@ var positiveTests = []TableEntry{ stringFragment, }, }, - // { - // Description: "AndMatch recursive", - // Parameters: []interface{}{ - // getRequestNodeAndMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeExactMatch(nodeIDField, nodeid), - // getRequestNodeExactMatch(nodeClusterField, nodecluster), - // }), - // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeRegexMatch(nodeRegionField, noderegion), - // getRequestNodeRegexMatch(nodeZoneField, nodezone), - // }), - // }), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, + { + Description: "AndMatch recursive", + Parameters: []interface{}{ + getRequestNodeAndMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch(nodecluster), + }), + getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocality(noderegion, nodezone, ""), + }), + }), + getResultStringFragment(), + clusterTypeURL, + stringFragment, + }, + }, { Description: "OrMatch RequestNodeMatch first predicate", Parameters: []interface{}{ @@ -222,44 +176,42 @@ var positiveTests = []TableEntry{ stringFragment, }, }, - // { - // Description: "OrMatch recursive", - // Parameters: []interface{}{ - // getRequestNodeOrMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeExactMatch(nodeIDField, ""), - // getRequestNodeExactMatch(nodeClusterField, nodecluster), - // }), - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeRegexMatch(nodeRegionField, noderegion), - // getRequestNodeRegexMatch(nodeZoneField, ""), - // }), - // }), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "AndMatch OrMatch recursive combined", - // Parameters: []interface{}{ - // getRequestNodeAndMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeExactMatch(nodeIDField, ""), - // getRequestNodeExactMatch(nodeClusterField, nodecluster), - // }), - // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeRegexMatch(nodeRegionField, noderegion), - // getRequestNodeRegexMatch(nodeZoneField, nodezone), - // }), - // }), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, + { + Description: "OrMatch recursive", + Parameters: []interface{}{ + getRequestNodeOrMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(nodecluster), + }), + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocality(noderegion, "", ""), + }), + }), + getResultStringFragment(), + clusterTypeURL, + stringFragment, + }, + }, + { + Description: "AndMatch OrMatch recursive combined", + Parameters: []interface{}{ + getRequestNodeAndMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(nodecluster), + }), + getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocality(noderegion, nodezone, ""), + }), + }), + getResultStringFragment(), + clusterTypeURL, + stringFragment, + }, + }, { Description: "NotMatch RequestType", Parameters: []interface{}{ @@ -287,56 +239,37 @@ var positiveTests = []TableEntry{ stringFragment, }, }, - // { - // Description: "Not Match RequestNodeMatch with node region regex", - // Parameters: []interface{}{ - // getRequestNodeRegexNotMatch(nodeRegionField), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "Not Match RequestNodeMatch with node zone regex", - // Parameters: []interface{}{ - // getRequestNodeRegexNotMatch(nodeZoneField), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "Not Match RequestNodeMatch with node subzone regex", - // Parameters: []interface{}{ - // getRequestNodeRegexNotMatch(nodeSubZoneField), - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, - // { - // Description: "Not Match recursive", - // Parameters: []interface{}{ - // &MatchPredicate{ - // Type: &aggregationv1.MatchPredicate_NotMatch{ - // NotMatch: getRequestNodeAndMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeExactMatch(nodeIDField, ""), - // getRequestNodeExactMatch(nodeClusterField, ""), - // }), - // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeExactNotMatch(nodeRegionField, ""), - // getRequestNodeRegexMatch(nodeZoneField, nodezone), - // }), - // }), - // }, - // }, - // getResultStringFragment(), - // clusterTypeURL, - // stringFragment, - // }, - // }, + { + Description: "Not Match RequestNodeMatch with node locality", + Parameters: []interface{}{ + getRequestNodeLocalityNotMatch(), + getResultStringFragment(), + clusterTypeURL, + stringFragment, + }, + }, + { + Description: "Not Match recursive", + Parameters: []interface{}{ + &MatchPredicate{ + Type: &aggregationv1.MatchPredicate_NotMatch{ + NotMatch: getRequestNodeAndMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(""), + }), + getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocalityNotMatch(), + }), + }), + }, + }, + getResultStringFragment(), + clusterTypeURL, + stringFragment, + }, + }, { Description: "AnyMatch With exact Node Id result", Parameters: []interface{}{ @@ -549,30 +482,30 @@ var negativeTests = []TableEntry{ getDiscoveryRequest(), }, }, - // { - // Description: "RequestNodeMatch with node region does not match", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeRegionField, noderegion+"\\d"), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, - // { - // Description: "RequestNodeMatch with node zone does not match", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeZoneField, "zon[A-Z]"), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, - // { - // Description: "RequestNodeMatch with node subzone does not match", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone+"+"), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, + { + Description: "RequestNodeMatch with node region does not match", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion+"\\d", nodezone, nodesubzone), + getResultStringFragment(), + getDiscoveryRequest(), + }, + }, + { + Description: "RequestNodeMatch with node zone does not match", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion, "zon[A-Z]", nodesubzone), + getResultStringFragment(), + getDiscoveryRequest(), + }, + }, + { + Description: "RequestNodeMatch with node subzone does not match", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion, nodezone, nodesubzone+"+"), + getResultStringFragment(), + getDiscoveryRequest(), + }, + }, { Description: "RequestNodeMatch with node id regex does not match", Parameters: []interface{}{ @@ -589,30 +522,6 @@ var negativeTests = []TableEntry{ getDiscoveryRequest(), }, }, - // { - // Description: "RequestNodeMatch with node region regex does not match", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeRegionField, noderegion+"\\d"), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, - // { - // Description: "RequestNodeMatch with node zone regex does not match", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeZoneField, "zon[A-Z]"), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, - // { - // Description: "RequestNodeMatch with node subzone regex does not match", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeSubZoneField, nodesubzone+"\\B"), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, { Description: "RequestNodeMatch with exact match request node id mismatch", Parameters: []interface{}{ @@ -645,54 +554,30 @@ var negativeTests = []TableEntry{ getDiscoveryRequestWithNode(getNode(nodeid, "mismatch", noderegion, nodezone, nodesubzone)), }, }, - // { - // Description: "RequestNodeMatch with exact match request node region mismatch", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeRegionField, noderegion), - // getResultStringFragment(), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), - // }, - // }, - // { - // Description: "RequestNodeMatch with regex match request node region mismatch", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeRegionField, noderegion), - // getResultStringFragment(), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), - // }, - // }, - // { - // Description: "RequestNodeMatch with exact match request node zone mismatch", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeZoneField, nodezone), - // getResultStringFragment(), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), - // }, - // }, - // { - // Description: "RequestNodeMatch with regex match request node zone mismatch", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeZoneField, nodezone), - // getResultStringFragment(), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), - // }, - // }, - // { - // Description: "RequestNodeMatch with exact match request node subzone mismatch", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), - // getResultStringFragment(), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), - // }, - // }, - // { - // Description: "RequestNodeMatch with regex match request node subzone mismatch", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeSubZoneField, nodesubzone), - // getResultStringFragment(), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), - // }, - // }, + { + Description: "RequestNodeMatch with exact match request node region mismatch", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getResultStringFragment(), + getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), + }, + }, + { + Description: "RequestNodeMatch with exact match request node zone mismatch", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getResultStringFragment(), + getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), + }, + }, + { + Description: "RequestNodeMatch with exact match request node subzone mismatch", + Parameters: []interface{}{ + getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getResultStringFragment(), + getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), + }, + }, { Description: "AndMatch RequestNodeMatch does not match first predicate", Parameters: []interface{}{ @@ -740,42 +625,40 @@ var negativeTests = []TableEntry{ getDiscoveryRequest(), }, }, - // { - // Description: "OrMatch recursive", - // Parameters: []interface{}{ - // getRequestNodeOrMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeIDExactMatch(""), - // getRequestNodeClusterExactMatch(""), - // }), - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeRegexMatch(nodeRegionField, ""), - // getRequestNodeRegexMatch(nodeZoneField, ""), - // }), - // }), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, - // { - // Description: "AndMatch OrMatch recursive combined", - // Parameters: []interface{}{ - // getRequestNodeAndMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeIDExactMatch(""), - // getRequestNodeClusterExactMatch(""), - // }), - // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeRegexMatch(nodeRegionField, ""), - // getRequestNodeRegexMatch(nodeZoneField, ""), - // }), - // }), - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, + { + Description: "OrMatch recursive", + Parameters: []interface{}{ + getRequestNodeOrMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(""), + }), + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocality("nomatch", "", ""), + }), + }), + getResultStringFragment(), + getDiscoveryRequest(), + }, + }, + { + Description: "AndMatch OrMatch recursive combined", + Parameters: []interface{}{ + getRequestNodeAndMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(""), + }), + getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocality("", "", ""), + }), + }), + getResultStringFragment(), + getDiscoveryRequest(), + }, + }, { Description: "NotMatch RequestType", Parameters: []interface{}{ @@ -824,28 +707,27 @@ var negativeTests = []TableEntry{ getDiscoveryRequest(), }, }, - // { - // Description: "Not Match recursive", - // Parameters: []interface{}{ - // &MatchPredicate{ - // Type: &aggregationv1.MatchPredicate_NotMatch{ - // NotMatch: getRequestNodeAndMatch( - // []*aggregationv1.MatchPredicate{ - // getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeIDExactMatch(nodeid), - // getRequestNodeClusterExactMatch(nodecluster), - // }), - // getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - // getRequestNodeRegexMatch(nodeRegionField, noderegion), - // getRequestNodeRegexMatch(nodeZoneField, nodezone), - // }), - // }), - // }, - // }, - // getResultStringFragment(), - // getDiscoveryRequest(), - // }, - // }, + { + Description: "Not Match recursive", + Parameters: []interface{}{ + &MatchPredicate{ + Type: &aggregationv1.MatchPredicate_NotMatch{ + NotMatch: getRequestNodeAndMatch( + []*aggregationv1.MatchPredicate{ + getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch(nodecluster), + }), + getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ + getRequestNodeLocality(noderegion, nodezone, ""), + }), + }), + }, + }, + getResultStringFragment(), + getDiscoveryRequest(), + }, + }, } var multiFragmentNegativeTests = []TableEntry{ @@ -861,13 +743,13 @@ var multiFragmentNegativeTests = []TableEntry{ } var regexpErrorCases = []TableEntry{ - // { - // Description: "Regex compilation failure in Nodefragment should return error", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), - // getResultStringFragment(), - // }, - // }, + { + Description: "Regex compilation failure in Nodefragment should return error", + Parameters: []interface{}{ + getRequestNodeIDRegexMatch("\xbd\xb2"), + getResultStringFragment(), + }, + }, { Description: "Regex compilation failure in RegexAction pattern should return error", Parameters: []interface{}{ @@ -878,24 +760,24 @@ var regexpErrorCases = []TableEntry{ } var regexpErrorCasesMultipleFragments = []TableEntry{ - // { - // Description: "Regex parse failure in first request predicate", - // Parameters: []interface{}{ - // getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), - // getAnyMatch(true), - // getResultStringFragment(), - // getResultStringFragment(), - // }, - // }, - // { - // Description: "Regex parse failure in second request predicate", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), - // getResultStringFragment(), - // getResultStringFragment(), - // }, - // }, + { + Description: "Regex parse failure in first request predicate", + Parameters: []interface{}{ + getRequestNodeIDRegexMatch("\xbd\xb2"), + getAnyMatch(true), + getResultStringFragment(), + getResultStringFragment(), + }, + }, + { + Description: "Regex parse failure in second request predicate", + Parameters: []interface{}{ + getAnyMatch(true), + getRequestNodeIDRegexMatch("\xbd\xb2"), + getResultStringFragment(), + getResultStringFragment(), + }, + }, { Description: "Regex parse failure in first response predicate", Parameters: []interface{}{ @@ -944,33 +826,6 @@ var emptyFragmentErrorCases = []TableEntry{ "MatchPredicate Node field cannot be empty", }, }, - // { - // Description: "empty node region in request predicate", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeRegionField, noderegion), - // getResultRequestNodeFragment(nodeIDField, getExactAction()), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), - // "MatchPredicate Node field cannot be empty", - // }, - // }, - // { - // Description: "empty node zone in request predicate", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeZoneField, nodezone), - // getResultRequestNodeFragment(nodeIDField, getExactAction()), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), - // "MatchPredicate Node field cannot be empty", - // }, - // }, - // { - // Description: "empty node subzone in request predicate", - // Parameters: []interface{}{ - // getRequestNodeExactMatch(nodeSubZoneField, nodesubzone), - // getResultRequestNodeFragment(nodeIDField, getExactAction()), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), - // "MatchPredicate Node field cannot be empty", - // }, - // }, { Description: "empty node id in response action", Parameters: []interface{}{ @@ -1367,6 +1222,22 @@ func getRequestNodeClusterRegexMatch(regex string) *MatchPredicate { } } +func getRequestNodeLocality(region string, zone string, subZone string) *MatchPredicate { + return &MatchPredicate{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ + RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_LocalityMatch{ + LocalityMatch: &aggregationv1.NodeLocalityMatch{ + Region: region, + Zone: zone, + SubZone: subZone, + }, + }, + }, + }, + } +} + func getRequestNodeAndMatch(predicates []*MatchPredicate) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_AndMatch{ @@ -1395,6 +1266,14 @@ func getRequestTypeNotMatch(typeurls []string) *MatchPredicate { } } +func getRequestNodeLocalityNotMatch() *MatchPredicate { + return &matchPredicate{ + Type: &aggregationv1.MatchPredicate_NotMatch{ + NotMatch: getRequestNodeLocality("r1", "z2", "sz3"), + }, + } +} + // TODO: this is the indication we don't need that enum in the protos, i.e. this should // be a test-only construct. func getRequestNodeRegexNotMatch(field aggregationv1.NodeFieldType) *MatchPredicate { From f414e06c2493a261682018bce6076750e784a07a Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 28 Aug 2020 18:16:07 -0700 Subject: [PATCH 10/29] remove TODO from proto Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 2 -- 1 file changed, 2 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index 09dd765d..dcb4414e 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -40,7 +40,6 @@ enum NodeFieldType { NODE_LOCALITY_SUBZONE = 4; } -// TODO: can we reuse envoy's type.matcher.v3.StringMatcher instead? message NodeStringMatch { oneof type { option (validate.required) = true; @@ -55,7 +54,6 @@ message NodeStringMatch { } } -// TODO: how can we import envoy's definition of Locality? message NodeLocalityMatch { string region = 1; From 911df69c13d4c8760fe72ca0724089638310e97b Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 15:53:29 -0700 Subject: [PATCH 11/29] Remove getResultRequestNodeFragment Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 348 +++++++++++++++-------------- 1 file changed, 176 insertions(+), 172 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index bd853a5d..5b671c4d 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -274,7 +274,7 @@ var positiveTests = []TableEntry{ Description: "AnyMatch With exact Node Id result", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), clusterTypeURL, nodeid, }, @@ -283,7 +283,7 @@ var positiveTests = []TableEntry{ Description: "AnyMatch With regex Node Id result", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getRegexAction("n....d", "replace")), + getResultRequestNodeIDFragment(getRegexAction("n....d", "replace")), clusterTypeURL, "replace", }, @@ -292,7 +292,7 @@ var positiveTests = []TableEntry{ Description: "AnyMatch With exact Node Cluster match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), + getResultRequestNodeClusterFragment(getExactAction()), clusterTypeURL, nodecluster, }, @@ -301,65 +301,65 @@ var positiveTests = []TableEntry{ Description: "AnyMatch With regex Node Cluster match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeClusterField, getRegexAction("c.*r", "replace")), + getResultRequestNodeClusterFragment(getRegexAction("c.*r", "replace")), clusterTypeURL, "replace", }, }, - { - Description: "AnyMatch With Exact Node Region match", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getExactAction()), - clusterTypeURL, - noderegion, - }, - }, - { - Description: "AnyMatch With regex Node Region match", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getRegexAction("r(egion)", "p$1")), - clusterTypeURL, - "pegion", - }, - }, - { - Description: "AnyMatch With exact Node Zone match", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getExactAction()), - clusterTypeURL, - nodezone, - }, - }, - { - Description: "AnyMatch With regex Node Zone match", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getRegexAction("z..e$", "newzone")), - clusterTypeURL, - "newzone", - }, - }, - { - Description: "AnyMatch With exact Node Subzone match", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), - clusterTypeURL, - nodesubzone, - }, - }, - { - Description: "AnyMatch With regex Node Subzone match", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getRegexAction("[^0-9](u|v)b{1}...e", "zone")), - clusterTypeURL, - "zone", - }, - }, + // { + // Description: "AnyMatch With Exact Node Region match", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeRegionField, getExactAction()), + // clusterTypeURL, + // noderegion, + // }, + // }, + // { + // Description: "AnyMatch With regex Node Region match", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeRegionField, getRegexAction("r(egion)", "p$1")), + // clusterTypeURL, + // "pegion", + // }, + // }, + // { + // Description: "AnyMatch With exact Node Zone match", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeZoneField, getExactAction()), + // clusterTypeURL, + // nodezone, + // }, + // }, + // { + // Description: "AnyMatch With regex Node Zone match", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeZoneField, getRegexAction("z..e$", "newzone")), + // clusterTypeURL, + // "newzone", + // }, + // }, + // { + // Description: "AnyMatch With exact Node Subzone match", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), + // clusterTypeURL, + // nodesubzone, + // }, + // }, + // { + // Description: "AnyMatch With regex Node Subzone match", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeSubZoneField, getRegexAction("[^0-9](u|v)b{1}...e", "zone")), + // clusterTypeURL, + // "zone", + // }, + // }, { Description: "AnyMatch With result concatenation", Parameters: []interface{}{ @@ -369,15 +369,15 @@ var positiveTests = []TableEntry{ nodeid + nodecluster, }, }, - { - Description: "AnyMatch With result concatenation recursive", - Parameters: []interface{}{ - getAnyMatch(true), - getRepeatedResultPredicate2(), - clusterTypeURL, - "str" + noderegion + nodezone + "nTid" + nodecluster, - }, - }, + // { + // Description: "AnyMatch With result concatenation recursive", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getRepeatedResultPredicate2(), + // clusterTypeURL, + // "str" + noderegion + nodezone + "nTid" + nodecluster, + // }, + // }, { Description: "AnyMatch With resource names fragment element 0", Parameters: []interface{}{ @@ -754,7 +754,7 @@ var regexpErrorCases = []TableEntry{ Description: "Regex compilation failure in RegexAction pattern should return error", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getRegexAction("\xbd\xb2", "")), + getResultRequestNodeIDFragment(getRegexAction("\xbd\xb2", "")), }, }, } @@ -783,7 +783,7 @@ var regexpErrorCasesMultipleFragments = []TableEntry{ Parameters: []interface{}{ getAnyMatch(true), getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getRegexAction("\xbd\xb2", "")), + getResultRequestNodeIDFragment(getRegexAction("\xbd\xb2", "")), getResultStringFragment(), }, }, @@ -793,7 +793,7 @@ var regexpErrorCasesMultipleFragments = []TableEntry{ getAnyMatch(true), getAnyMatch(true), getResultStringFragment(), - getResultRequestNodeFragment(nodeIDField, getRegexAction("\xbd\xb2", "")), + getResultRequestNodeIDFragment(getRegexAction("\xbd\xb2", "")), }, }, { @@ -812,7 +812,7 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node id in request predicate", Parameters: []interface{}{ getRequestNodeIDExactMatch(nodeid), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), getDiscoveryRequestWithNode(getNode("", nodecluster, noderegion, nodezone, nodesubzone)), "MatchPredicate Node field cannot be empty", }, @@ -821,7 +821,7 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node cluster in request predicate", Parameters: []interface{}{ getRequestNodeClusterExactMatch(nodecluster), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), getDiscoveryRequestWithNode(getNode(nodeid, "", noderegion, nodezone, nodesubzone)), "MatchPredicate Node field cannot be empty", }, @@ -830,7 +830,7 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node id in response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), getDiscoveryRequestWithNode(getNode("", nodecluster, noderegion, nodezone, nodesubzone)), "RequestNodeFragment exact match resulted in an empty fragment", }, @@ -839,43 +839,43 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node cluster in response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), + getResultRequestNodeClusterFragment(getExactAction()), getDiscoveryRequestWithNode(getNode(nodeid, "", noderegion, nodezone, nodesubzone)), "RequestNodeFragment exact match resulted in an empty fragment", }, }, - { - Description: "empty node region in response action", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), - "RequestNodeFragment exact match resulted in an empty fragment", - }, - }, - { - Description: "empty node zone in response action", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), - "RequestNodeFragment exact match resulted in an empty fragment", - }, - }, - { - Description: "empty node subzone in response action", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), - "RequestNodeFragment exact match resulted in an empty fragment", - }, - }, + // { + // Description: "empty node region in response action", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeRegionField, getExactAction()), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), + // "RequestNodeFragment exact match resulted in an empty fragment", + // }, + // }, + // { + // Description: "empty node zone in response action", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeZoneField, getExactAction()), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), + // "RequestNodeFragment exact match resulted in an empty fragment", + // }, + // }, + // { + // Description: "empty node subzone in response action", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), + // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), + // "RequestNodeFragment exact match resulted in an empty fragment", + // }, + // }, { Description: "empty node id in regex response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getRegexAction(nodeid, "")), + getResultRequestNodeIDFragment(getRegexAction(nodeid, "")), getDiscoveryRequest(), "RequestNodeFragment regex match resulted in an empty fragment", }, @@ -884,47 +884,38 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node cluster in regex response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeClusterField, getRegexAction(nodecluster, "")), - getDiscoveryRequest(), - "RequestNodeFragment regex match resulted in an empty fragment", - }, - }, - { - Description: "empty node region in regex response action", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getRegexAction(noderegion, "")), - getDiscoveryRequest(), - "RequestNodeFragment regex match resulted in an empty fragment", - }, - }, - { - Description: "empty node zone in regex response action", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getRegexAction(nodezone, "")), - getDiscoveryRequest(), - "RequestNodeFragment regex match resulted in an empty fragment", - }, - }, - { - Description: "empty node subzone in regex response action", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getRegexAction(nodesubzone, "")), + getResultRequestNodeClusterFragment(getRegexAction(nodecluster, "")), getDiscoveryRequest(), "RequestNodeFragment regex match resulted in an empty fragment", }, }, - { - Description: "non matching field type", - Parameters: []interface{}{ - getAnyMatch(true), - getResultRequestNodeFragment(10, getExactAction()), - getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), - "RequestNodeFragment Invalid NodeFieldType", - }, - }, + // { + // Description: "empty node region in regex response action", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeRegionField, getRegexAction(noderegion, "")), + // getDiscoveryRequest(), + // "RequestNodeFragment regex match resulted in an empty fragment", + // }, + // }, + // { + // Description: "empty node zone in regex response action", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeZoneField, getRegexAction(nodezone, "")), + // getDiscoveryRequest(), + // "RequestNodeFragment regex match resulted in an empty fragment", + // }, + // }, + // { + // Description: "empty node subzone in regex response action", + // Parameters: []interface{}{ + // getAnyMatch(true), + // getResultRequestNodeFragment(nodeSubZoneField, getRegexAction(nodesubzone, "")), + // getDiscoveryRequest(), + // "RequestNodeFragment regex match resulted in an empty fragment", + // }, + // }, { Description: "resource fragment is negative", Parameters: []interface{}{ @@ -1321,41 +1312,41 @@ func getRepeatedResultPredicate1() *ResultPredicate { Type: &aggregationv1.ResultPredicate_AndResult_{ AndResult: &aggregationv1.ResultPredicate_AndResult{ ResultPredicates: []*aggregationv1.ResultPredicate{ - getResultRequestNodeFragment(nodeIDField, getExactAction()), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), + getResultRequestNodeClusterFragment(getExactAction()), }, }, }, } } -func getRepeatedResultPredicate2() *ResultPredicate { - return &ResultPredicate{ - Type: &aggregationv1.ResultPredicate_AndResult_{ - AndResult: &aggregationv1.ResultPredicate_AndResult{ - ResultPredicates: []*aggregationv1.ResultPredicate{ - { - Type: &aggregationv1.ResultPredicate_AndResult_{ - AndResult: &aggregationv1.ResultPredicate_AndResult{ - ResultPredicates: []*aggregationv1.ResultPredicate{ - { - Type: &aggregationv1.ResultPredicate_StringFragment{ - StringFragment: "str", - }, - }, - getResultRequestNodeFragment(nodeRegionField, getExactAction()), - getResultRequestNodeFragment(nodeZoneField, getExactAction()), - }, - }, - }, - }, - getResultRequestNodeFragment(nodeIDField, getRegexAction("ode", "T")), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), - }, - }, - }, - } -} +// func getRepeatedResultPredicate2() *ResultPredicate { +// return &ResultPredicate{ +// Type: &aggregationv1.ResultPredicate_AndResult_{ +// AndResult: &aggregationv1.ResultPredicate_AndResult{ +// ResultPredicates: []*aggregationv1.ResultPredicate{ +// { +// Type: &aggregationv1.ResultPredicate_AndResult_{ +// AndResult: &aggregationv1.ResultPredicate_AndResult{ +// ResultPredicates: []*aggregationv1.ResultPredicate{ +// { +// Type: &aggregationv1.ResultPredicate_StringFragment{ +// StringFragment: "str", +// }, +// }, +// getResultRequestNodeFragment(nodeRegionField, getExactAction()), +// getResultRequestNodeFragment(nodeZoneField, getExactAction()), +// }, +// }, +// }, +// }, +// getResultRequestNodeIDFragment(getRegexAction("ode", "T")), +// getResultRequestNodeClusterFragment(getExactAction()), +// }, +// }, +// }, +// } +// } func getRepeatedResultPredicate3() *ResultPredicate { return &ResultPredicate{ @@ -1381,14 +1372,27 @@ func getResourceNameFragment(element int, action *aggregationv1.ResultPredicate_ } } -func getResultRequestNodeFragment( - field aggregationv1.NodeFieldType, +func getResultRequestNodeIDFragment( + action *aggregationv1.ResultPredicate_ResultAction) *ResultPredicate { + return &ResultPredicate{ + Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ + RequestNodeFragment: &aggregationv1.ResultPredicate_RequestNodeFragment{ + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_IdAction{ + IdAction: action, + }, + }, + }, + } +} + +func getResultRequestNodeClusterFragment( action *aggregationv1.ResultPredicate_ResultAction) *ResultPredicate { return &ResultPredicate{ Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ RequestNodeFragment: &aggregationv1.ResultPredicate_RequestNodeFragment{ - Field: field, - Action: action, + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_ClusterAction{ + ClusterAction: action, + }, }, }, } From dd313a2232b9433b1fe1ec10c8d37512ac02d1d0 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 16:10:45 -0700 Subject: [PATCH 12/29] Fix yaml_proto tests Signed-off-by: eapolinario --- .../util/yamlproto/testdata/and_result.yaml | 3 +-- .../testdata/request_node_fragment.yaml | 3 +-- internal/pkg/util/yamlproto/yamlproto_test.go | 26 ++++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/pkg/util/yamlproto/testdata/and_result.yaml b/internal/pkg/util/yamlproto/testdata/and_result.yaml index 1e383ceb..dd76d054 100644 --- a/internal/pkg/util/yamlproto/testdata/and_result.yaml +++ b/internal/pkg/util/yamlproto/testdata/and_result.yaml @@ -7,8 +7,7 @@ and_result: pattern: "some_regex" replace: "a_replacement" - request_node_fragment: - field: 2 - action: + id_action: regex_action: pattern: "some_regex_for_node_fragment" replace: "another_replacement" diff --git a/internal/pkg/util/yamlproto/testdata/request_node_fragment.yaml b/internal/pkg/util/yamlproto/testdata/request_node_fragment.yaml index 29413f4a..a5fc9b0a 100644 --- a/internal/pkg/util/yamlproto/testdata/request_node_fragment.yaml +++ b/internal/pkg/util/yamlproto/testdata/request_node_fragment.yaml @@ -1,6 +1,5 @@ request_node_fragment: - field: 2 - action: + id_action: regex_action: pattern: "some_regex_for_node_fragment" replace: "another_replacement" diff --git a/internal/pkg/util/yamlproto/yamlproto_test.go b/internal/pkg/util/yamlproto/yamlproto_test.go index 63b4b2dd..0d092b17 100644 --- a/internal/pkg/util/yamlproto/yamlproto_test.go +++ b/internal/pkg/util/yamlproto/yamlproto_test.go @@ -65,12 +65,13 @@ var positiveTests = []TableEntry{ &ResultPredicate{ Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ RequestNodeFragment: &RequestNodeFragment{ - Field: 2, - Action: &ResultAction{ - Action: &aggregationv1.ResultPredicate_ResultAction_RegexAction_{ - RegexAction: &RegexAction{ - Pattern: "some_regex_for_node_fragment", - Replace: "another_replacement", + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_IdAction{ + IdAction: &aggregationv1.ResultPredicate_ResultAction{ + Action: &aggregationv1.ResultPredicate_ResultAction_RegexAction_{ + RegexAction: &RegexAction{ + Pattern: "some_regex_for_node_fragment", + Replace: "another_replacement", + }, }, }, }, @@ -105,12 +106,13 @@ var positiveTests = []TableEntry{ { Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ RequestNodeFragment: &RequestNodeFragment{ - Field: 2, - Action: &ResultAction{ - Action: &aggregationv1.ResultPredicate_ResultAction_RegexAction_{ - RegexAction: &RegexAction{ - Pattern: "some_regex_for_node_fragment", - Replace: "another_replacement", + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_IdAction{ + IdAction: &aggregationv1.ResultPredicate_ResultAction{ + Action: &aggregationv1.ResultPredicate_ResultAction_RegexAction_{ + RegexAction: &RegexAction{ + Pattern: "some_regex_for_node_fragment", + Replace: "another_replacement", + }, }, }, }, From d3b301f3916d0eef3ebb5d04cb893048be233eba Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 16:12:44 -0700 Subject: [PATCH 13/29] Add NodeLocality to RequestNodeFragment Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 10 +- pkg/api/aggregation/v1/aggregation.pb.go | 154 ++++++++++++------ .../aggregation/v1/aggregation.pb.validate.go | 52 ++++-- 3 files changed, 147 insertions(+), 69 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index dcb4414e..eb28209c 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -155,12 +155,16 @@ message ResultPredicate { } // Rules for generating the resulting fragment from a Envoy request node. - // [#next-free-field: 3] + // [#next-free-field: 4] message RequestNodeFragment { - NodeFieldType field = 1 [(validate.rules).enum.defined_only = true]; + oneof action { + option (validate.required) = true; - ResultAction action = 2 [(validate.rules).message.required = true]; + ResultAction id_action = 1; + ResultAction cluster_action = 2; + NodeLocalityMatch locality_action = 3; + } } // Rules for generating the resulting fragment from Envoy request names. diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index 58e32657..a1c56248 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.go +++ b/pkg/api/aggregation/v1/aggregation.pb.go @@ -130,7 +130,6 @@ func (x *KeyerConfiguration) GetFragments() []*KeyerConfiguration_Fragment { return nil } -// TODO: can we reuse envoy's type.matcher.v3.StringMatcher instead? type NodeStringMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -215,7 +214,6 @@ func (*NodeStringMatch_ExactMatch) isNodeStringMatch_Type() {} func (*NodeStringMatch_RegexMatch) isNodeStringMatch_Type() {} -// TODO: how can we import envoy's definition of Locality? type NodeLocalityMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -980,14 +978,17 @@ func (x *ResultPredicate_AndResult) GetResultPredicates() []*ResultPredicate { } // Rules for generating the resulting fragment from a Envoy request node. -// [#next-free-field: 3] +// [#next-free-field: 4] type ResultPredicate_RequestNodeFragment struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Field NodeFieldType `protobuf:"varint,1,opt,name=field,proto3,enum=aggregation.NodeFieldType" json:"field,omitempty"` - Action *ResultPredicate_ResultAction `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` + // Types that are assignable to Action: + // *ResultPredicate_RequestNodeFragment_IdAction + // *ResultPredicate_RequestNodeFragment_ClusterAction + // *ResultPredicate_RequestNodeFragment_LocalityAction + Action isResultPredicate_RequestNodeFragment_Action `protobuf_oneof:"action"` } func (x *ResultPredicate_RequestNodeFragment) Reset() { @@ -1022,20 +1023,58 @@ func (*ResultPredicate_RequestNodeFragment) Descriptor() ([]byte, []int) { return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 2} } -func (x *ResultPredicate_RequestNodeFragment) GetField() NodeFieldType { - if x != nil { - return x.Field +func (m *ResultPredicate_RequestNodeFragment) GetAction() isResultPredicate_RequestNodeFragment_Action { + if m != nil { + return m.Action } - return NodeFieldType_NODE_ID + return nil } -func (x *ResultPredicate_RequestNodeFragment) GetAction() *ResultPredicate_ResultAction { - if x != nil { - return x.Action +func (x *ResultPredicate_RequestNodeFragment) GetIdAction() *ResultPredicate_ResultAction { + if x, ok := x.GetAction().(*ResultPredicate_RequestNodeFragment_IdAction); ok { + return x.IdAction + } + return nil +} + +func (x *ResultPredicate_RequestNodeFragment) GetClusterAction() *ResultPredicate_ResultAction { + if x, ok := x.GetAction().(*ResultPredicate_RequestNodeFragment_ClusterAction); ok { + return x.ClusterAction + } + return nil +} + +func (x *ResultPredicate_RequestNodeFragment) GetLocalityAction() *NodeLocalityMatch { + if x, ok := x.GetAction().(*ResultPredicate_RequestNodeFragment_LocalityAction); ok { + return x.LocalityAction } return nil } +type isResultPredicate_RequestNodeFragment_Action interface { + isResultPredicate_RequestNodeFragment_Action() +} + +type ResultPredicate_RequestNodeFragment_IdAction struct { + IdAction *ResultPredicate_ResultAction `protobuf:"bytes,1,opt,name=id_action,json=idAction,proto3,oneof"` +} + +type ResultPredicate_RequestNodeFragment_ClusterAction struct { + ClusterAction *ResultPredicate_ResultAction `protobuf:"bytes,2,opt,name=cluster_action,json=clusterAction,proto3,oneof"` +} + +type ResultPredicate_RequestNodeFragment_LocalityAction struct { + LocalityAction *NodeLocalityMatch `protobuf:"bytes,3,opt,name=locality_action,json=localityAction,proto3,oneof"` +} + +func (*ResultPredicate_RequestNodeFragment_IdAction) isResultPredicate_RequestNodeFragment_Action() {} + +func (*ResultPredicate_RequestNodeFragment_ClusterAction) isResultPredicate_RequestNodeFragment_Action() { +} + +func (*ResultPredicate_RequestNodeFragment_LocalityAction) isResultPredicate_RequestNodeFragment_Action() { +} + // Rules for generating the resulting fragment from Envoy request names. // [#next-free-field: 3] type ResultPredicate_ResourceNamesFragment struct { @@ -1244,7 +1283,7 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xe7, 0x07, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xd6, 0x08, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, @@ -1287,37 +1326,44 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x9e, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x8d, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x3a, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, - 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, - 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, - 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x4b, 0x0a, 0x06, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, - 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, - 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, - 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, - 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, - 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, - 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, - 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, - 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x48, 0x0a, 0x09, 0x69, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, + 0x08, 0x69, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52, 0x0a, 0x0e, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, + 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, + 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, + 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, + 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, + 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, + 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, + 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, + 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, + 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, + 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1371,14 +1417,15 @@ var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ 4, // 15: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate 15, // 16: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction 5, // 17: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate - 0, // 18: aggregation.ResultPredicate.RequestNodeFragment.field:type_name -> aggregation.NodeFieldType - 11, // 19: aggregation.ResultPredicate.RequestNodeFragment.action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 20: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction - 21, // [21:21] is the sub-list for method output_type - 21, // [21:21] is the sub-list for method input_type - 21, // [21:21] is the sub-list for extension type_name - 21, // [21:21] is the sub-list for extension extendee - 0, // [0:21] is the sub-list for field type_name + 11, // 18: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 19: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction + 3, // 20: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.NodeLocalityMatch + 11, // 21: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name } func init() { file_aggregation_v1_aggregation_proto_init() } @@ -1595,6 +1642,11 @@ func file_aggregation_v1_aggregation_proto_init() { (*ResultPredicate_ResultAction_Exact)(nil), (*ResultPredicate_ResultAction_RegexAction_)(nil), } + file_aggregation_v1_aggregation_proto_msgTypes[12].OneofWrappers = []interface{}{ + (*ResultPredicate_RequestNodeFragment_IdAction)(nil), + (*ResultPredicate_RequestNodeFragment_ClusterAction)(nil), + (*ResultPredicate_RequestNodeFragment_LocalityAction)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/pkg/api/aggregation/v1/aggregation.pb.validate.go b/pkg/api/aggregation/v1/aggregation.pb.validate.go index 9694f08e..0f8dd1a1 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.validate.go +++ b/pkg/api/aggregation/v1/aggregation.pb.validate.go @@ -1203,28 +1203,50 @@ func (m *ResultPredicate_RequestNodeFragment) Validate() error { return nil } - if _, ok := NodeFieldType_name[int32(m.GetField())]; !ok { - return ResultPredicate_RequestNodeFragmentValidationError{ - field: "Field", - reason: "value must be one of the defined enum values", + switch m.Action.(type) { + + case *ResultPredicate_RequestNodeFragment_IdAction: + + if v, ok := interface{}(m.GetIdAction()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResultPredicate_RequestNodeFragmentValidationError{ + field: "IdAction", + reason: "embedded message failed validation", + cause: err, + } + } } - } - if m.GetAction() == nil { + case *ResultPredicate_RequestNodeFragment_ClusterAction: + + if v, ok := interface{}(m.GetClusterAction()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResultPredicate_RequestNodeFragmentValidationError{ + field: "ClusterAction", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ResultPredicate_RequestNodeFragment_LocalityAction: + + if v, ok := interface{}(m.GetLocalityAction()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResultPredicate_RequestNodeFragmentValidationError{ + field: "LocalityAction", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: return ResultPredicate_RequestNodeFragmentValidationError{ field: "Action", reason: "value is required", } - } - if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResultPredicate_RequestNodeFragmentValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - } - } } return nil From 9610dc8857965b20d21cba1f3819d8e3e27a4b46 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 16:13:23 -0700 Subject: [PATCH 14/29] Edit getResultFromRequestNodePredicate Signed-off-by: eapolinario --- internal/app/mapper/mapper.go | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index cfc51055..599e1537 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -267,11 +267,16 @@ func getResultFromRequestNodePredicate(predicate *resultPredicate, req transport return false, "", nil } - nodeValue, err := getNodeValue(requestNodeFragment.GetField(), req) - if err != nil { - return false, "", err + var resultFragment string + var err error + if requestNodeFragment.GetIdAction() != nil { + resultFragment, err = getResultFragmentFromAction(req.GetNodeID(), requestNodeFragment.GetIdAction()) + } else if requestNodeFragment.GetClusterAction() != nil { + resultFragment, err = getResultFragmentFromAction(req.GetCluster(), requestNodeFragment.GetClusterAction()) + } else if requestNodeFragment.GetLocalityAction() != nil { + resultFragment, err = getFragmentFromLocalityAction(req.GetLocality(), requestNodeFragment.GetLocalityAction()) } - resultFragment, err := getResultFragmentFromAction(nodeValue, requestNodeFragment.GetAction()) + if err != nil { return false, "", err } @@ -408,6 +413,28 @@ func getResultFragmentFromAction( return replacedFragment, nil } +func getFragmentFromLocalityAction( + locality *corev2.Locality, + action *aggregationv1.NodeLocalityMatch) (string, error) { + var matches []string + if locality.Region != "" && locality.Region == action.Region { + matches = append(matches, locality.Region) + } + if locality.Zone != "" && locality.Zone == action.Zone { + matches = append(matches, locality.Zone) + } + if locality.SubZone != "" && locality.SubZone == action.SubZone { + matches = append(matches, locality.SubZone) + } + + if len(matches) == 0 { + return "", fmt.Errorf("RequestNodeFragment match resulted in an empty fragment") + } + + // N.B.: join matches using "|" to indicate they all came from the locality object. + return strings.Join(matches, "|"), nil +} + func compareString(nodeStringMatch *aggregationv1.NodeStringMatch, nodeValue string) (bool, error) { if nodeValue == "" { return false, fmt.Errorf("MatchPredicate Node field cannot be empty") From a7230f31938f4d670ecc954cffd83941c9d7f721 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 16:15:51 -0700 Subject: [PATCH 15/29] fix integration tests Signed-off-by: eapolinario --- .../testdata/keyer_configuration_complete_tech_spec.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/integration/testdata/keyer_configuration_complete_tech_spec.yaml b/integration/testdata/keyer_configuration_complete_tech_spec.yaml index f5c320e4..a2a1315a 100644 --- a/integration/testdata/keyer_configuration_complete_tech_spec.yaml +++ b/integration/testdata/keyer_configuration_complete_tech_spec.yaml @@ -9,8 +9,7 @@ fragments: - "type.googleapis.com/envoy.api.v2.Endpoint" result: request_node_fragment: - field: 0 - action: + id_action: regex_action: { pattern: "^(.*)-*$", replace: "$1" } - rules: - match: @@ -33,8 +32,7 @@ fragments: - "type.googleapis.com/envoy.api.v2.Endpoint" result: request_node_fragment: - field: 1 - action: + cluster_action: regex_action: { pattern: "^*-(.*)-*$", replace: "$1" } - match: request_type_match: @@ -63,8 +61,7 @@ fragments: - "type.googleapis.com/envoy.api.v2.Route" result: request_node_fragment: - field: 1 - action: + cluster_action: regex_action: { pattern: "^*-(.*)-*$", replace: "$1" } - rules: - match: From 92eacd9556b859adc66f2d8024135960c4492d1a Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 16:18:23 -0700 Subject: [PATCH 16/29] delete unused getNodeValue function Signed-off-by: eapolinario --- internal/app/mapper/mapper.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 599e1537..772465da 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -366,26 +366,6 @@ func getResultFromResourceNamesPredicate( return true, result, nil } -func getNodeValue(nodeField aggregationv1.NodeFieldType, req transport.Request) (string, error) { - var nodeValue string - switch nodeField { - case aggregationv1.NodeFieldType_NODE_CLUSTER: - nodeValue = req.GetCluster() - case aggregationv1.NodeFieldType_NODE_ID: - nodeValue = req.GetNodeID() - case aggregationv1.NodeFieldType_NODE_LOCALITY_REGION: - nodeValue = req.GetRegion() - case aggregationv1.NodeFieldType_NODE_LOCALITY_ZONE: - nodeValue = req.GetZone() - case aggregationv1.NodeFieldType_NODE_LOCALITY_SUBZONE: - nodeValue = req.GetSubZone() - default: - return "", fmt.Errorf("RequestNodeFragment Invalid NodeFieldType") - } - - return nodeValue, nil -} - func getResultFragmentFromAction( nodeValue string, action *aggregationv1.ResultPredicate_ResultAction) (string, error) { From a9e76291dac6676d226dff25bca4dd22038dedef Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 16:22:37 -0700 Subject: [PATCH 17/29] Fix e2e test. Signed-off-by: eapolinario --- integration/testdata/keyer_configuration_e2e.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/integration/testdata/keyer_configuration_e2e.yaml b/integration/testdata/keyer_configuration_e2e.yaml index 0cdb0024..cd7a23a0 100644 --- a/integration/testdata/keyer_configuration_e2e.yaml +++ b/integration/testdata/keyer_configuration_e2e.yaml @@ -9,8 +9,7 @@ fragments: - "type.googleapis.com/envoy.api.v2.RouteConfiguration" result: request_node_fragment: - field: 0 - action: + id_action: regex_action: { pattern: "^(.*)-*$", replace: "$1" } - rules: - match: @@ -22,8 +21,7 @@ fragments: - "type.googleapis.com/envoy.api.v2.RouteConfiguration" result: request_node_fragment: - field: 1 - action: + cluster_action: regex_action: { pattern: "^*-(.*)-*$", replace: "$1" } - rules: - match: From 658409b82000a548ffff1d637e605b6a0b209931 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 23:33:28 -0700 Subject: [PATCH 18/29] uncomment Locality tests Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 375 ++++++++++++++++++----------- 1 file changed, 231 insertions(+), 144 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 5b671c4d..05395ed0 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -18,6 +18,7 @@ type Fragment = aggregationv1.KeyerConfiguration_Fragment type FragmentRule = aggregationv1.KeyerConfiguration_Fragment_Rule type MatchPredicate = aggregationv1.MatchPredicate type ResultPredicate = aggregationv1.ResultPredicate +type LocalityResultAction = aggregationv1.ResultPredicate_LocalityResultAction const ( clusterTypeURL = "type.googleapis.com/envoy.api.v2.Cluster" @@ -306,60 +307,120 @@ var positiveTests = []TableEntry{ "replace", }, }, - // { - // Description: "AnyMatch With Exact Node Region match", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeRegionField, getExactAction()), - // clusterTypeURL, - // noderegion, - // }, - // }, - // { - // Description: "AnyMatch With regex Node Region match", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeRegionField, getRegexAction("r(egion)", "p$1")), - // clusterTypeURL, - // "pegion", - // }, - // }, - // { - // Description: "AnyMatch With exact Node Zone match", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeZoneField, getExactAction()), - // clusterTypeURL, - // nodezone, - // }, - // }, - // { - // Description: "AnyMatch With regex Node Zone match", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeZoneField, getRegexAction("z..e$", "newzone")), - // clusterTypeURL, - // "newzone", - // }, - // }, - // { - // Description: "AnyMatch With exact Node Subzone match", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), - // clusterTypeURL, - // nodesubzone, - // }, - // }, - // { - // Description: "AnyMatch With regex Node Subzone match", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeSubZoneField, getRegexAction("[^0-9](u|v)b{1}...e", "zone")), - // clusterTypeURL, - // "zone", - // }, - // }, + { + Description: "AnyMatch With Exact Locality region, zone, and subzone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getExactAction(), + ZoneAction: getExactAction(), + SubzoneAction: getExactAction(), + }, + ), + clusterTypeURL, + fmt.Sprintf("%s|%s|%s", noderegion, nodezone, nodesubzone), + }, + }, + { + Description: "AnyMatch With Exact Locality region and zone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getExactAction(), + ZoneAction: getExactAction(), + }, + ), + clusterTypeURL, + fmt.Sprintf("%s|%s", noderegion, nodezone), + }, + }, + { + Description: "AnyMatch With Exact Locality region and subzone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getExactAction(), + SubzoneAction: getExactAction(), + }, + ), + clusterTypeURL, + fmt.Sprintf("%s|%s", noderegion, nodesubzone), + }, + }, + { + Description: "AnyMatch With Exact Locality zone and subzone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + ZoneAction: getExactAction(), + SubzoneAction: getExactAction(), + }, + ), + clusterTypeURL, + fmt.Sprintf("%s|%s", nodezone, nodesubzone), + }, + }, + { + Description: "AnyMatch With Regex Locality region, zone, and subzone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getRegexAction("r....n", "r1"), + ZoneAction: getRegexAction("z..e", "zone2"), + SubzoneAction: getRegexAction("s..zon.", "subzero"), + }, + ), + clusterTypeURL, + "r1|zone2|subzero", + }, + }, + { + Description: "AnyMatch With Regex Locality region and zone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getRegexAction("r....n", "r1"), + ZoneAction: getRegexAction("z..e", "zone2"), + }, + ), + clusterTypeURL, + "r1|zone2", + }, + }, + { + Description: "AnyMatch With Regex Locality region and subzone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getRegexAction("r....n", "r1"), + SubzoneAction: getRegexAction("s..zon.", "subzero"), + }, + ), + clusterTypeURL, + "r1|subzero", + }, + }, + { + Description: "AnyMatch With Regex Locality zone and subzone match", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + ZoneAction: getRegexAction("z..e", "zone2"), + SubzoneAction: getRegexAction("s..zon.", "subzero"), + }, + ), + clusterTypeURL, + "zone2|subzero", + }, + }, { Description: "AnyMatch With result concatenation", Parameters: []interface{}{ @@ -369,15 +430,15 @@ var positiveTests = []TableEntry{ nodeid + nodecluster, }, }, - // { - // Description: "AnyMatch With result concatenation recursive", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getRepeatedResultPredicate2(), - // clusterTypeURL, - // "str" + noderegion + nodezone + "nTid" + nodecluster, - // }, - // }, + { + Description: "AnyMatch With result concatenation recursive", + Parameters: []interface{}{ + getAnyMatch(true), + getRepeatedResultPredicate2(), + clusterTypeURL, + "str" + noderegion + "|" + nodezone + "nTid" + nodecluster, + }, + }, { Description: "AnyMatch With resource names fragment element 0", Parameters: []interface{}{ @@ -844,33 +905,39 @@ var emptyFragmentErrorCases = []TableEntry{ "RequestNodeFragment exact match resulted in an empty fragment", }, }, - // { - // Description: "empty node region in response action", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeRegionField, getExactAction()), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), - // "RequestNodeFragment exact match resulted in an empty fragment", - // }, - // }, - // { - // Description: "empty node zone in response action", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeZoneField, getExactAction()), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), - // "RequestNodeFragment exact match resulted in an empty fragment", - // }, - // }, - // { - // Description: "empty node subzone in response action", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), - // getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), - // "RequestNodeFragment exact match resulted in an empty fragment", - // }, - // }, + { + Description: "empty node region in response action", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + RegionAction: getExactAction(), + }), + getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), + "RequestNodeFragment exact match resulted in an empty fragment", + }, + }, + { + Description: "empty node zone in response action", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + ZoneAction: getExactAction(), + }), + getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), + "RequestNodeFragment exact match resulted in an empty fragment", + }, + }, + { + Description: "empty node subzone in response action", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + SubzoneAction: getExactAction(), + }), + getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), + "RequestNodeFragment exact match resulted in an empty fragment", + }, + }, { Description: "empty node id in regex response action", Parameters: []interface{}{ @@ -889,33 +956,39 @@ var emptyFragmentErrorCases = []TableEntry{ "RequestNodeFragment regex match resulted in an empty fragment", }, }, - // { - // Description: "empty node region in regex response action", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeRegionField, getRegexAction(noderegion, "")), - // getDiscoveryRequest(), - // "RequestNodeFragment regex match resulted in an empty fragment", - // }, - // }, - // { - // Description: "empty node zone in regex response action", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeZoneField, getRegexAction(nodezone, "")), - // getDiscoveryRequest(), - // "RequestNodeFragment regex match resulted in an empty fragment", - // }, - // }, - // { - // Description: "empty node subzone in regex response action", - // Parameters: []interface{}{ - // getAnyMatch(true), - // getResultRequestNodeFragment(nodeSubZoneField, getRegexAction(nodesubzone, "")), - // getDiscoveryRequest(), - // "RequestNodeFragment regex match resulted in an empty fragment", - // }, - // }, + { + Description: "empty node region in regex response action", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + RegionAction: getRegexAction(noderegion, ""), + }), + getDiscoveryRequest(), + "RequestNodeFragment regex match resulted in an empty fragment", + }, + }, + { + Description: "empty node zone in regex response action", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + ZoneAction: getRegexAction(nodezone, ""), + }), + getDiscoveryRequest(), + "RequestNodeFragment regex match resulted in an empty fragment", + }, + }, + { + Description: "empty node subzone in regex response action", + Parameters: []interface{}{ + getAnyMatch(true), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + SubzoneAction: getRegexAction(nodesubzone, ""), + }), + getDiscoveryRequest(), + "RequestNodeFragment regex match resulted in an empty fragment", + }, + }, { Description: "resource fragment is negative", Parameters: []interface{}{ @@ -1320,33 +1393,35 @@ func getRepeatedResultPredicate1() *ResultPredicate { } } -// func getRepeatedResultPredicate2() *ResultPredicate { -// return &ResultPredicate{ -// Type: &aggregationv1.ResultPredicate_AndResult_{ -// AndResult: &aggregationv1.ResultPredicate_AndResult{ -// ResultPredicates: []*aggregationv1.ResultPredicate{ -// { -// Type: &aggregationv1.ResultPredicate_AndResult_{ -// AndResult: &aggregationv1.ResultPredicate_AndResult{ -// ResultPredicates: []*aggregationv1.ResultPredicate{ -// { -// Type: &aggregationv1.ResultPredicate_StringFragment{ -// StringFragment: "str", -// }, -// }, -// getResultRequestNodeFragment(nodeRegionField, getExactAction()), -// getResultRequestNodeFragment(nodeZoneField, getExactAction()), -// }, -// }, -// }, -// }, -// getResultRequestNodeIDFragment(getRegexAction("ode", "T")), -// getResultRequestNodeClusterFragment(getExactAction()), -// }, -// }, -// }, -// } -// } +func getRepeatedResultPredicate2() *ResultPredicate { + return &ResultPredicate{ + Type: &aggregationv1.ResultPredicate_AndResult_{ + AndResult: &aggregationv1.ResultPredicate_AndResult{ + ResultPredicates: []*aggregationv1.ResultPredicate{ + { + Type: &aggregationv1.ResultPredicate_AndResult_{ + AndResult: &aggregationv1.ResultPredicate_AndResult{ + ResultPredicates: []*aggregationv1.ResultPredicate{ + { + Type: &aggregationv1.ResultPredicate_StringFragment{ + StringFragment: "str", + }, + }, + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + RegionAction: getExactAction(), + ZoneAction: getExactAction(), + }), + }, + }, + }, + }, + getResultRequestNodeIDFragment(getRegexAction("ode", "T")), + getResultRequestNodeClusterFragment(getExactAction()), + }, + }, + }, + } +} func getRepeatedResultPredicate3() *ResultPredicate { return &ResultPredicate{ @@ -1398,6 +1473,18 @@ func getResultRequestNodeClusterFragment( } } +func getResultRequestNodeLocalityFragment(action *aggregationv1.ResultPredicate_LocalityResultAction) *resultPredicate { + return &ResultPredicate{ + Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ + RequestNodeFragment: &aggregationv1.ResultPredicate_RequestNodeFragment{ + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_LocalityAction{ + LocalityAction: action, + }, + }, + }, + } +} + func getExactAction() *aggregationv1.ResultPredicate_ResultAction { return &aggregationv1.ResultPredicate_ResultAction{ Action: &aggregationv1.ResultPredicate_ResultAction_Exact{ From 2d0416a721e8281e6f05bfb001579708460ddce4 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 23:34:11 -0700 Subject: [PATCH 19/29] Define LocalityResultAction Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 12 +- internal/app/mapper/mapper.go | 26 +- pkg/api/aggregation/v1/aggregation.pb.go | 256 ++++++++++++------ .../aggregation/v1/aggregation.pb.validate.go | 98 +++++++ 4 files changed, 305 insertions(+), 87 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index eb28209c..ea1440a1 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -150,6 +150,16 @@ message ResultPredicate { } } + // Rule for how to generate a fragment from a Locality object + // [#next-free-field: 4] + message LocalityResultAction { + ResultAction region_action = 1; + + ResultAction zone_action = 2; + + ResultAction subzone_action = 3; + } + message AndResult { repeated ResultPredicate result_predicates = 1 [(validate.rules).repeated.min_items = 2]; } @@ -163,7 +173,7 @@ message ResultPredicate { ResultAction id_action = 1; ResultAction cluster_action = 2; - NodeLocalityMatch locality_action = 3; + LocalityResultAction locality_action = 3; } } diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 772465da..c312266a 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -395,16 +395,28 @@ func getResultFragmentFromAction( func getFragmentFromLocalityAction( locality *corev2.Locality, - action *aggregationv1.NodeLocalityMatch) (string, error) { + action *aggregationv1.ResultPredicate_LocalityResultAction) (string, error) { var matches []string - if locality.Region != "" && locality.Region == action.Region { - matches = append(matches, locality.Region) + if action.RegionAction != nil { + fragment, err := getResultFragmentFromAction(locality.Region, action.RegionAction) + if err != nil { + return "", err + } + matches = append(matches, fragment) } - if locality.Zone != "" && locality.Zone == action.Zone { - matches = append(matches, locality.Zone) + if action.ZoneAction != nil { + fragment, err := getResultFragmentFromAction(locality.Zone, action.ZoneAction) + if err != nil { + return "", err + } + matches = append(matches, fragment) } - if locality.SubZone != "" && locality.SubZone == action.SubZone { - matches = append(matches, locality.SubZone) + if action.SubzoneAction != nil { + fragment, err := getResultFragmentFromAction(locality.SubZone, action.SubzoneAction) + if err != nil { + return "", err + } + matches = append(matches, fragment) } if len(matches) == 0 { diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index a1c56248..6a4192dc 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.go +++ b/pkg/api/aggregation/v1/aggregation.pb.go @@ -930,6 +930,71 @@ func (*ResultPredicate_ResultAction_Exact) isResultPredicate_ResultAction_Action func (*ResultPredicate_ResultAction_RegexAction_) isResultPredicate_ResultAction_Action() {} +// Rule for how to generate a fragment from a Locality object +// [#next-free-field: 4] +type ResultPredicate_LocalityResultAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RegionAction *ResultPredicate_ResultAction `protobuf:"bytes,1,opt,name=region_action,json=regionAction,proto3" json:"region_action,omitempty"` + ZoneAction *ResultPredicate_ResultAction `protobuf:"bytes,2,opt,name=zone_action,json=zoneAction,proto3" json:"zone_action,omitempty"` + SubzoneAction *ResultPredicate_ResultAction `protobuf:"bytes,3,opt,name=subzone_action,json=subzoneAction,proto3" json:"subzone_action,omitempty"` +} + +func (x *ResultPredicate_LocalityResultAction) Reset() { + *x = ResultPredicate_LocalityResultAction{} + if protoimpl.UnsafeEnabled { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResultPredicate_LocalityResultAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResultPredicate_LocalityResultAction) ProtoMessage() {} + +func (x *ResultPredicate_LocalityResultAction) ProtoReflect() protoreflect.Message { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResultPredicate_LocalityResultAction.ProtoReflect.Descriptor instead. +func (*ResultPredicate_LocalityResultAction) Descriptor() ([]byte, []int) { + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 1} +} + +func (x *ResultPredicate_LocalityResultAction) GetRegionAction() *ResultPredicate_ResultAction { + if x != nil { + return x.RegionAction + } + return nil +} + +func (x *ResultPredicate_LocalityResultAction) GetZoneAction() *ResultPredicate_ResultAction { + if x != nil { + return x.ZoneAction + } + return nil +} + +func (x *ResultPredicate_LocalityResultAction) GetSubzoneAction() *ResultPredicate_ResultAction { + if x != nil { + return x.SubzoneAction + } + return nil +} + type ResultPredicate_AndResult struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -941,7 +1006,7 @@ type ResultPredicate_AndResult struct { func (x *ResultPredicate_AndResult) Reset() { *x = ResultPredicate_AndResult{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -954,7 +1019,7 @@ func (x *ResultPredicate_AndResult) String() string { func (*ResultPredicate_AndResult) ProtoMessage() {} func (x *ResultPredicate_AndResult) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[11] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -967,7 +1032,7 @@ func (x *ResultPredicate_AndResult) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultPredicate_AndResult.ProtoReflect.Descriptor instead. func (*ResultPredicate_AndResult) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 1} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 2} } func (x *ResultPredicate_AndResult) GetResultPredicates() []*ResultPredicate { @@ -994,7 +1059,7 @@ type ResultPredicate_RequestNodeFragment struct { func (x *ResultPredicate_RequestNodeFragment) Reset() { *x = ResultPredicate_RequestNodeFragment{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1007,7 +1072,7 @@ func (x *ResultPredicate_RequestNodeFragment) String() string { func (*ResultPredicate_RequestNodeFragment) ProtoMessage() {} func (x *ResultPredicate_RequestNodeFragment) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[12] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1020,7 +1085,7 @@ func (x *ResultPredicate_RequestNodeFragment) ProtoReflect() protoreflect.Messag // Deprecated: Use ResultPredicate_RequestNodeFragment.ProtoReflect.Descriptor instead. func (*ResultPredicate_RequestNodeFragment) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 2} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 3} } func (m *ResultPredicate_RequestNodeFragment) GetAction() isResultPredicate_RequestNodeFragment_Action { @@ -1044,7 +1109,7 @@ func (x *ResultPredicate_RequestNodeFragment) GetClusterAction() *ResultPredicat return nil } -func (x *ResultPredicate_RequestNodeFragment) GetLocalityAction() *NodeLocalityMatch { +func (x *ResultPredicate_RequestNodeFragment) GetLocalityAction() *ResultPredicate_LocalityResultAction { if x, ok := x.GetAction().(*ResultPredicate_RequestNodeFragment_LocalityAction); ok { return x.LocalityAction } @@ -1064,7 +1129,7 @@ type ResultPredicate_RequestNodeFragment_ClusterAction struct { } type ResultPredicate_RequestNodeFragment_LocalityAction struct { - LocalityAction *NodeLocalityMatch `protobuf:"bytes,3,opt,name=locality_action,json=localityAction,proto3,oneof"` + LocalityAction *ResultPredicate_LocalityResultAction `protobuf:"bytes,3,opt,name=locality_action,json=localityAction,proto3,oneof"` } func (*ResultPredicate_RequestNodeFragment_IdAction) isResultPredicate_RequestNodeFragment_Action() {} @@ -1091,7 +1156,7 @@ type ResultPredicate_ResourceNamesFragment struct { func (x *ResultPredicate_ResourceNamesFragment) Reset() { *x = ResultPredicate_ResourceNamesFragment{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1104,7 +1169,7 @@ func (x *ResultPredicate_ResourceNamesFragment) String() string { func (*ResultPredicate_ResourceNamesFragment) ProtoMessage() {} func (x *ResultPredicate_ResourceNamesFragment) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1117,7 +1182,7 @@ func (x *ResultPredicate_ResourceNamesFragment) ProtoReflect() protoreflect.Mess // Deprecated: Use ResultPredicate_ResourceNamesFragment.ProtoReflect.Descriptor instead. func (*ResultPredicate_ResourceNamesFragment) Descriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 3} + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{4, 4} } func (x *ResultPredicate_ResourceNamesFragment) GetElement() int32 { @@ -1149,7 +1214,7 @@ type ResultPredicate_ResultAction_RegexAction struct { func (x *ResultPredicate_ResultAction_RegexAction) Reset() { *x = ResultPredicate_ResultAction_RegexAction{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[14] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1162,7 +1227,7 @@ func (x *ResultPredicate_ResultAction_RegexAction) String() string { func (*ResultPredicate_ResultAction_RegexAction) ProtoMessage() {} func (x *ResultPredicate_ResultAction_RegexAction) ProtoReflect() protoreflect.Message { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[14] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1283,7 +1348,7 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xd6, 0x08, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xf0, 0x0a, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, @@ -1320,50 +1385,67 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x00, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x60, 0x0a, 0x09, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x8d, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x48, 0x0a, 0x09, 0x69, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x84, 0x02, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, + 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, + 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4a, + 0x0a, 0x0b, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, + 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x0e, 0x73, 0x75, + 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, - 0x08, 0x69, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52, 0x0a, 0x0e, 0x63, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, - 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, - 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, - 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, - 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, + 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x60, 0x0a, 0x09, + 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x11, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, - 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, - 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, - 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, - 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, - 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, - 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, - 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0xa0, + 0x02, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x64, 0x5f, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, + 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x69, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x52, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, + 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, + 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, + 0x01, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, + 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, + 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, + 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, + 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, + 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, + 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, + 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, + 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, + 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, + 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1379,7 +1461,7 @@ func file_aggregation_v1_aggregation_proto_rawDescGZIP() []byte { } var file_aggregation_v1_aggregation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_aggregation_v1_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_aggregation_v1_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ (NodeFieldType)(0), // 0: aggregation.NodeFieldType (*KeyerConfiguration)(nil), // 1: aggregation.KeyerConfiguration @@ -1393,10 +1475,11 @@ var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ (*MatchPredicate_RequestNodeMatch)(nil), // 9: aggregation.MatchPredicate.RequestNodeMatch (*MatchPredicate_MatchSet)(nil), // 10: aggregation.MatchPredicate.MatchSet (*ResultPredicate_ResultAction)(nil), // 11: aggregation.ResultPredicate.ResultAction - (*ResultPredicate_AndResult)(nil), // 12: aggregation.ResultPredicate.AndResult - (*ResultPredicate_RequestNodeFragment)(nil), // 13: aggregation.ResultPredicate.RequestNodeFragment - (*ResultPredicate_ResourceNamesFragment)(nil), // 14: aggregation.ResultPredicate.ResourceNamesFragment - (*ResultPredicate_ResultAction_RegexAction)(nil), // 15: aggregation.ResultPredicate.ResultAction.RegexAction + (*ResultPredicate_LocalityResultAction)(nil), // 12: aggregation.ResultPredicate.LocalityResultAction + (*ResultPredicate_AndResult)(nil), // 13: aggregation.ResultPredicate.AndResult + (*ResultPredicate_RequestNodeFragment)(nil), // 14: aggregation.ResultPredicate.RequestNodeFragment + (*ResultPredicate_ResourceNamesFragment)(nil), // 15: aggregation.ResultPredicate.ResourceNamesFragment + (*ResultPredicate_ResultAction_RegexAction)(nil), // 16: aggregation.ResultPredicate.ResultAction.RegexAction } var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ 6, // 0: aggregation.KeyerConfiguration.fragments:type_name -> aggregation.KeyerConfiguration.Fragment @@ -1405,9 +1488,9 @@ var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ 4, // 3: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate 8, // 4: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch 9, // 5: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch - 12, // 6: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult - 13, // 7: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment - 14, // 8: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment + 13, // 6: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult + 14, // 7: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment + 15, // 8: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment 7, // 9: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule 4, // 10: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate 5, // 11: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate @@ -1415,17 +1498,20 @@ var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ 2, // 13: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.NodeStringMatch 3, // 14: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.NodeLocalityMatch 4, // 15: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate - 15, // 16: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction - 5, // 17: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate - 11, // 18: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 19: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction - 3, // 20: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.NodeLocalityMatch - 11, // 21: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 16, // 16: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction + 11, // 17: aggregation.ResultPredicate.LocalityResultAction.region_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 18: aggregation.ResultPredicate.LocalityResultAction.zone_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 19: aggregation.ResultPredicate.LocalityResultAction.subzone_action:type_name -> aggregation.ResultPredicate.ResultAction + 5, // 20: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate + 11, // 21: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 22: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction + 12, // 23: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.ResultPredicate.LocalityResultAction + 11, // 24: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction + 25, // [25:25] is the sub-list for method output_type + 25, // [25:25] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_aggregation_v1_aggregation_proto_init() } @@ -1567,7 +1653,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_AndResult); i { + switch v := v.(*ResultPredicate_LocalityResultAction); i { case 0: return &v.state case 1: @@ -1579,7 +1665,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_RequestNodeFragment); i { + switch v := v.(*ResultPredicate_AndResult); i { case 0: return &v.state case 1: @@ -1591,7 +1677,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultPredicate_ResourceNamesFragment); i { + switch v := v.(*ResultPredicate_RequestNodeFragment); i { case 0: return &v.state case 1: @@ -1603,6 +1689,18 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResultPredicate_ResourceNamesFragment); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aggregation_v1_aggregation_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultPredicate_ResultAction_RegexAction); i { case 0: return &v.state @@ -1642,7 +1740,7 @@ func file_aggregation_v1_aggregation_proto_init() { (*ResultPredicate_ResultAction_Exact)(nil), (*ResultPredicate_ResultAction_RegexAction_)(nil), } - file_aggregation_v1_aggregation_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_aggregation_v1_aggregation_proto_msgTypes[13].OneofWrappers = []interface{}{ (*ResultPredicate_RequestNodeFragment_IdAction)(nil), (*ResultPredicate_RequestNodeFragment_ClusterAction)(nil), (*ResultPredicate_RequestNodeFragment_LocalityAction)(nil), @@ -1653,7 +1751,7 @@ func file_aggregation_v1_aggregation_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_aggregation_v1_aggregation_proto_rawDesc, NumEnums: 1, - NumMessages: 15, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/api/aggregation/v1/aggregation.pb.validate.go b/pkg/api/aggregation/v1/aggregation.pb.validate.go index 0f8dd1a1..1645bb1a 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.validate.go +++ b/pkg/api/aggregation/v1/aggregation.pb.validate.go @@ -1106,6 +1106,104 @@ var _ interface { ErrorName() string } = ResultPredicate_ResultActionValidationError{} +// Validate checks the field values on ResultPredicate_LocalityResultAction +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *ResultPredicate_LocalityResultAction) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetRegionAction()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResultPredicate_LocalityResultActionValidationError{ + field: "RegionAction", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if v, ok := interface{}(m.GetZoneAction()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResultPredicate_LocalityResultActionValidationError{ + field: "ZoneAction", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if v, ok := interface{}(m.GetSubzoneAction()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResultPredicate_LocalityResultActionValidationError{ + field: "SubzoneAction", + reason: "embedded message failed validation", + cause: err, + } + } + } + + return nil +} + +// ResultPredicate_LocalityResultActionValidationError is the validation error +// returned by ResultPredicate_LocalityResultAction.Validate if the designated +// constraints aren't met. +type ResultPredicate_LocalityResultActionValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResultPredicate_LocalityResultActionValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResultPredicate_LocalityResultActionValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResultPredicate_LocalityResultActionValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResultPredicate_LocalityResultActionValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResultPredicate_LocalityResultActionValidationError) ErrorName() string { + return "ResultPredicate_LocalityResultActionValidationError" +} + +// Error satisfies the builtin error interface +func (e ResultPredicate_LocalityResultActionValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResultPredicate_LocalityResultAction.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResultPredicate_LocalityResultActionValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResultPredicate_LocalityResultActionValidationError{} + // Validate checks the field values on ResultPredicate_AndResult with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. From 805c0f41c3973d1e0220ee787ddfe6bb4b658ef7 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 23:34:32 -0700 Subject: [PATCH 20/29] fix example aggregation rules file. Signed-off-by: eapolinario --- example/config-files/aggregation-rules.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/example/config-files/aggregation-rules.yaml b/example/config-files/aggregation-rules.yaml index afe97724..b704196a 100644 --- a/example/config-files/aggregation-rules.yaml +++ b/example/config-files/aggregation-rules.yaml @@ -9,8 +9,7 @@ fragments: - "type.googleapis.com/envoy.api.v2.RouteConfiguration" result: request_node_fragment: - field: 1 - action: + cluster_action: regex_action: { pattern: "^(.*)-.*$", replace: "$1" } - rules: - match: From 509de3506ce8d5cbd41099065a5d4c5aad083a9e Mon Sep 17 00:00:00 2001 From: eapolinario Date: Mon, 31 Aug 2020 23:51:10 -0700 Subject: [PATCH 21/29] s/NodeStringMatch/StringMatch/g Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 6 +- internal/app/mapper/mapper.go | 6 +- internal/app/mapper/mapper_test.go | 16 +- pkg/api/aggregation/v1/aggregation.pb.go | 366 +++++++++--------- .../aggregation/v1/aggregation.pb.validate.go | 38 +- 5 files changed, 216 insertions(+), 216 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index ea1440a1..7d9e7d68 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -40,7 +40,7 @@ enum NodeFieldType { NODE_LOCALITY_SUBZONE = 4; } -message NodeStringMatch { +message StringMatch { oneof type { option (validate.required) = true; @@ -81,9 +81,9 @@ message MatchPredicate { oneof type { option (validate.required) = true; - NodeStringMatch id_match = 1; + StringMatch id_match = 1; - NodeStringMatch cluster_match = 2; + StringMatch cluster_match = 2; NodeLocalityMatch locality_match = 3; } diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index c312266a..0fc97cd3 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -427,16 +427,16 @@ func getFragmentFromLocalityAction( return strings.Join(matches, "|"), nil } -func compareString(nodeStringMatch *aggregationv1.NodeStringMatch, nodeValue string) (bool, error) { +func compareString(stringMatch *aggregationv1.StringMatch, nodeValue string) (bool, error) { if nodeValue == "" { return false, fmt.Errorf("MatchPredicate Node field cannot be empty") } - exactMatch := nodeStringMatch.GetExactMatch() + exactMatch := stringMatch.GetExactMatch() if exactMatch != "" { return nodeValue == exactMatch, nil } - regexMatch := nodeStringMatch.GetRegexMatch() + regexMatch := stringMatch.GetRegexMatch() if regexMatch != "" { match, err := regexp.MatchString(regexMatch, nodeValue) if err != nil { diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 05395ed0..02ef8873 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -1227,8 +1227,8 @@ func getRequestNodeIDExactMatch(exact string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ - IdMatch: &aggregationv1.NodeStringMatch{ - Type: &aggregationv1.NodeStringMatch_ExactMatch{ + IdMatch: &aggregationv1.StringMatch{ + Type: &aggregationv1.StringMatch_ExactMatch{ ExactMatch: exact, }, }, @@ -1243,8 +1243,8 @@ func getRequestNodeIDRegexMatch(regex string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ - IdMatch: &aggregationv1.NodeStringMatch{ - Type: &aggregationv1.NodeStringMatch_RegexMatch{ + IdMatch: &aggregationv1.StringMatch{ + Type: &aggregationv1.StringMatch_RegexMatch{ RegexMatch: regex, }, }, @@ -1259,8 +1259,8 @@ func getRequestNodeClusterExactMatch(exact string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ClusterMatch{ - ClusterMatch: &aggregationv1.NodeStringMatch{ - Type: &aggregationv1.NodeStringMatch_ExactMatch{ + ClusterMatch: &aggregationv1.StringMatch{ + Type: &aggregationv1.StringMatch_ExactMatch{ ExactMatch: exact, }, }, @@ -1275,8 +1275,8 @@ func getRequestNodeClusterRegexMatch(regex string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ClusterMatch{ - ClusterMatch: &aggregationv1.NodeStringMatch{ - Type: &aggregationv1.NodeStringMatch_RegexMatch{ + ClusterMatch: &aggregationv1.StringMatch{ + Type: &aggregationv1.StringMatch_RegexMatch{ RegexMatch: regex, }, }, diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index 6a4192dc..b8aabbf0 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.go +++ b/pkg/api/aggregation/v1/aggregation.pb.go @@ -130,19 +130,19 @@ func (x *KeyerConfiguration) GetFragments() []*KeyerConfiguration_Fragment { return nil } -type NodeStringMatch struct { +type StringMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Type: - // *NodeStringMatch_ExactMatch - // *NodeStringMatch_RegexMatch - Type isNodeStringMatch_Type `protobuf_oneof:"type"` + // *StringMatch_ExactMatch + // *StringMatch_RegexMatch + Type isStringMatch_Type `protobuf_oneof:"type"` } -func (x *NodeStringMatch) Reset() { - *x = NodeStringMatch{} +func (x *StringMatch) Reset() { + *x = StringMatch{} if protoimpl.UnsafeEnabled { mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -150,13 +150,13 @@ func (x *NodeStringMatch) Reset() { } } -func (x *NodeStringMatch) String() string { +func (x *StringMatch) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NodeStringMatch) ProtoMessage() {} +func (*StringMatch) ProtoMessage() {} -func (x *NodeStringMatch) ProtoReflect() protoreflect.Message { +func (x *StringMatch) ProtoReflect() protoreflect.Message { mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -168,51 +168,51 @@ func (x *NodeStringMatch) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NodeStringMatch.ProtoReflect.Descriptor instead. -func (*NodeStringMatch) Descriptor() ([]byte, []int) { +// Deprecated: Use StringMatch.ProtoReflect.Descriptor instead. +func (*StringMatch) Descriptor() ([]byte, []int) { return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1} } -func (m *NodeStringMatch) GetType() isNodeStringMatch_Type { +func (m *StringMatch) GetType() isStringMatch_Type { if m != nil { return m.Type } return nil } -func (x *NodeStringMatch) GetExactMatch() string { - if x, ok := x.GetType().(*NodeStringMatch_ExactMatch); ok { +func (x *StringMatch) GetExactMatch() string { + if x, ok := x.GetType().(*StringMatch_ExactMatch); ok { return x.ExactMatch } return "" } -func (x *NodeStringMatch) GetRegexMatch() string { - if x, ok := x.GetType().(*NodeStringMatch_RegexMatch); ok { +func (x *StringMatch) GetRegexMatch() string { + if x, ok := x.GetType().(*StringMatch_RegexMatch); ok { return x.RegexMatch } return "" } -type isNodeStringMatch_Type interface { - isNodeStringMatch_Type() +type isStringMatch_Type interface { + isStringMatch_Type() } -type NodeStringMatch_ExactMatch struct { +type StringMatch_ExactMatch struct { // Match on the extract string value. ExactMatch string `protobuf:"bytes,2,opt,name=exact_match,json=exactMatch,proto3,oneof"` } -type NodeStringMatch_RegexMatch struct { +type StringMatch_RegexMatch struct { // Match on a regex pattern. // TODO potentially use "safe regex" // https://github.com/envoyproxy/envoy/blob/10f756efa17e56c8d4d1033be7b4286410db4e01/api/envoy/type/matcher/v3/regex.proto RegexMatch string `protobuf:"bytes,3,opt,name=regex_match,json=regexMatch,proto3,oneof"` } -func (*NodeStringMatch_ExactMatch) isNodeStringMatch_Type() {} +func (*StringMatch_ExactMatch) isStringMatch_Type() {} -func (*NodeStringMatch_RegexMatch) isNodeStringMatch_Type() {} +func (*StringMatch_RegexMatch) isStringMatch_Type() {} type NodeLocalityMatch struct { state protoimpl.MessageState @@ -755,14 +755,14 @@ func (m *MatchPredicate_RequestNodeMatch) GetType() isMatchPredicate_RequestNode return nil } -func (x *MatchPredicate_RequestNodeMatch) GetIdMatch() *NodeStringMatch { +func (x *MatchPredicate_RequestNodeMatch) GetIdMatch() *StringMatch { if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_IdMatch); ok { return x.IdMatch } return nil } -func (x *MatchPredicate_RequestNodeMatch) GetClusterMatch() *NodeStringMatch { +func (x *MatchPredicate_RequestNodeMatch) GetClusterMatch() *StringMatch { if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_ClusterMatch); ok { return x.ClusterMatch } @@ -781,11 +781,11 @@ type isMatchPredicate_RequestNodeMatch_Type interface { } type MatchPredicate_RequestNodeMatch_IdMatch struct { - IdMatch *NodeStringMatch `protobuf:"bytes,1,opt,name=id_match,json=idMatch,proto3,oneof"` + IdMatch *StringMatch `protobuf:"bytes,1,opt,name=id_match,json=idMatch,proto3,oneof"` } type MatchPredicate_RequestNodeMatch_ClusterMatch struct { - ClusterMatch *NodeStringMatch `protobuf:"bytes,2,opt,name=cluster_match,json=clusterMatch,proto3,oneof"` + ClusterMatch *StringMatch `protobuf:"bytes,2,opt,name=cluster_match,json=clusterMatch,proto3,oneof"` } type MatchPredicate_RequestNodeMatch_LocalityMatch struct { @@ -1285,167 +1285,167 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0x64, 0x0a, 0x0f, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x65, - 0x78, 0x61, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x72, 0x65, 0x67, - 0x65, 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x0a, 0x72, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x5a, 0x0a, 0x11, 0x4e, 0x6f, 0x64, - 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, - 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, - 0x62, 0x5f, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x62, 0x5a, 0x6f, 0x6e, 0x65, 0x22, 0xad, 0x06, 0x0a, 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, - 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, + 0x75, 0x6c, 0x74, 0x22, 0x60, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x61, 0x63, 0x74, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x6d, + 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, + 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x5a, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, + 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, 0x7a, 0x6f, + 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x5a, 0x6f, 0x6e, + 0x65, 0x22, 0xa5, 0x06, 0x0a, 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, + 0x08, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x41, 0x0a, 0x08, 0x6f, 0x72, 0x5f, + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, - 0x74, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x41, 0x0a, - 0x08, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x3a, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x48, 0x00, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, - 0x61, 0x6e, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, - 0x52, 0x10, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, - 0x64, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, - 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x1a, 0x32, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x1a, 0xe8, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x39, 0x0a, 0x08, 0x69, 0x64, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x07, 0x69, 0x64, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x12, 0x43, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x47, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, - 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x48, 0x00, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, - 0x47, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x12, 0x3b, 0x0a, 0x05, 0x72, - 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, + 0x74, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x09, + 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, + 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, 0x61, 0x6e, 0x79, 0x5f, + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, + 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x5c, + 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, + 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, - 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, - 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xf0, 0x0a, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x6e, 0x64, - 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, - 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6e, 0x64, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x09, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, - 0x64, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x30, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, + 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x32, 0x0a, 0x10, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, + 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x1a, 0xe0, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x35, 0x0a, 0x08, 0x69, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x48, 0x00, 0x52, 0x07, 0x69, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3f, 0x0a, 0x0d, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, + 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x47, 0x0a, + 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, + 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, + 0xf8, 0x42, 0x01, 0x1a, 0x47, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x12, + 0x3b, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, + 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xf0, 0x0a, 0x0a, 0x0f, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, + 0x0a, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6c, 0x0a, 0x17, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x66, 0x72, 0x61, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, - 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x1a, 0xef, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x05, - 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x5a, 0x0a, 0x0c, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x1a, 0x53, 0x0a, 0x0b, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x00, 0x52, 0x07, 0x72, - 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x84, 0x02, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, - 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, - 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x09, 0x61, 0x6e, 0x64, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4a, - 0x0a, 0x0b, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, - 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x0e, 0x73, 0x75, - 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, - 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x60, 0x0a, 0x09, - 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x11, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0xa0, - 0x02, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, - 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x64, 0x5f, 0x61, 0x63, 0x74, + 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, + 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6c, + 0x0a, 0x17, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x32, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x0f, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, + 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0xef, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, + 0x48, 0x00, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x5a, 0x0a, 0x0c, 0x72, 0x65, 0x67, + 0x65, 0x78, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x53, 0x0a, 0x0b, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, + 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, + 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x00, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x84, 0x02, 0x0a, 0x14, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x69, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x52, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x0b, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0a, 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, + 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x1a, 0x60, 0x0a, 0x09, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, + 0x11, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, - 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, + 0x52, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x73, 0x1a, 0xa0, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, + 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x64, + 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, - 0x01, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, - 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, - 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, - 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, - 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, - 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, - 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, - 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, - 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, - 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, - 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x69, 0x64, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, + 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x31, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, + 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, + 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, + 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, + 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, + 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, + 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, + 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, + 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, + 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, + 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, + 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -1465,7 +1465,7 @@ var file_aggregation_v1_aggregation_proto_msgTypes = make([]protoimpl.MessageInf var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ (NodeFieldType)(0), // 0: aggregation.NodeFieldType (*KeyerConfiguration)(nil), // 1: aggregation.KeyerConfiguration - (*NodeStringMatch)(nil), // 2: aggregation.NodeStringMatch + (*StringMatch)(nil), // 2: aggregation.StringMatch (*NodeLocalityMatch)(nil), // 3: aggregation.NodeLocalityMatch (*MatchPredicate)(nil), // 4: aggregation.MatchPredicate (*ResultPredicate)(nil), // 5: aggregation.ResultPredicate @@ -1494,8 +1494,8 @@ var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ 7, // 9: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule 4, // 10: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate 5, // 11: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate - 2, // 12: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.NodeStringMatch - 2, // 13: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.NodeStringMatch + 2, // 12: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.StringMatch + 2, // 13: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.StringMatch 3, // 14: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.NodeLocalityMatch 4, // 15: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate 16, // 16: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction @@ -1533,7 +1533,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeStringMatch); i { + switch v := v.(*StringMatch); i { case 0: return &v.state case 1: @@ -1714,8 +1714,8 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*NodeStringMatch_ExactMatch)(nil), - (*NodeStringMatch_RegexMatch)(nil), + (*StringMatch_ExactMatch)(nil), + (*StringMatch_RegexMatch)(nil), } file_aggregation_v1_aggregation_proto_msgTypes[3].OneofWrappers = []interface{}{ (*MatchPredicate_AndMatch)(nil), diff --git a/pkg/api/aggregation/v1/aggregation.pb.validate.go b/pkg/api/aggregation/v1/aggregation.pb.validate.go index 1645bb1a..3de541ae 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.validate.go +++ b/pkg/api/aggregation/v1/aggregation.pb.validate.go @@ -125,24 +125,24 @@ var _ interface { ErrorName() string } = KeyerConfigurationValidationError{} -// Validate checks the field values on NodeStringMatch with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. -func (m *NodeStringMatch) Validate() error { +// Validate checks the field values on StringMatch with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *StringMatch) Validate() error { if m == nil { return nil } switch m.Type.(type) { - case *NodeStringMatch_ExactMatch: + case *StringMatch_ExactMatch: // no validation rules for ExactMatch - case *NodeStringMatch_RegexMatch: + case *StringMatch_RegexMatch: // no validation rules for RegexMatch default: - return NodeStringMatchValidationError{ + return StringMatchValidationError{ field: "Type", reason: "value is required", } @@ -152,9 +152,9 @@ func (m *NodeStringMatch) Validate() error { return nil } -// NodeStringMatchValidationError is the validation error returned by -// NodeStringMatch.Validate if the designated constraints aren't met. -type NodeStringMatchValidationError struct { +// StringMatchValidationError is the validation error returned by +// StringMatch.Validate if the designated constraints aren't met. +type StringMatchValidationError struct { field string reason string cause error @@ -162,22 +162,22 @@ type NodeStringMatchValidationError struct { } // Field function returns field value. -func (e NodeStringMatchValidationError) Field() string { return e.field } +func (e StringMatchValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e NodeStringMatchValidationError) Reason() string { return e.reason } +func (e StringMatchValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e NodeStringMatchValidationError) Cause() error { return e.cause } +func (e StringMatchValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e NodeStringMatchValidationError) Key() bool { return e.key } +func (e StringMatchValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e NodeStringMatchValidationError) ErrorName() string { return "NodeStringMatchValidationError" } +func (e StringMatchValidationError) ErrorName() string { return "StringMatchValidationError" } // Error satisfies the builtin error interface -func (e NodeStringMatchValidationError) Error() string { +func (e StringMatchValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -189,14 +189,14 @@ func (e NodeStringMatchValidationError) Error() string { } return fmt.Sprintf( - "invalid %sNodeStringMatch.%s: %s%s", + "invalid %sStringMatch.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = NodeStringMatchValidationError{} +var _ error = StringMatchValidationError{} var _ interface { Field() string @@ -204,7 +204,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = NodeStringMatchValidationError{} +} = StringMatchValidationError{} // Validate checks the field values on NodeLocalityMatch with the rules defined // in the proto definition for this message. If any rules are violated, an From 076a3f1478185e3705efd9a9ec221dc825bdfa7d Mon Sep 17 00:00:00 2001 From: eapolinario Date: Tue, 1 Sep 2020 00:24:11 -0700 Subject: [PATCH 22/29] s/NodeLocalityMatch/LocalityMatch + use StringMatch Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 10 +- internal/app/mapper/mapper.go | 24 +- internal/app/mapper/mapper_test.go | 49 ++- ...on_request_node_match_string_fragment.yaml | 9 +- pkg/api/aggregation/v1/aggregation.pb.go | 405 +++++++++--------- .../aggregation/v1/aggregation.pb.validate.go | 64 ++- 6 files changed, 310 insertions(+), 251 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index 7d9e7d68..22f50231 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -54,12 +54,12 @@ message StringMatch { } } -message NodeLocalityMatch { - string region = 1; +message LocalityMatch { + StringMatch region = 1; - string zone = 2; + StringMatch zone = 2; - string sub_zone = 3; + StringMatch sub_zone = 3; } // This is a recursive structure which allows complex nested match @@ -85,7 +85,7 @@ message MatchPredicate { StringMatch cluster_match = 2; - NodeLocalityMatch locality_match = 3; + LocalityMatch locality_match = 3; } } diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 0fc97cd3..27757cf2 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -448,7 +448,7 @@ func compareString(stringMatch *aggregationv1.StringMatch, nodeValue string) (bo return false, nil } -func compareLocality(nodeLocalityMatch *aggregationv1.NodeLocalityMatch, +func compareLocality(localityMatch *aggregationv1.LocalityMatch, reqNodeLocality *corev2.Locality) (bool, error) { // TODO if we can reuse envoy's Locality object, make sure to use cmp.Equal if reqNodeLocality == nil { @@ -456,18 +456,28 @@ func compareLocality(nodeLocalityMatch *aggregationv1.NodeLocalityMatch, } regionMatch := true - if nodeLocalityMatch.Region != "" && reqNodeLocality.Region != "" { - regionMatch = nodeLocalityMatch.Region == reqNodeLocality.Region + var err error + if localityMatch.GetRegion() != nil { + regionMatch, err = compareString(localityMatch.Region, reqNodeLocality.Region) + if err != nil { + return false, err + } } zoneMatch := true - if nodeLocalityMatch.Zone != "" && reqNodeLocality.Zone != "" { - zoneMatch = nodeLocalityMatch.Zone == reqNodeLocality.Zone + if localityMatch.GetZone() != nil { + zoneMatch, err = compareString(localityMatch.Zone, reqNodeLocality.Zone) + if err != nil { + return false, err + } } subZoneMatch := true - if nodeLocalityMatch.SubZone != "" && reqNodeLocality.SubZone != "" { - subZoneMatch = nodeLocalityMatch.SubZone == reqNodeLocality.SubZone + if localityMatch.GetSubZone() != nil { + subZoneMatch, err = compareString(localityMatch.SubZone, reqNodeLocality.SubZone) + if err != nil { + return false, err + } } return regionMatch && zoneMatch && subZoneMatch, nil diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 02ef8873..b6d2d4d0 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -19,6 +19,7 @@ type FragmentRule = aggregationv1.KeyerConfiguration_Fragment_Rule type MatchPredicate = aggregationv1.MatchPredicate type ResultPredicate = aggregationv1.ResultPredicate type LocalityResultAction = aggregationv1.ResultPredicate_LocalityResultAction +type StringMatch = aggregationv1.StringMatch const ( clusterTypeURL = "type.googleapis.com/envoy.api.v2.Cluster" @@ -96,7 +97,7 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node locality match", Parameters: []interface{}{ - getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -143,7 +144,7 @@ var positiveTests = []TableEntry{ getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeLocality(noderegion, nodezone, ""), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), nil), }), }), getResultStringFragment(), @@ -187,7 +188,7 @@ var positiveTests = []TableEntry{ getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeLocality(noderegion, "", ""), + getRequestNodeLocality(getExactMatch(noderegion), nil, nil), }), }), getResultStringFragment(), @@ -205,7 +206,7 @@ var positiveTests = []TableEntry{ getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeLocality(noderegion, nodezone, ""), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), nil), }), }), getResultStringFragment(), @@ -546,7 +547,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node region does not match", Parameters: []interface{}{ - getRequestNodeLocality(noderegion+"\\d", nodezone, nodesubzone), + getRequestNodeLocality(getExactMatch(noderegion+"\\d"), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequest(), }, @@ -554,7 +555,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node zone does not match", Parameters: []interface{}{ - getRequestNodeLocality(noderegion, "zon[A-Z]", nodesubzone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch("zon[A-Z]"), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequest(), }, @@ -562,7 +563,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node subzone does not match", Parameters: []interface{}{ - getRequestNodeLocality(noderegion, nodezone, nodesubzone+"+"), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone+"+")), getResultStringFragment(), getDiscoveryRequest(), }, @@ -618,7 +619,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with exact match request node region mismatch", Parameters: []interface{}{ - getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), }, @@ -626,7 +627,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with exact match request node zone mismatch", Parameters: []interface{}{ - getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), }, @@ -634,7 +635,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with exact match request node subzone mismatch", Parameters: []interface{}{ - getRequestNodeLocality(noderegion, nodezone, nodesubzone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), }, @@ -696,7 +697,7 @@ var negativeTests = []TableEntry{ getRequestNodeClusterExactMatch(""), }), getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeLocality("nomatch", "", ""), + getRequestNodeLocality(getExactMatch("nomatch"), nil, nil), }), }), getResultStringFragment(), @@ -713,7 +714,7 @@ var negativeTests = []TableEntry{ getRequestNodeClusterExactMatch(""), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeLocality("", "", ""), + getRequestNodeLocality(nil, nil, nil), }), }), getResultStringFragment(), @@ -780,7 +781,7 @@ var negativeTests = []TableEntry{ getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeLocality(noderegion, nodezone, ""), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), nil), }), }), }, @@ -1286,12 +1287,28 @@ func getRequestNodeClusterRegexMatch(regex string) *MatchPredicate { } } -func getRequestNodeLocality(region string, zone string, subZone string) *MatchPredicate { +func getExactMatch(exact string) *StringMatch { + return &aggregationv1.StringMatch{ + Type: &aggregationv1.StringMatch_ExactMatch{ + ExactMatch: exact, + }, + } +} + +func getRegexMatch(regex string) *StringMatch { + return &aggregationv1.StringMatch{ + Type: &aggregationv1.StringMatch_RegexMatch{ + RegexMatch: regex, + }, + } +} + +func getRequestNodeLocality(region *StringMatch, zone *StringMatch, subZone *StringMatch) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_LocalityMatch{ - LocalityMatch: &aggregationv1.NodeLocalityMatch{ + LocalityMatch: &aggregationv1.LocalityMatch{ Region: region, Zone: zone, SubZone: subZone, @@ -1333,7 +1350,7 @@ func getRequestTypeNotMatch(typeurls []string) *MatchPredicate { func getRequestNodeLocalityNotMatch() *MatchPredicate { return &matchPredicate{ Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeLocality("r1", "z2", "sz3"), + NotMatch: getRequestNodeLocality(getExactMatch("r1"), getExactMatch("z2"), getExactMatch("sz3")), }, } } diff --git a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml index 3ceb165f..cd5aa142 100644 --- a/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml +++ b/internal/pkg/util/yamlproto/testdata/keyer_configuration_request_node_match_string_fragment.yaml @@ -15,8 +15,11 @@ fragments: - match: request_node_match: locality_match: - region: "r1" - zone: "z1" - sub_zone: "sz-1" + region: + exact_match: "r1" + zone: + exact_match: "z1" + sub_zone: + exact_match: "sz-1" result: string_fragment: "abc" diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index b8aabbf0..322ce042 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.go +++ b/pkg/api/aggregation/v1/aggregation.pb.go @@ -214,18 +214,18 @@ func (*StringMatch_ExactMatch) isStringMatch_Type() {} func (*StringMatch_RegexMatch) isStringMatch_Type() {} -type NodeLocalityMatch struct { +type LocalityMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` - Zone string `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"` - SubZone string `protobuf:"bytes,3,opt,name=sub_zone,json=subZone,proto3" json:"sub_zone,omitempty"` + Region *StringMatch `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + Zone *StringMatch `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"` + SubZone *StringMatch `protobuf:"bytes,3,opt,name=sub_zone,json=subZone,proto3" json:"sub_zone,omitempty"` } -func (x *NodeLocalityMatch) Reset() { - *x = NodeLocalityMatch{} +func (x *LocalityMatch) Reset() { + *x = LocalityMatch{} if protoimpl.UnsafeEnabled { mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -233,13 +233,13 @@ func (x *NodeLocalityMatch) Reset() { } } -func (x *NodeLocalityMatch) String() string { +func (x *LocalityMatch) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NodeLocalityMatch) ProtoMessage() {} +func (*LocalityMatch) ProtoMessage() {} -func (x *NodeLocalityMatch) ProtoReflect() protoreflect.Message { +func (x *LocalityMatch) ProtoReflect() protoreflect.Message { mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -251,30 +251,30 @@ func (x *NodeLocalityMatch) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NodeLocalityMatch.ProtoReflect.Descriptor instead. -func (*NodeLocalityMatch) Descriptor() ([]byte, []int) { +// Deprecated: Use LocalityMatch.ProtoReflect.Descriptor instead. +func (*LocalityMatch) Descriptor() ([]byte, []int) { return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2} } -func (x *NodeLocalityMatch) GetRegion() string { +func (x *LocalityMatch) GetRegion() *StringMatch { if x != nil { return x.Region } - return "" + return nil } -func (x *NodeLocalityMatch) GetZone() string { +func (x *LocalityMatch) GetZone() *StringMatch { if x != nil { return x.Zone } - return "" + return nil } -func (x *NodeLocalityMatch) GetSubZone() string { +func (x *LocalityMatch) GetSubZone() *StringMatch { if x != nil { return x.SubZone } - return "" + return nil } // This is a recursive structure which allows complex nested match @@ -769,7 +769,7 @@ func (x *MatchPredicate_RequestNodeMatch) GetClusterMatch() *StringMatch { return nil } -func (x *MatchPredicate_RequestNodeMatch) GetLocalityMatch() *NodeLocalityMatch { +func (x *MatchPredicate_RequestNodeMatch) GetLocalityMatch() *LocalityMatch { if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_LocalityMatch); ok { return x.LocalityMatch } @@ -789,7 +789,7 @@ type MatchPredicate_RequestNodeMatch_ClusterMatch struct { } type MatchPredicate_RequestNodeMatch_LocalityMatch struct { - LocalityMatch *NodeLocalityMatch `protobuf:"bytes,3,opt,name=locality_match,json=localityMatch,proto3,oneof"` + LocalityMatch *LocalityMatch `protobuf:"bytes,3,opt,name=locality_match,json=localityMatch,proto3,oneof"` } func (*MatchPredicate_RequestNodeMatch_IdMatch) isMatchPredicate_RequestNodeMatch_Type() {} @@ -1291,161 +1291,165 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x5a, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, - 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, - 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, - 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, 0x7a, 0x6f, - 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x5a, 0x6f, 0x6e, - 0x65, 0x22, 0xa5, 0x06, 0x0a, 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, - 0x08, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x41, 0x0a, 0x08, 0x6f, 0x72, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, - 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, - 0x74, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x09, - 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, - 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, 0x61, 0x6e, 0x79, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x5c, - 0x0a, 0x12, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, - 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, - 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, - 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x32, 0x0a, 0x10, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x1a, 0xe0, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x35, 0x0a, 0x08, 0x69, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xa4, 0x01, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, + 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x48, 0x00, 0x52, 0x07, 0x69, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3f, 0x0a, 0x0d, - 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, - 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x47, 0x0a, - 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, - 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, - 0xf8, 0x42, 0x01, 0x1a, 0x47, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x12, - 0x3b, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xf0, 0x0a, 0x0a, 0x0f, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, - 0x0a, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, - 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x09, 0x61, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, - 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6c, - 0x0a, 0x17, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x32, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, + 0x68, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, 0x7a, + 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x07, 0x73, 0x75, 0x62, 0x5a, 0x6f, 0x6e, 0x65, 0x22, 0xa1, 0x06, 0x0a, + 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, + 0x43, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x64, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x12, 0x41, 0x0a, 0x08, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x07, + 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x6d, + 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, + 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, + 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, 0x61, 0x6e, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, + 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x12, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, + 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x32, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1e, 0x0a, 0x05, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, + 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0xdc, 0x01, 0x0a, 0x10, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x35, 0x0a, 0x08, 0x69, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x07, + 0x69, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3f, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x43, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, 0x61, + 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x0d, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x47, 0x0a, 0x08, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x12, 0x3b, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, + 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, + 0x22, 0xf0, 0x0a, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x48, 0x00, 0x52, 0x09, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x66, 0x0a, + 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x66, 0x72, + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, + 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6c, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x0f, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, - 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0xef, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, - 0x48, 0x00, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x5a, 0x0a, 0x0c, 0x72, 0x65, 0x67, - 0x65, 0x78, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x35, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x53, 0x0a, 0x0b, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, - 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x00, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x84, 0x02, 0x0a, 0x14, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, - 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x0b, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, - 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0a, 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, - 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x72, + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0xef, + 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1f, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, + 0x12, 0x5a, 0x0a, 0x0c, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x1a, 0x60, 0x0a, 0x09, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, - 0x11, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, - 0x52, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x73, 0x1a, 0xa0, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x64, - 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, + 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, + 0x0b, 0x72, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x53, 0x0a, 0x0b, + 0x52, 0x65, 0x67, 0x65, 0x78, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, + 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x00, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, + 0x65, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, + 0x1a, 0x84, 0x02, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x0d, 0x72, 0x65, 0x67, + 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x72, 0x65, 0x67, + 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x0b, 0x7a, 0x6f, 0x6e, + 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x7a, 0x6f, 0x6e, 0x65, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x7a, 0x6f, 0x6e, 0x65, + 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x69, 0x64, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x31, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, - 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x87, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, - 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, - 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, - 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, - 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, - 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, - 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, - 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, - 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, - 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, - 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x7a, 0x6f, 0x6e, + 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x60, 0x0a, 0x09, 0x41, 0x6e, 0x64, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x70, + 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, + 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, + 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x1a, 0xa0, 0x02, 0x0a, 0x13, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x08, 0x69, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52, 0x0a, 0x0e, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, + 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x5c, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, + 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x87, 0x01, 0x0a, + 0x15, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x46, 0x72, + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, + 0x52, 0x07, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x67, 0x72, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x72, + 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, + 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, + 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, + 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, + 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, + 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, + 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, + 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, + 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1466,7 +1470,7 @@ var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ (NodeFieldType)(0), // 0: aggregation.NodeFieldType (*KeyerConfiguration)(nil), // 1: aggregation.KeyerConfiguration (*StringMatch)(nil), // 2: aggregation.StringMatch - (*NodeLocalityMatch)(nil), // 3: aggregation.NodeLocalityMatch + (*LocalityMatch)(nil), // 3: aggregation.LocalityMatch (*MatchPredicate)(nil), // 4: aggregation.MatchPredicate (*ResultPredicate)(nil), // 5: aggregation.ResultPredicate (*KeyerConfiguration_Fragment)(nil), // 6: aggregation.KeyerConfiguration.Fragment @@ -1483,35 +1487,38 @@ var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ } var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ 6, // 0: aggregation.KeyerConfiguration.fragments:type_name -> aggregation.KeyerConfiguration.Fragment - 10, // 1: aggregation.MatchPredicate.and_match:type_name -> aggregation.MatchPredicate.MatchSet - 10, // 2: aggregation.MatchPredicate.or_match:type_name -> aggregation.MatchPredicate.MatchSet - 4, // 3: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate - 8, // 4: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch - 9, // 5: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch - 13, // 6: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult - 14, // 7: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment - 15, // 8: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment - 7, // 9: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule - 4, // 10: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate - 5, // 11: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate - 2, // 12: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.StringMatch - 2, // 13: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.StringMatch - 3, // 14: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.NodeLocalityMatch - 4, // 15: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate - 16, // 16: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction - 11, // 17: aggregation.ResultPredicate.LocalityResultAction.region_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 18: aggregation.ResultPredicate.LocalityResultAction.zone_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 19: aggregation.ResultPredicate.LocalityResultAction.subzone_action:type_name -> aggregation.ResultPredicate.ResultAction - 5, // 20: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate - 11, // 21: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 22: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction - 12, // 23: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.ResultPredicate.LocalityResultAction - 11, // 24: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction - 25, // [25:25] is the sub-list for method output_type - 25, // [25:25] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name + 2, // 1: aggregation.LocalityMatch.region:type_name -> aggregation.StringMatch + 2, // 2: aggregation.LocalityMatch.zone:type_name -> aggregation.StringMatch + 2, // 3: aggregation.LocalityMatch.sub_zone:type_name -> aggregation.StringMatch + 10, // 4: aggregation.MatchPredicate.and_match:type_name -> aggregation.MatchPredicate.MatchSet + 10, // 5: aggregation.MatchPredicate.or_match:type_name -> aggregation.MatchPredicate.MatchSet + 4, // 6: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate + 8, // 7: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch + 9, // 8: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch + 13, // 9: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult + 14, // 10: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment + 15, // 11: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment + 7, // 12: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule + 4, // 13: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate + 5, // 14: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate + 2, // 15: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.StringMatch + 2, // 16: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.StringMatch + 3, // 17: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.LocalityMatch + 4, // 18: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate + 16, // 19: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction + 11, // 20: aggregation.ResultPredicate.LocalityResultAction.region_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 21: aggregation.ResultPredicate.LocalityResultAction.zone_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 22: aggregation.ResultPredicate.LocalityResultAction.subzone_action:type_name -> aggregation.ResultPredicate.ResultAction + 5, // 23: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate + 11, // 24: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 25: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction + 12, // 26: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.ResultPredicate.LocalityResultAction + 11, // 27: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_aggregation_v1_aggregation_proto_init() } @@ -1545,7 +1552,7 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeLocalityMatch); i { + switch v := v.(*LocalityMatch); i { case 0: return &v.state case 1: diff --git a/pkg/api/aggregation/v1/aggregation.pb.validate.go b/pkg/api/aggregation/v1/aggregation.pb.validate.go index 3de541ae..61538a3c 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.validate.go +++ b/pkg/api/aggregation/v1/aggregation.pb.validate.go @@ -206,26 +206,50 @@ var _ interface { ErrorName() string } = StringMatchValidationError{} -// Validate checks the field values on NodeLocalityMatch with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. -func (m *NodeLocalityMatch) Validate() error { +// Validate checks the field values on LocalityMatch with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *LocalityMatch) Validate() error { if m == nil { return nil } - // no validation rules for Region + if v, ok := interface{}(m.GetRegion()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityMatchValidationError{ + field: "Region", + reason: "embedded message failed validation", + cause: err, + } + } + } - // no validation rules for Zone + if v, ok := interface{}(m.GetZone()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityMatchValidationError{ + field: "Zone", + reason: "embedded message failed validation", + cause: err, + } + } + } - // no validation rules for SubZone + if v, ok := interface{}(m.GetSubZone()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityMatchValidationError{ + field: "SubZone", + reason: "embedded message failed validation", + cause: err, + } + } + } return nil } -// NodeLocalityMatchValidationError is the validation error returned by -// NodeLocalityMatch.Validate if the designated constraints aren't met. -type NodeLocalityMatchValidationError struct { +// LocalityMatchValidationError is the validation error returned by +// LocalityMatch.Validate if the designated constraints aren't met. +type LocalityMatchValidationError struct { field string reason string cause error @@ -233,24 +257,22 @@ type NodeLocalityMatchValidationError struct { } // Field function returns field value. -func (e NodeLocalityMatchValidationError) Field() string { return e.field } +func (e LocalityMatchValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e NodeLocalityMatchValidationError) Reason() string { return e.reason } +func (e LocalityMatchValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e NodeLocalityMatchValidationError) Cause() error { return e.cause } +func (e LocalityMatchValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e NodeLocalityMatchValidationError) Key() bool { return e.key } +func (e LocalityMatchValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e NodeLocalityMatchValidationError) ErrorName() string { - return "NodeLocalityMatchValidationError" -} +func (e LocalityMatchValidationError) ErrorName() string { return "LocalityMatchValidationError" } // Error satisfies the builtin error interface -func (e NodeLocalityMatchValidationError) Error() string { +func (e LocalityMatchValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -262,14 +284,14 @@ func (e NodeLocalityMatchValidationError) Error() string { } return fmt.Sprintf( - "invalid %sNodeLocalityMatch.%s: %s%s", + "invalid %sLocalityMatch.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = NodeLocalityMatchValidationError{} +var _ error = LocalityMatchValidationError{} var _ interface { Field() string @@ -277,7 +299,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = NodeLocalityMatchValidationError{} +} = LocalityMatchValidationError{} // Validate checks the field values on MatchPredicate with the rules defined in // the proto definition for this message. If any rules are violated, an error From 175d56750087f4e742d9d76fd5b069d9ced80bc8 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Tue, 1 Sep 2020 00:31:31 -0700 Subject: [PATCH 23/29] lint Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index b6d2d4d0..d1d99a18 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -1228,11 +1228,7 @@ func getRequestNodeIDExactMatch(exact string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ - IdMatch: &aggregationv1.StringMatch{ - Type: &aggregationv1.StringMatch_ExactMatch{ - ExactMatch: exact, - }, - }, + IdMatch: getExactMatch(exact), }, }, }, @@ -1244,11 +1240,7 @@ func getRequestNodeIDRegexMatch(regex string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ - IdMatch: &aggregationv1.StringMatch{ - Type: &aggregationv1.StringMatch_RegexMatch{ - RegexMatch: regex, - }, - }, + IdMatch: getRegexMatch(regex), }, }, }, @@ -1260,11 +1252,7 @@ func getRequestNodeClusterExactMatch(exact string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ClusterMatch{ - ClusterMatch: &aggregationv1.StringMatch{ - Type: &aggregationv1.StringMatch_ExactMatch{ - ExactMatch: exact, - }, - }, + ClusterMatch: getExactMatch(exact), }, }, }, @@ -1276,11 +1264,7 @@ func getRequestNodeClusterRegexMatch(regex string) *MatchPredicate { Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ Type: &aggregationv1.MatchPredicate_RequestNodeMatch_ClusterMatch{ - ClusterMatch: &aggregationv1.StringMatch{ - Type: &aggregationv1.StringMatch_RegexMatch{ - RegexMatch: regex, - }, - }, + ClusterMatch: getRegexMatch(regex), }, }, }, From d09afb7f1a5c79922d6502e07a89aca40f4519f2 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Tue, 1 Sep 2020 00:38:32 -0700 Subject: [PATCH 24/29] remove NodeFieldType enum. Signed-off-by: eapolinario --- api/protos/aggregation/v1/aggregation.proto | 8 - internal/app/mapper/mapper_test.go | 32 ++-- pkg/api/aggregation/v1/aggregation.pb.go | 162 ++++++-------------- 3 files changed, 69 insertions(+), 133 deletions(-) diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index 22f50231..68397610 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -32,14 +32,6 @@ message KeyerConfiguration { repeated Fragment fragments = 1 [(validate.rules).repeated.min_items = 1]; } -enum NodeFieldType { - NODE_ID = 0; - NODE_CLUSTER = 1; - NODE_LOCALITY_REGION = 2; - NODE_LOCALITY_ZONE = 3; - NODE_LOCALITY_SUBZONE = 4; -} - message StringMatch { oneof type { option (validate.required) = true; diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index d1d99a18..d6eb7135 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -21,6 +21,16 @@ type ResultPredicate = aggregationv1.ResultPredicate type LocalityResultAction = aggregationv1.ResultPredicate_LocalityResultAction type StringMatch = aggregationv1.StringMatch +type NodeFieldType int32 + +const ( + NodeFieldType_NODE_ID NodeFieldType = 0 + NodeFieldType_NODE_CLUSTER NodeFieldType = 1 + NodeFieldType_NODE_LOCALITY_REGION NodeFieldType = 2 + NodeFieldType_NODE_LOCALITY_ZONE NodeFieldType = 3 + NodeFieldType_NODE_LOCALITY_SUBZONE NodeFieldType = 4 +) + const ( clusterTypeURL = "type.googleapis.com/envoy.api.v2.Cluster" listenerTypeURL = "type.googleapis.com/envoy.api.v2.Listener" @@ -32,11 +42,11 @@ const ( resource1 = "resource1" resource2 = "resource2" stringFragment = "stringFragment" - nodeIDField = aggregationv1.NodeFieldType_NODE_ID - nodeClusterField = aggregationv1.NodeFieldType_NODE_CLUSTER - nodeRegionField = aggregationv1.NodeFieldType_NODE_LOCALITY_REGION - nodeZoneField = aggregationv1.NodeFieldType_NODE_LOCALITY_ZONE - nodeSubZoneField = aggregationv1.NodeFieldType_NODE_LOCALITY_SUBZONE + nodeIDField = NodeFieldType_NODE_ID + nodeClusterField = NodeFieldType_NODE_CLUSTER + nodeRegionField = NodeFieldType_NODE_LOCALITY_REGION + nodeZoneField = NodeFieldType_NODE_LOCALITY_ZONE + nodeSubZoneField = NodeFieldType_NODE_LOCALITY_SUBZONE ) var positiveTests = []TableEntry{ @@ -1341,13 +1351,13 @@ func getRequestNodeLocalityNotMatch() *MatchPredicate { // TODO: this is the indication we don't need that enum in the protos, i.e. this should // be a test-only construct. -func getRequestNodeRegexNotMatch(field aggregationv1.NodeFieldType) *MatchPredicate { +func getRequestNodeRegexNotMatch(field NodeFieldType) *MatchPredicate { var matchPredicate *aggregationv1.MatchPredicate notMatchRegex := "notmatchregex" switch field { - case aggregationv1.NodeFieldType_NODE_ID: + case NodeFieldType_NODE_ID: matchPredicate = getRequestNodeIDRegexMatch(notMatchRegex) - case aggregationv1.NodeFieldType_NODE_CLUSTER: + case NodeFieldType_NODE_CLUSTER: matchPredicate = getRequestNodeClusterRegexMatch(notMatchRegex) } return &MatchPredicate{ @@ -1358,12 +1368,12 @@ func getRequestNodeRegexNotMatch(field aggregationv1.NodeFieldType) *MatchPredic } // TODO: ditto -func getRequestNodeExactNotMatch(field aggregationv1.NodeFieldType, exact string) *MatchPredicate { +func getRequestNodeExactNotMatch(field NodeFieldType, exact string) *MatchPredicate { var matchPredicate *aggregationv1.MatchPredicate switch field { - case aggregationv1.NodeFieldType_NODE_ID: + case NodeFieldType_NODE_ID: matchPredicate = getRequestNodeIDExactMatch(exact) - case aggregationv1.NodeFieldType_NODE_CLUSTER: + case NodeFieldType_NODE_CLUSTER: matchPredicate = getRequestNodeClusterExactMatch(exact) } return &MatchPredicate{ diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index 322ce042..de824677 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.go +++ b/pkg/api/aggregation/v1/aggregation.pb.go @@ -26,61 +26,6 @@ const ( // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 -type NodeFieldType int32 - -const ( - NodeFieldType_NODE_ID NodeFieldType = 0 - NodeFieldType_NODE_CLUSTER NodeFieldType = 1 - NodeFieldType_NODE_LOCALITY_REGION NodeFieldType = 2 - NodeFieldType_NODE_LOCALITY_ZONE NodeFieldType = 3 - NodeFieldType_NODE_LOCALITY_SUBZONE NodeFieldType = 4 -) - -// Enum value maps for NodeFieldType. -var ( - NodeFieldType_name = map[int32]string{ - 0: "NODE_ID", - 1: "NODE_CLUSTER", - 2: "NODE_LOCALITY_REGION", - 3: "NODE_LOCALITY_ZONE", - 4: "NODE_LOCALITY_SUBZONE", - } - NodeFieldType_value = map[string]int32{ - "NODE_ID": 0, - "NODE_CLUSTER": 1, - "NODE_LOCALITY_REGION": 2, - "NODE_LOCALITY_ZONE": 3, - "NODE_LOCALITY_SUBZONE": 4, - } -) - -func (x NodeFieldType) Enum() *NodeFieldType { - p := new(NodeFieldType) - *p = x - return p -} - -func (x NodeFieldType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (NodeFieldType) Descriptor() protoreflect.EnumDescriptor { - return file_aggregation_v1_aggregation_proto_enumTypes[0].Descriptor() -} - -func (NodeFieldType) Type() protoreflect.EnumType { - return &file_aggregation_v1_aggregation_proto_enumTypes[0] -} - -func (x NodeFieldType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use NodeFieldType.Descriptor instead. -func (NodeFieldType) EnumDescriptor() ([]byte, []int) { - return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{0} -} - // [#next-free-field: 2] type KeyerConfiguration struct { state protoimpl.MessageState @@ -1439,17 +1384,9 @@ var file_aggregation_v1_aggregation_proto_rawDesc = []byte{ 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, - 0xf8, 0x42, 0x01, 0x2a, 0x7b, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, - 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, - 0x52, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, - 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x16, 0x0a, - 0x12, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x5a, - 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x4f, - 0x43, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x55, 0x42, 0x5a, 0x4f, 0x4e, 0x45, 0x10, 0x04, - 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, - 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0xf8, 0x42, 0x01, 0x42, 0x1e, 0x5a, 0x1c, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1464,56 +1401,54 @@ func file_aggregation_v1_aggregation_proto_rawDescGZIP() []byte { return file_aggregation_v1_aggregation_proto_rawDescData } -var file_aggregation_v1_aggregation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_aggregation_v1_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_aggregation_v1_aggregation_proto_goTypes = []interface{}{ - (NodeFieldType)(0), // 0: aggregation.NodeFieldType - (*KeyerConfiguration)(nil), // 1: aggregation.KeyerConfiguration - (*StringMatch)(nil), // 2: aggregation.StringMatch - (*LocalityMatch)(nil), // 3: aggregation.LocalityMatch - (*MatchPredicate)(nil), // 4: aggregation.MatchPredicate - (*ResultPredicate)(nil), // 5: aggregation.ResultPredicate - (*KeyerConfiguration_Fragment)(nil), // 6: aggregation.KeyerConfiguration.Fragment - (*KeyerConfiguration_Fragment_Rule)(nil), // 7: aggregation.KeyerConfiguration.Fragment.Rule - (*MatchPredicate_RequestTypeMatch)(nil), // 8: aggregation.MatchPredicate.RequestTypeMatch - (*MatchPredicate_RequestNodeMatch)(nil), // 9: aggregation.MatchPredicate.RequestNodeMatch - (*MatchPredicate_MatchSet)(nil), // 10: aggregation.MatchPredicate.MatchSet - (*ResultPredicate_ResultAction)(nil), // 11: aggregation.ResultPredicate.ResultAction - (*ResultPredicate_LocalityResultAction)(nil), // 12: aggregation.ResultPredicate.LocalityResultAction - (*ResultPredicate_AndResult)(nil), // 13: aggregation.ResultPredicate.AndResult - (*ResultPredicate_RequestNodeFragment)(nil), // 14: aggregation.ResultPredicate.RequestNodeFragment - (*ResultPredicate_ResourceNamesFragment)(nil), // 15: aggregation.ResultPredicate.ResourceNamesFragment - (*ResultPredicate_ResultAction_RegexAction)(nil), // 16: aggregation.ResultPredicate.ResultAction.RegexAction + (*KeyerConfiguration)(nil), // 0: aggregation.KeyerConfiguration + (*StringMatch)(nil), // 1: aggregation.StringMatch + (*LocalityMatch)(nil), // 2: aggregation.LocalityMatch + (*MatchPredicate)(nil), // 3: aggregation.MatchPredicate + (*ResultPredicate)(nil), // 4: aggregation.ResultPredicate + (*KeyerConfiguration_Fragment)(nil), // 5: aggregation.KeyerConfiguration.Fragment + (*KeyerConfiguration_Fragment_Rule)(nil), // 6: aggregation.KeyerConfiguration.Fragment.Rule + (*MatchPredicate_RequestTypeMatch)(nil), // 7: aggregation.MatchPredicate.RequestTypeMatch + (*MatchPredicate_RequestNodeMatch)(nil), // 8: aggregation.MatchPredicate.RequestNodeMatch + (*MatchPredicate_MatchSet)(nil), // 9: aggregation.MatchPredicate.MatchSet + (*ResultPredicate_ResultAction)(nil), // 10: aggregation.ResultPredicate.ResultAction + (*ResultPredicate_LocalityResultAction)(nil), // 11: aggregation.ResultPredicate.LocalityResultAction + (*ResultPredicate_AndResult)(nil), // 12: aggregation.ResultPredicate.AndResult + (*ResultPredicate_RequestNodeFragment)(nil), // 13: aggregation.ResultPredicate.RequestNodeFragment + (*ResultPredicate_ResourceNamesFragment)(nil), // 14: aggregation.ResultPredicate.ResourceNamesFragment + (*ResultPredicate_ResultAction_RegexAction)(nil), // 15: aggregation.ResultPredicate.ResultAction.RegexAction } var file_aggregation_v1_aggregation_proto_depIdxs = []int32{ - 6, // 0: aggregation.KeyerConfiguration.fragments:type_name -> aggregation.KeyerConfiguration.Fragment - 2, // 1: aggregation.LocalityMatch.region:type_name -> aggregation.StringMatch - 2, // 2: aggregation.LocalityMatch.zone:type_name -> aggregation.StringMatch - 2, // 3: aggregation.LocalityMatch.sub_zone:type_name -> aggregation.StringMatch - 10, // 4: aggregation.MatchPredicate.and_match:type_name -> aggregation.MatchPredicate.MatchSet - 10, // 5: aggregation.MatchPredicate.or_match:type_name -> aggregation.MatchPredicate.MatchSet - 4, // 6: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate - 8, // 7: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch - 9, // 8: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch - 13, // 9: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult - 14, // 10: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment - 15, // 11: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment - 7, // 12: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule - 4, // 13: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate - 5, // 14: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate - 2, // 15: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.StringMatch - 2, // 16: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.StringMatch - 3, // 17: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.LocalityMatch - 4, // 18: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate - 16, // 19: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction - 11, // 20: aggregation.ResultPredicate.LocalityResultAction.region_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 21: aggregation.ResultPredicate.LocalityResultAction.zone_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 22: aggregation.ResultPredicate.LocalityResultAction.subzone_action:type_name -> aggregation.ResultPredicate.ResultAction - 5, // 23: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate - 11, // 24: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction - 11, // 25: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction - 12, // 26: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.ResultPredicate.LocalityResultAction - 11, // 27: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction + 5, // 0: aggregation.KeyerConfiguration.fragments:type_name -> aggregation.KeyerConfiguration.Fragment + 1, // 1: aggregation.LocalityMatch.region:type_name -> aggregation.StringMatch + 1, // 2: aggregation.LocalityMatch.zone:type_name -> aggregation.StringMatch + 1, // 3: aggregation.LocalityMatch.sub_zone:type_name -> aggregation.StringMatch + 9, // 4: aggregation.MatchPredicate.and_match:type_name -> aggregation.MatchPredicate.MatchSet + 9, // 5: aggregation.MatchPredicate.or_match:type_name -> aggregation.MatchPredicate.MatchSet + 3, // 6: aggregation.MatchPredicate.not_match:type_name -> aggregation.MatchPredicate + 7, // 7: aggregation.MatchPredicate.request_type_match:type_name -> aggregation.MatchPredicate.RequestTypeMatch + 8, // 8: aggregation.MatchPredicate.request_node_match:type_name -> aggregation.MatchPredicate.RequestNodeMatch + 12, // 9: aggregation.ResultPredicate.and_result:type_name -> aggregation.ResultPredicate.AndResult + 13, // 10: aggregation.ResultPredicate.request_node_fragment:type_name -> aggregation.ResultPredicate.RequestNodeFragment + 14, // 11: aggregation.ResultPredicate.resource_names_fragment:type_name -> aggregation.ResultPredicate.ResourceNamesFragment + 6, // 12: aggregation.KeyerConfiguration.Fragment.rules:type_name -> aggregation.KeyerConfiguration.Fragment.Rule + 3, // 13: aggregation.KeyerConfiguration.Fragment.Rule.match:type_name -> aggregation.MatchPredicate + 4, // 14: aggregation.KeyerConfiguration.Fragment.Rule.result:type_name -> aggregation.ResultPredicate + 1, // 15: aggregation.MatchPredicate.RequestNodeMatch.id_match:type_name -> aggregation.StringMatch + 1, // 16: aggregation.MatchPredicate.RequestNodeMatch.cluster_match:type_name -> aggregation.StringMatch + 2, // 17: aggregation.MatchPredicate.RequestNodeMatch.locality_match:type_name -> aggregation.LocalityMatch + 3, // 18: aggregation.MatchPredicate.MatchSet.rules:type_name -> aggregation.MatchPredicate + 15, // 19: aggregation.ResultPredicate.ResultAction.regex_action:type_name -> aggregation.ResultPredicate.ResultAction.RegexAction + 10, // 20: aggregation.ResultPredicate.LocalityResultAction.region_action:type_name -> aggregation.ResultPredicate.ResultAction + 10, // 21: aggregation.ResultPredicate.LocalityResultAction.zone_action:type_name -> aggregation.ResultPredicate.ResultAction + 10, // 22: aggregation.ResultPredicate.LocalityResultAction.subzone_action:type_name -> aggregation.ResultPredicate.ResultAction + 4, // 23: aggregation.ResultPredicate.AndResult.result_predicates:type_name -> aggregation.ResultPredicate + 10, // 24: aggregation.ResultPredicate.RequestNodeFragment.id_action:type_name -> aggregation.ResultPredicate.ResultAction + 10, // 25: aggregation.ResultPredicate.RequestNodeFragment.cluster_action:type_name -> aggregation.ResultPredicate.ResultAction + 11, // 26: aggregation.ResultPredicate.RequestNodeFragment.locality_action:type_name -> aggregation.ResultPredicate.LocalityResultAction + 10, // 27: aggregation.ResultPredicate.ResourceNamesFragment.action:type_name -> aggregation.ResultPredicate.ResultAction 28, // [28:28] is the sub-list for method output_type 28, // [28:28] is the sub-list for method input_type 28, // [28:28] is the sub-list for extension type_name @@ -1757,14 +1692,13 @@ func file_aggregation_v1_aggregation_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_aggregation_v1_aggregation_proto_rawDesc, - NumEnums: 1, + NumEnums: 0, NumMessages: 16, NumExtensions: 0, NumServices: 0, }, GoTypes: file_aggregation_v1_aggregation_proto_goTypes, DependencyIndexes: file_aggregation_v1_aggregation_proto_depIdxs, - EnumInfos: file_aggregation_v1_aggregation_proto_enumTypes, MessageInfos: file_aggregation_v1_aggregation_proto_msgTypes, }.Build() File_aggregation_v1_aggregation_proto = out.File From 56a1b7ce7777d47d4f308a47f7cbec31c2dcfbd3 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Tue, 1 Sep 2020 00:56:14 -0700 Subject: [PATCH 25/29] more linting Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 35 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index d6eb7135..12ef9657 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -24,11 +24,11 @@ type StringMatch = aggregationv1.StringMatch type NodeFieldType int32 const ( - NodeFieldType_NODE_ID NodeFieldType = 0 - NodeFieldType_NODE_CLUSTER NodeFieldType = 1 - NodeFieldType_NODE_LOCALITY_REGION NodeFieldType = 2 - NodeFieldType_NODE_LOCALITY_ZONE NodeFieldType = 3 - NodeFieldType_NODE_LOCALITY_SUBZONE NodeFieldType = 4 + NodeID NodeFieldType = 0 + NodeCluster NodeFieldType = 1 + NodeLocalityRegion NodeFieldType = 2 + NodeLocalityZone NodeFieldType = 3 + NodeLocalitySubZone NodeFieldType = 4 ) const ( @@ -42,11 +42,11 @@ const ( resource1 = "resource1" resource2 = "resource2" stringFragment = "stringFragment" - nodeIDField = NodeFieldType_NODE_ID - nodeClusterField = NodeFieldType_NODE_CLUSTER - nodeRegionField = NodeFieldType_NODE_LOCALITY_REGION - nodeZoneField = NodeFieldType_NODE_LOCALITY_ZONE - nodeSubZoneField = NodeFieldType_NODE_LOCALITY_SUBZONE + nodeIDField = NodeID + nodeClusterField = NodeCluster + nodeRegionField = NodeLocalityRegion + nodeZoneField = NodeLocalityZone + nodeSubZoneField = NodeLocalitySubZone ) var positiveTests = []TableEntry{ @@ -410,12 +410,12 @@ var positiveTests = []TableEntry{ getAnyMatch(true), getResultRequestNodeLocalityFragment( &LocalityResultAction{ - RegionAction: getRegexAction("r....n", "r1"), + RegionAction: getRegexAction("r(egion)", "p$1"), SubzoneAction: getRegexAction("s..zon.", "subzero"), }, ), clusterTypeURL, - "r1|subzero", + "pegion|subzero", }, }, { @@ -1349,15 +1349,13 @@ func getRequestNodeLocalityNotMatch() *MatchPredicate { } } -// TODO: this is the indication we don't need that enum in the protos, i.e. this should -// be a test-only construct. func getRequestNodeRegexNotMatch(field NodeFieldType) *MatchPredicate { var matchPredicate *aggregationv1.MatchPredicate notMatchRegex := "notmatchregex" switch field { - case NodeFieldType_NODE_ID: + case NodeID: matchPredicate = getRequestNodeIDRegexMatch(notMatchRegex) - case NodeFieldType_NODE_CLUSTER: + case NodeCluster: matchPredicate = getRequestNodeClusterRegexMatch(notMatchRegex) } return &MatchPredicate{ @@ -1367,13 +1365,12 @@ func getRequestNodeRegexNotMatch(field NodeFieldType) *MatchPredicate { } } -// TODO: ditto func getRequestNodeExactNotMatch(field NodeFieldType, exact string) *MatchPredicate { var matchPredicate *aggregationv1.MatchPredicate switch field { - case NodeFieldType_NODE_ID: + case NodeID: matchPredicate = getRequestNodeIDExactMatch(exact) - case NodeFieldType_NODE_CLUSTER: + case NodeCluster: matchPredicate = getRequestNodeClusterExactMatch(exact) } return &MatchPredicate{ From 12ef5ce4db4f0db8bc8809f7ec27dbd284e9aa15 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Tue, 1 Sep 2020 01:16:08 -0700 Subject: [PATCH 26/29] remove mentions to enum in test file. Signed-off-by: eapolinario --- internal/app/mapper/mapper_test.go | 85 +++++++++--------------------- 1 file changed, 24 insertions(+), 61 deletions(-) diff --git a/internal/app/mapper/mapper_test.go b/internal/app/mapper/mapper_test.go index 12ef9657..218837e8 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -21,32 +21,18 @@ type ResultPredicate = aggregationv1.ResultPredicate type LocalityResultAction = aggregationv1.ResultPredicate_LocalityResultAction type StringMatch = aggregationv1.StringMatch -type NodeFieldType int32 - -const ( - NodeID NodeFieldType = 0 - NodeCluster NodeFieldType = 1 - NodeLocalityRegion NodeFieldType = 2 - NodeLocalityZone NodeFieldType = 3 - NodeLocalitySubZone NodeFieldType = 4 -) - const ( - clusterTypeURL = "type.googleapis.com/envoy.api.v2.Cluster" - listenerTypeURL = "type.googleapis.com/envoy.api.v2.Listener" - nodeid = "nodeid" - nodecluster = "cluster" - noderegion = "region" - nodezone = "zone" - nodesubzone = "subzone" - resource1 = "resource1" - resource2 = "resource2" - stringFragment = "stringFragment" - nodeIDField = NodeID - nodeClusterField = NodeCluster - nodeRegionField = NodeLocalityRegion - nodeZoneField = NodeLocalityZone - nodeSubZoneField = NodeLocalitySubZone + clusterTypeURL = "type.googleapis.com/envoy.api.v2.Cluster" + listenerTypeURL = "type.googleapis.com/envoy.api.v2.Listener" + nodeid = "nodeid" + nodecluster = "cluster" + noderegion = "region" + nodezone = "zone" + nodesubzone = "subzone" + resource1 = "resource1" + resource2 = "resource2" + stringFragment = "stringFragment" + notMatchRegex = "notmatchregex" ) var positiveTests = []TableEntry{ @@ -236,7 +222,7 @@ var positiveTests = []TableEntry{ { Description: "Not Match RequestNodeMatch with node id regex", Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeIDField), + getRequestNodeNotMatch(getRequestNodeIDRegexMatch(notMatchRegex)), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -245,7 +231,7 @@ var positiveTests = []TableEntry{ { Description: "Not Match RequestNodeMatch with node cluster regex", Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeClusterField), + getRequestNodeNotMatch(getRequestNodeClusterRegexMatch(notMatchRegex)), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -740,41 +726,41 @@ var negativeTests = []TableEntry{ }, }, { - Description: "Not Match RequestNodeMatch with node id regex", + Description: "Not Match RequestNodeMatch with node id", Parameters: []interface{}{ - getRequestNodeExactNotMatch(nodeIDField, nodeid), + getRequestNodeNotMatch(getRequestNodeIDExactMatch(nodeid)), getResultStringFragment(), getDiscoveryRequest(), }, }, { - Description: "Not Match RequestNodeMatch with node cluster regex", + Description: "Not Match RequestNodeMatch with node cluster", Parameters: []interface{}{ - getRequestNodeExactNotMatch(nodeClusterField, nodecluster), + getRequestNodeNotMatch(getRequestNodeClusterExactMatch(nodecluster)), getResultStringFragment(), getDiscoveryRequest(), }, }, { - Description: "Not Match RequestNodeMatch with node region regex", + Description: "Not Match RequestNodeMatch with node region", Parameters: []interface{}{ - getRequestNodeExactNotMatch(nodeRegionField, noderegion), + getRequestNodeNotMatch(getRequestNodeLocality(getExactMatch(noderegion), nil, nil)), getResultStringFragment(), getDiscoveryRequest(), }, }, { - Description: "Not Match RequestNodeMatch with node zone regex", + Description: "Not Match RequestNodeMatch with node zone", Parameters: []interface{}{ - getRequestNodeExactNotMatch(nodeZoneField, nodezone), + getRequestNodeNotMatch(getRequestNodeLocality(nil, getExactMatch(nodezone), nil)), getResultStringFragment(), getDiscoveryRequest(), }, }, { - Description: "Not Match RequestNodeMatch with node subzone regex", + Description: "Not Match RequestNodeMatch with node subzone", Parameters: []interface{}{ - getRequestNodeExactNotMatch(nodeSubZoneField, nodesubzone), + getRequestNodeNotMatch(getRequestNodeLocality(nil, nil, getExactMatch(nodesubzone))), getResultStringFragment(), getDiscoveryRequest(), }, @@ -1349,30 +1335,7 @@ func getRequestNodeLocalityNotMatch() *MatchPredicate { } } -func getRequestNodeRegexNotMatch(field NodeFieldType) *MatchPredicate { - var matchPredicate *aggregationv1.MatchPredicate - notMatchRegex := "notmatchregex" - switch field { - case NodeID: - matchPredicate = getRequestNodeIDRegexMatch(notMatchRegex) - case NodeCluster: - matchPredicate = getRequestNodeClusterRegexMatch(notMatchRegex) - } - return &MatchPredicate{ - Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: matchPredicate, - }, - } -} - -func getRequestNodeExactNotMatch(field NodeFieldType, exact string) *MatchPredicate { - var matchPredicate *aggregationv1.MatchPredicate - switch field { - case NodeID: - matchPredicate = getRequestNodeIDExactMatch(exact) - case NodeCluster: - matchPredicate = getRequestNodeClusterExactMatch(exact) - } +func getRequestNodeNotMatch(matchPredicate *aggregationv1.MatchPredicate) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_NotMatch{ NotMatch: matchPredicate, From 9dead19573a56c0fac169fa3ddb71da436e2892d Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 11 Sep 2020 13:56:16 -0700 Subject: [PATCH 27/29] Remove mentions to corev2.Locality and use our own Locality object Signed-off-by: eapolinario --- internal/app/mapper/mapper.go | 5 ++--- internal/app/transport/request.go | 8 +++++++- internal/app/transport/requestv2.go | 10 ++++++++++ internal/app/transport/requestv3.go | 10 ++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 27757cf2..d68f2cdf 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -5,7 +5,6 @@ import ( "regexp" "strings" - corev2 "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" "github.com/envoyproxy/xds-relay/internal/app/metrics" "github.com/envoyproxy/xds-relay/internal/app/transport" @@ -394,7 +393,7 @@ func getResultFragmentFromAction( } func getFragmentFromLocalityAction( - locality *corev2.Locality, + locality *transport.Locality, action *aggregationv1.ResultPredicate_LocalityResultAction) (string, error) { var matches []string if action.RegionAction != nil { @@ -449,7 +448,7 @@ func compareString(stringMatch *aggregationv1.StringMatch, nodeValue string) (bo } func compareLocality(localityMatch *aggregationv1.LocalityMatch, - reqNodeLocality *corev2.Locality) (bool, error) { + reqNodeLocality *transport.Locality) (bool, error) { // TODO if we can reuse envoy's Locality object, make sure to use cmp.Equal if reqNodeLocality == nil { return false, fmt.Errorf("Locality Node field cannot be empty") diff --git a/internal/app/transport/request.go b/internal/app/transport/request.go index c0ee9199..d7dc52f9 100644 --- a/internal/app/transport/request.go +++ b/internal/app/transport/request.go @@ -13,6 +13,12 @@ type RequestVersion struct { V3 *discoveryv3.DiscoveryRequest } +type Locality struct { + Region string + Zone string + SubZone string +} + // Request is the generic interface to abstract v2 and v3 DiscoveryRequest types type Request interface { GetResourceNames() []string @@ -25,7 +31,7 @@ type Request interface { GetRegion() string GetZone() string GetSubZone() string - GetLocality() *corev2.Locality + GetLocality() *Locality GetResponseNonce() string GetRaw() *RequestVersion CreateWatch() Watch diff --git a/internal/app/transport/requestv2.go b/internal/app/transport/requestv2.go index 17d1ee30..18ae4b04 100644 --- a/internal/app/transport/requestv2.go +++ b/internal/app/transport/requestv2.go @@ -73,6 +73,16 @@ func (r *RequestV2) GetSubZone() string { return r.r.GetNode().GetLocality().GetSubZone() } +// GetLocality gets the node locality +func (r *RequestV2) GetLocality() *Locality { + locality := r.r.GetNode().GetLocality() + return &Locality{ + Region: locality.GetRegion(), + Zone: locality.GetZone(), + SubZone: locality.GetSubZone(), + } +} + // GetRaw gets the error details func (r *RequestV2) GetRaw() *RequestVersion { return &RequestVersion{V2: r.r} diff --git a/internal/app/transport/requestv3.go b/internal/app/transport/requestv3.go index bb2cf016..b63fdfe4 100644 --- a/internal/app/transport/requestv3.go +++ b/internal/app/transport/requestv3.go @@ -73,6 +73,16 @@ func (r *RequestV3) GetSubZone() string { return r.r.GetNode().GetLocality().GetSubZone() } +// GetLocality gets the node locality +func (r *RequestV3) GetLocality() *Locality { + locality := r.r.GetNode().GetLocality() + return &Locality{ + Region: locality.GetRegion(), + Zone: locality.GetZone(), + SubZone: locality.GetSubZone(), + } +} + // GetRaw gets the error details func (r *RequestV3) GetRaw() *RequestVersion { return &RequestVersion{V3: r.r} From 85ba9aa0675a9736c26189b917df885cbf0366e9 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 11 Sep 2020 14:01:01 -0700 Subject: [PATCH 28/29] remove TODO in mapper. Signed-off-by: eapolinario --- internal/app/mapper/mapper.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index d68f2cdf..fd81b595 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -449,7 +449,6 @@ func compareString(stringMatch *aggregationv1.StringMatch, nodeValue string) (bo func compareLocality(localityMatch *aggregationv1.LocalityMatch, reqNodeLocality *transport.Locality) (bool, error) { - // TODO if we can reuse envoy's Locality object, make sure to use cmp.Equal if reqNodeLocality == nil { return false, fmt.Errorf("Locality Node field cannot be empty") } From 31554396b7085ba18b90ffd409abd29aad7b5724 Mon Sep 17 00:00:00 2001 From: eapolinario Date: Fri, 11 Sep 2020 14:08:47 -0700 Subject: [PATCH 29/29] remove individual Locality properties. Signed-off-by: eapolinario --- internal/app/transport/request.go | 4 +--- internal/app/transport/request_test.go | 16 ++-------------- internal/app/transport/requestv2.go | 15 --------------- internal/app/transport/requestv3.go | 15 --------------- 4 files changed, 3 insertions(+), 47 deletions(-) diff --git a/internal/app/transport/request.go b/internal/app/transport/request.go index d7dc52f9..a1448f09 100644 --- a/internal/app/transport/request.go +++ b/internal/app/transport/request.go @@ -13,6 +13,7 @@ type RequestVersion struct { V3 *discoveryv3.DiscoveryRequest } +// Locality is an interface to abstract the differences between the v2 and v3 Locality type type Locality struct { Region string Zone string @@ -28,9 +29,6 @@ type Request interface { GetNodeMetadata() *structpb.Struct GetCluster() string GetError() *status.Status - GetRegion() string - GetZone() string - GetSubZone() string GetLocality() *Locality GetResponseNonce() string GetRaw() *RequestVersion diff --git a/internal/app/transport/request_test.go b/internal/app/transport/request_test.go index ef92f703..69c5336c 100644 --- a/internal/app/transport/request_test.go +++ b/internal/app/transport/request_test.go @@ -103,22 +103,10 @@ func TestGetError(t *testing.T) { assert.Equal(t, requestv2.GetError(), requestv3.GetError()) } -func TestGetRegion(t *testing.T) { +func TestGetLocality(t *testing.T) { requestv2 := NewRequestV2(&requestV2) requestv3 := NewRequestV3(&requestV3) - assert.Equal(t, requestv2.GetRegion(), requestv3.GetRegion()) -} - -func TestGetZone(t *testing.T) { - requestv2 := NewRequestV2(&requestV2) - requestv3 := NewRequestV3(&requestV3) - assert.Equal(t, requestv2.GetZone(), requestv3.GetZone()) -} - -func TestGetSubZone(t *testing.T) { - requestv2 := NewRequestV2(&requestV2) - requestv3 := NewRequestV3(&requestV3) - assert.Equal(t, requestv2.GetSubZone(), requestv3.GetSubZone()) + assert.Equal(t, requestv2.GetLocality(), requestv3.GetLocality()) } func TestGetResponseNonce(t *testing.T) { diff --git a/internal/app/transport/requestv2.go b/internal/app/transport/requestv2.go index 18ae4b04..1c0c730e 100644 --- a/internal/app/transport/requestv2.go +++ b/internal/app/transport/requestv2.go @@ -58,21 +58,6 @@ func (r *RequestV2) GetTypeURL() string { return r.r.GetTypeUrl() } -// GetRegion gets the error details -func (r *RequestV2) GetRegion() string { - return r.r.GetNode().GetLocality().GetRegion() -} - -// GetZone gets the error details -func (r *RequestV2) GetZone() string { - return r.r.GetNode().GetLocality().GetZone() -} - -// GetSubZone gets the error details -func (r *RequestV2) GetSubZone() string { - return r.r.GetNode().GetLocality().GetSubZone() -} - // GetLocality gets the node locality func (r *RequestV2) GetLocality() *Locality { locality := r.r.GetNode().GetLocality() diff --git a/internal/app/transport/requestv3.go b/internal/app/transport/requestv3.go index b63fdfe4..c4044c66 100644 --- a/internal/app/transport/requestv3.go +++ b/internal/app/transport/requestv3.go @@ -58,21 +58,6 @@ func (r *RequestV3) GetTypeURL() string { return r.r.GetTypeUrl() } -// GetRegion gets the error details -func (r *RequestV3) GetRegion() string { - return r.r.GetNode().GetLocality().GetRegion() -} - -// GetZone gets the error details -func (r *RequestV3) GetZone() string { - return r.r.GetNode().GetLocality().GetZone() -} - -// GetSubZone gets the error details -func (r *RequestV3) GetSubZone() string { - return r.r.GetNode().GetLocality().GetSubZone() -} - // GetLocality gets the node locality func (r *RequestV3) GetLocality() *Locality { locality := r.r.GetNode().GetLocality()