diff --git a/api/protos/aggregation/v1/aggregation.proto b/api/protos/aggregation/v1/aggregation.proto index 69d845f7..68397610 100644 --- a/api/protos/aggregation/v1/aggregation.proto +++ b/api/protos/aggregation/v1/aggregation.proto @@ -32,12 +32,26 @@ 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; + + // 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; + } +} + +message LocalityMatch { + StringMatch region = 1; + + StringMatch zone = 2; + + StringMatch sub_zone = 3; } // This is a recursive structure which allows complex nested match @@ -53,23 +67,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; + StringMatch id_match = 1; - // 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; + StringMatch cluster_match = 2; + + LocalityMatch locality_match = 3; } } @@ -134,17 +142,31 @@ 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]; } // 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; + LocalityResultAction locality_action = 3; + } } // Rules for generating the resulting fragment from Envoy request names. 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: 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= diff --git a/integration/testdata/keyer_configuration_complete_tech_spec.yaml b/integration/testdata/keyer_configuration_complete_tech_spec.yaml index f0b31df4..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: @@ -21,8 +20,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: @@ -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: 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: diff --git a/internal/app/mapper/mapper.go b/internal/app/mapper/mapper.go index 8785a085..fd81b595 100644 --- a/internal/app/mapper/mapper.go +++ b/internal/app/mapper/mapper.go @@ -124,20 +124,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. + idMatch := predicate.GetIdMatch() + if idMatch != nil { + return compareString(idMatch, req.GetNodeID()) + } + + clusterMatch := predicate.GetClusterMatch() + if clusterMatch != nil { + return compareString(clusterMatch, req.GetCluster()) } + + localityMatch := predicate.GetLocalityMatch() + if localityMatch != nil { + return compareLocality(localityMatch, req.GetLocality()) + } + + return false, fmt.Errorf("RequestNodeMatch is invalid") } func isRequestTypeMatch(matchPredicate *matchPredicate, typeURL string) bool { @@ -261,11 +266,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 } @@ -355,26 +365,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) { @@ -402,16 +392,50 @@ func getResultFragmentFromAction( return replacedFragment, nil } -func compare(requestNodeMatch *aggregationv1.MatchPredicate_RequestNodeMatch, nodeValue string) (bool, error) { +func getFragmentFromLocalityAction( + locality *transport.Locality, + action *aggregationv1.ResultPredicate_LocalityResultAction) (string, error) { + var matches []string + if action.RegionAction != nil { + fragment, err := getResultFragmentFromAction(locality.Region, action.RegionAction) + if err != nil { + return "", err + } + matches = append(matches, fragment) + } + if action.ZoneAction != nil { + fragment, err := getResultFragmentFromAction(locality.Zone, action.ZoneAction) + if err != nil { + return "", err + } + matches = append(matches, fragment) + } + if action.SubzoneAction != nil { + fragment, err := getResultFragmentFromAction(locality.SubZone, action.SubzoneAction) + if err != nil { + return "", err + } + matches = append(matches, fragment) + } + + 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(stringMatch *aggregationv1.StringMatch, nodeValue string) (bool, error) { if nodeValue == "" { return false, fmt.Errorf("MatchPredicate Node field cannot be empty") } - exactMatch := requestNodeMatch.GetExactMatch() + exactMatch := stringMatch.GetExactMatch() if exactMatch != "" { return nodeValue == exactMatch, nil } - regexMatch := requestNodeMatch.GetRegexMatch() + regexMatch := stringMatch.GetRegexMatch() if regexMatch != "" { match, err := regexp.MatchString(regexMatch, nodeValue) if err != nil { @@ -422,3 +446,37 @@ func compare(requestNodeMatch *aggregationv1.MatchPredicate_RequestNodeMatch, no return false, nil } + +func compareLocality(localityMatch *aggregationv1.LocalityMatch, + reqNodeLocality *transport.Locality) (bool, error) { + if reqNodeLocality == nil { + return false, fmt.Errorf("Locality Node field cannot be empty") + } + + regionMatch := true + var err error + if localityMatch.GetRegion() != nil { + regionMatch, err = compareString(localityMatch.Region, reqNodeLocality.Region) + if err != nil { + return false, err + } + } + + zoneMatch := true + if localityMatch.GetZone() != nil { + zoneMatch, err = compareString(localityMatch.Zone, reqNodeLocality.Zone) + if err != nil { + return false, err + } + } + + subZoneMatch := true + 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 5d2ad0fd..218837e8 100644 --- a/internal/app/mapper/mapper_test.go +++ b/internal/app/mapper/mapper_test.go @@ -18,23 +18,21 @@ type Fragment = aggregationv1.KeyerConfiguration_Fragment 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" - 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 = 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 + 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{ @@ -77,7 +75,7 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node id exact match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid), + getRequestNodeIDExactMatch(nodeid), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -86,34 +84,16 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node cluster exact match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeClusterExactMatch(nodecluster), getResultStringFragment(), clusterTypeURL, stringFragment, }, }, { - Description: "RequestNodeMatch with node region exact match", + Description: "RequestNodeMatch with node locality 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), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -122,7 +102,7 @@ var positiveTests = []TableEntry{ { Description: "RequestNodeMatch with node id regex match", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeIDField, "n....d"), + getRequestNodeIDRegexMatch("n....d"), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -131,34 +111,7 @@ 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, @@ -169,8 +122,8 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch(nodecluster), }), getResultStringFragment(), clusterTypeURL, @@ -183,12 +136,11 @@ var positiveTests = []TableEntry{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, nodezone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), nil), }), }), getResultStringFragment(), @@ -201,8 +153,8 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(nodecluster), }), getResultStringFragment(), clusterTypeURL, @@ -214,8 +166,8 @@ var positiveTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, ""), + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch(""), }), getResultStringFragment(), clusterTypeURL, @@ -228,12 +180,11 @@ var positiveTests = []TableEntry{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, ""), + getRequestNodeLocality(getExactMatch(noderegion), nil, nil), }), }), getResultStringFragment(), @@ -247,12 +198,11 @@ var positiveTests = []TableEntry{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, nodezone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), nil), }), }), getResultStringFragment(), @@ -272,7 +222,7 @@ var positiveTests = []TableEntry{ { Description: "Not Match RequestNodeMatch with node id regex", Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeIDField), + getRequestNodeNotMatch(getRequestNodeIDRegexMatch(notMatchRegex)), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -281,34 +231,16 @@ var positiveTests = []TableEntry{ { Description: "Not Match RequestNodeMatch with node cluster regex", Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeClusterField), - 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), + getRequestNodeNotMatch(getRequestNodeClusterRegexMatch(notMatchRegex)), getResultStringFragment(), clusterTypeURL, stringFragment, }, }, { - Description: "Not Match RequestNodeMatch with node subzone regex", + Description: "Not Match RequestNodeMatch with node locality", Parameters: []interface{}{ - getRequestNodeRegexNotMatch(nodeSubZoneField), + getRequestNodeLocalityNotMatch(), getResultStringFragment(), clusterTypeURL, stringFragment, @@ -322,12 +254,11 @@ var positiveTests = []TableEntry{ NotMatch: getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, ""), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(""), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactNotMatch(nodeRegionField, ""), - getRequestNodeRegexMatch(nodeZoneField, nodezone), + getRequestNodeLocalityNotMatch(), }), }), }, @@ -341,7 +272,7 @@ var positiveTests = []TableEntry{ Description: "AnyMatch With exact Node Id result", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), clusterTypeURL, nodeid, }, @@ -350,7 +281,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", }, @@ -359,7 +290,7 @@ var positiveTests = []TableEntry{ Description: "AnyMatch With exact Node Cluster match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), + getResultRequestNodeClusterFragment(getExactAction()), clusterTypeURL, nodecluster, }, @@ -368,63 +299,123 @@ 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", + 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), - getResultRequestNodeFragment(nodeRegionField, getExactAction()), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getExactAction(), + SubzoneAction: getExactAction(), + }, + ), clusterTypeURL, - noderegion, + fmt.Sprintf("%s|%s", noderegion, nodesubzone), }, }, { - Description: "AnyMatch With regex Node Region match", + Description: "AnyMatch With Exact Locality zone and subzone match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getRegexAction("r(egion)", "p$1")), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + ZoneAction: getExactAction(), + SubzoneAction: getExactAction(), + }, + ), clusterTypeURL, - "pegion", + fmt.Sprintf("%s|%s", nodezone, nodesubzone), }, }, { - Description: "AnyMatch With exact Node Zone match", + Description: "AnyMatch With Regex Locality region, zone, and subzone match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getExactAction()), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getRegexAction("r....n", "r1"), + ZoneAction: getRegexAction("z..e", "zone2"), + SubzoneAction: getRegexAction("s..zon.", "subzero"), + }, + ), clusterTypeURL, - nodezone, + "r1|zone2|subzero", }, }, { - Description: "AnyMatch With regex Node Zone match", + Description: "AnyMatch With Regex Locality region and zone match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getRegexAction("z..e$", "newzone")), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getRegexAction("r....n", "r1"), + ZoneAction: getRegexAction("z..e", "zone2"), + }, + ), clusterTypeURL, - "newzone", + "r1|zone2", }, }, { - Description: "AnyMatch With exact Node Subzone match", + Description: "AnyMatch With Regex Locality region and subzone match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + RegionAction: getRegexAction("r(egion)", "p$1"), + SubzoneAction: getRegexAction("s..zon.", "subzero"), + }, + ), clusterTypeURL, - nodesubzone, + "pegion|subzero", }, }, { - Description: "AnyMatch With regex Node Subzone match", + Description: "AnyMatch With Regex Locality zone and subzone match", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getRegexAction("[^0-9](u|v)b{1}...e", "zone")), + getResultRequestNodeLocalityFragment( + &LocalityResultAction{ + ZoneAction: getRegexAction("z..e", "zone2"), + SubzoneAction: getRegexAction("s..zon.", "subzero"), + }, + ), clusterTypeURL, - "zone", + "zone2|subzero", }, }, { @@ -442,7 +433,7 @@ var positiveTests = []TableEntry{ getAnyMatch(true), getRepeatedResultPredicate2(), clusterTypeURL, - "str" + noderegion + nodezone + "nTid" + nodecluster, + "str" + noderegion + "|" + nodezone + "nTid" + nodecluster, }, }, { @@ -536,7 +527,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node id does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid+"{5}"), + getRequestNodeIDExactMatch(nodeid + "{5}"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -544,7 +535,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node cluster does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, "[^a-z]odecluster"), + getRequestNodeClusterExactMatch("[^a-z]odecluster"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -552,7 +543,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node region does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeRegionField, noderegion+"\\d"), + getRequestNodeLocality(getExactMatch(noderegion+"\\d"), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequest(), }, @@ -560,7 +551,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node zone does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeZoneField, "zon[A-Z]"), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch("zon[A-Z]"), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequest(), }, @@ -568,7 +559,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node subzone does not match", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeSubZoneField, nodesubzone+"+"), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone+"+")), getResultStringFragment(), getDiscoveryRequest(), }, @@ -576,7 +567,7 @@ var negativeTests = []TableEntry{ { Description: "RequestNodeMatch with node id regex does not match", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeIDField, nodeid+"{5}"), + getRequestNodeIDRegexMatch(nodeid + "{5}"), getResultStringFragment(), getDiscoveryRequest(), }, @@ -584,31 +575,7 @@ 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(), }, @@ -616,7 +583,7 @@ var negativeTests = []TableEntry{ { 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 +591,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 +599,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,7 +607,7 @@ 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)), }, @@ -648,15 +615,7 @@ var negativeTests = []TableEntry{ { 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), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "mismatch", nodezone, nodesubzone)), }, @@ -664,15 +623,7 @@ var negativeTests = []TableEntry{ { 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), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "mismatch", nodesubzone)), }, @@ -680,15 +631,7 @@ var negativeTests = []TableEntry{ { 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), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), getExactMatch(nodesubzone)), getResultStringFragment(), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "mismatch")), }, @@ -698,8 +641,8 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, "nonmatchingnode"), - getRequestNodeExactMatch(nodeClusterField, nodecluster)}), + getRequestNodeIDExactMatch("nonmatchingnode"), + getRequestNodeClusterExactMatch(nodecluster)}), getResultStringFragment(), getDiscoveryRequest(), }, @@ -709,8 +652,8 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, "nomatch")}), + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch("nomatch")}), getResultStringFragment(), getDiscoveryRequest(), }, @@ -721,10 +664,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,8 +677,8 @@ var negativeTests = []TableEntry{ Parameters: []interface{}{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, "")}), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch("")}), getResultStringFragment(), getDiscoveryRequest(), }, @@ -746,12 +689,11 @@ var negativeTests = []TableEntry{ getRequestNodeOrMatch( []*aggregationv1.MatchPredicate{ getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, ""), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(""), }), getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, ""), - getRequestNodeRegexMatch(nodeZoneField, ""), + getRequestNodeLocality(getExactMatch("nomatch"), nil, nil), }), }), getResultStringFragment(), @@ -764,12 +706,11 @@ var negativeTests = []TableEntry{ getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, ""), - getRequestNodeExactMatch(nodeClusterField, ""), + getRequestNodeIDExactMatch(""), + getRequestNodeClusterExactMatch(""), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, ""), - getRequestNodeRegexMatch(nodeZoneField, ""), + getRequestNodeLocality(nil, nil, nil), }), }), getResultStringFragment(), @@ -785,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(), }, @@ -832,12 +773,11 @@ var negativeTests = []TableEntry{ NotMatch: getRequestNodeAndMatch( []*aggregationv1.MatchPredicate{ getRequestNodeOrMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getRequestNodeExactMatch(nodeClusterField, nodecluster), + getRequestNodeIDExactMatch(nodeid), + getRequestNodeClusterExactMatch(nodecluster), }), getRequestNodeAndMatch([]*aggregationv1.MatchPredicate{ - getRequestNodeRegexMatch(nodeRegionField, noderegion), - getRequestNodeRegexMatch(nodeZoneField, nodezone), + getRequestNodeLocality(getExactMatch(noderegion), getExactMatch(nodezone), nil), }), }), }, @@ -864,7 +804,7 @@ var regexpErrorCases = []TableEntry{ { Description: "Regex compilation failure in Nodefragment should return error", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), + getRequestNodeIDRegexMatch("\xbd\xb2"), getResultStringFragment(), }, }, @@ -872,7 +812,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", "")), }, }, } @@ -881,7 +821,7 @@ var regexpErrorCasesMultipleFragments = []TableEntry{ { Description: "Regex parse failure in first request predicate", Parameters: []interface{}{ - getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), + getRequestNodeIDRegexMatch("\xbd\xb2"), getAnyMatch(true), getResultStringFragment(), getResultStringFragment(), @@ -891,7 +831,7 @@ var regexpErrorCasesMultipleFragments = []TableEntry{ Description: "Regex parse failure in second request predicate", Parameters: []interface{}{ getAnyMatch(true), - getRequestNodeRegexMatch(nodeSubZoneField, "\xbd\xb2"), + getRequestNodeIDRegexMatch("\xbd\xb2"), getResultStringFragment(), getResultStringFragment(), }, @@ -901,7 +841,7 @@ var regexpErrorCasesMultipleFragments = []TableEntry{ Parameters: []interface{}{ getAnyMatch(true), getAnyMatch(true), - getResultRequestNodeFragment(nodeIDField, getRegexAction("\xbd\xb2", "")), + getResultRequestNodeIDFragment(getRegexAction("\xbd\xb2", "")), getResultStringFragment(), }, }, @@ -911,7 +851,7 @@ var regexpErrorCasesMultipleFragments = []TableEntry{ getAnyMatch(true), getAnyMatch(true), getResultStringFragment(), - getResultRequestNodeFragment(nodeIDField, getRegexAction("\xbd\xb2", "")), + getResultRequestNodeIDFragment(getRegexAction("\xbd\xb2", "")), }, }, { @@ -929,8 +869,8 @@ var emptyFragmentErrorCases = []TableEntry{ { Description: "empty node id in request predicate", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeIDField, nodeid), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getRequestNodeIDExactMatch(nodeid), + getResultRequestNodeIDFragment(getExactAction()), getDiscoveryRequestWithNode(getNode("", nodecluster, noderegion, nodezone, nodesubzone)), "MatchPredicate Node field cannot be empty", }, @@ -938,44 +878,17 @@ var emptyFragmentErrorCases = []TableEntry{ { Description: "empty node cluster in request predicate", Parameters: []interface{}{ - getRequestNodeExactMatch(nodeClusterField, nodecluster), - getResultRequestNodeFragment(nodeIDField, getExactAction()), + getRequestNodeClusterExactMatch(nodecluster), + getResultRequestNodeIDFragment(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 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", }, @@ -984,7 +897,7 @@ 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", }, @@ -993,7 +906,9 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node region in response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getExactAction()), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + RegionAction: getExactAction(), + }), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, "", nodezone, nodesubzone)), "RequestNodeFragment exact match resulted in an empty fragment", }, @@ -1002,7 +917,9 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node zone in response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getExactAction()), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + ZoneAction: getExactAction(), + }), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, "", nodesubzone)), "RequestNodeFragment exact match resulted in an empty fragment", }, @@ -1011,7 +928,9 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node subzone in response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getExactAction()), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + SubzoneAction: getExactAction(), + }), getDiscoveryRequestWithNode(getNode(nodeid, nodecluster, noderegion, nodezone, "")), "RequestNodeFragment exact match resulted in an empty fragment", }, @@ -1020,7 +939,7 @@ var emptyFragmentErrorCases = []TableEntry{ 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", }, @@ -1029,7 +948,7 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node cluster in regex response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeClusterField, getRegexAction(nodecluster, "")), + getResultRequestNodeClusterFragment(getRegexAction(nodecluster, "")), getDiscoveryRequest(), "RequestNodeFragment regex match resulted in an empty fragment", }, @@ -1038,7 +957,9 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node region in regex response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeRegionField, getRegexAction(noderegion, "")), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + RegionAction: getRegexAction(noderegion, ""), + }), getDiscoveryRequest(), "RequestNodeFragment regex match resulted in an empty fragment", }, @@ -1047,7 +968,9 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node zone in regex response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeZoneField, getRegexAction(nodezone, "")), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + ZoneAction: getRegexAction(nodezone, ""), + }), getDiscoveryRequest(), "RequestNodeFragment regex match resulted in an empty fragment", }, @@ -1056,20 +979,13 @@ var emptyFragmentErrorCases = []TableEntry{ Description: "empty node subzone in regex response action", Parameters: []interface{}{ getAnyMatch(true), - getResultRequestNodeFragment(nodeSubZoneField, getRegexAction(nodesubzone, "")), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + SubzoneAction: getRegexAction(nodesubzone, ""), + }), 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: "resource fragment is negative", Parameters: []interface{}{ @@ -1303,26 +1219,80 @@ 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{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ + IdMatch: getExactMatch(exact), + }, + }, + }, + } +} + +func getRequestNodeIDRegexMatch(regex string) *MatchPredicate { + return &MatchPredicate{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_{ + RequestNodeMatch: &aggregationv1.MatchPredicate_RequestNodeMatch{ + Type: &aggregationv1.MatchPredicate_RequestNodeMatch_IdMatch{ + IdMatch: getRegexMatch(regex), + }, + }, + }, + } +} + +func getRequestNodeClusterExactMatch(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_ClusterMatch{ + ClusterMatch: getExactMatch(exact), }, }, }, } } -func getRequestNodeRegexMatch(field aggregationv1.NodeFieldType, regex string) *MatchPredicate { +func getRequestNodeClusterRegexMatch(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_ClusterMatch{ + ClusterMatch: getRegexMatch(regex), + }, + }, + }, + } +} + +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.LocalityMatch{ + Region: region, + Zone: zone, + SubZone: subZone, + }, }, }, }, @@ -1357,18 +1327,18 @@ func getRequestTypeNotMatch(typeurls []string) *MatchPredicate { } } -func getRequestNodeRegexNotMatch(field aggregationv1.NodeFieldType) *MatchPredicate { - return &MatchPredicate{ +func getRequestNodeLocalityNotMatch() *MatchPredicate { + return &matchPredicate{ Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeRegexMatch(field, "notmatchregex"), + NotMatch: getRequestNodeLocality(getExactMatch("r1"), getExactMatch("z2"), getExactMatch("sz3")), }, } } -func getRequestNodeExactNotMatch(field aggregationv1.NodeFieldType, regex string) *MatchPredicate { +func getRequestNodeNotMatch(matchPredicate *aggregationv1.MatchPredicate) *MatchPredicate { return &MatchPredicate{ Type: &aggregationv1.MatchPredicate_NotMatch{ - NotMatch: getRequestNodeExactMatch(field, regex), + NotMatch: matchPredicate, }, } } @@ -1386,8 +1356,8 @@ func getRepeatedResultPredicate1() *ResultPredicate { Type: &aggregationv1.ResultPredicate_AndResult_{ AndResult: &aggregationv1.ResultPredicate_AndResult{ ResultPredicates: []*aggregationv1.ResultPredicate{ - getResultRequestNodeFragment(nodeIDField, getExactAction()), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), + getResultRequestNodeIDFragment(getExactAction()), + getResultRequestNodeClusterFragment(getExactAction()), }, }, }, @@ -1408,14 +1378,16 @@ func getRepeatedResultPredicate2() *ResultPredicate { StringFragment: "str", }, }, - getResultRequestNodeFragment(nodeRegionField, getExactAction()), - getResultRequestNodeFragment(nodeZoneField, getExactAction()), + getResultRequestNodeLocalityFragment(&aggregationv1.ResultPredicate_LocalityResultAction{ + RegionAction: getExactAction(), + ZoneAction: getExactAction(), + }), }, }, }, }, - getResultRequestNodeFragment(nodeIDField, getRegexAction("ode", "T")), - getResultRequestNodeFragment(nodeClusterField, getExactAction()), + getResultRequestNodeIDFragment(getRegexAction("ode", "T")), + getResultRequestNodeClusterFragment(getExactAction()), }, }, }, @@ -1446,14 +1418,39 @@ 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{ - Field: field, - Action: action, + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_IdAction{ + IdAction: action, + }, + }, + }, + } +} + +func getResultRequestNodeClusterFragment( + action *aggregationv1.ResultPredicate_ResultAction) *ResultPredicate { + return &ResultPredicate{ + Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ + RequestNodeFragment: &aggregationv1.ResultPredicate_RequestNodeFragment{ + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_ClusterAction{ + ClusterAction: action, + }, + }, + }, + } +} + +func getResultRequestNodeLocalityFragment(action *aggregationv1.ResultPredicate_LocalityResultAction) *resultPredicate { + return &ResultPredicate{ + Type: &aggregationv1.ResultPredicate_RequestNodeFragment_{ + RequestNodeFragment: &aggregationv1.ResultPredicate_RequestNodeFragment{ + Action: &aggregationv1.ResultPredicate_RequestNodeFragment_LocalityAction{ + LocalityAction: action, + }, }, }, } diff --git a/internal/app/transport/request.go b/internal/app/transport/request.go index ccea7e16..a1448f09 100644 --- a/internal/app/transport/request.go +++ b/internal/app/transport/request.go @@ -13,6 +13,13 @@ 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 + SubZone string +} + // Request is the generic interface to abstract v2 and v3 DiscoveryRequest types type Request interface { GetResourceNames() []string @@ -22,9 +29,7 @@ type Request interface { GetNodeMetadata() *structpb.Struct GetCluster() string GetError() *status.Status - GetRegion() string - GetZone() string - GetSubZone() string + GetLocality() *Locality GetResponseNonce() string GetRaw() *RequestVersion CreateWatch() Watch 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 17d1ee30..1c0c730e 100644 --- a/internal/app/transport/requestv2.go +++ b/internal/app/transport/requestv2.go @@ -58,19 +58,14 @@ 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() + return &Locality{ + Region: locality.GetRegion(), + Zone: locality.GetZone(), + SubZone: locality.GetSubZone(), + } } // GetRaw gets the error details diff --git a/internal/app/transport/requestv3.go b/internal/app/transport/requestv3.go index bb2cf016..c4044c66 100644 --- a/internal/app/transport/requestv3.go +++ b/internal/app/transport/requestv3.go @@ -58,19 +58,14 @@ 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() + return &Locality{ + Region: locality.GetRegion(), + Zone: locality.GetZone(), + SubZone: locality.GetSubZone(), + } } // GetRaw gets the error details 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/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 0e427abc..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 @@ -2,7 +2,24 @@ fragments: - rules: - match: request_node_match: - field: 0 - exact_match: "woooow" + id_match: + 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: + exact_match: "r1" + zone: + exact_match: "z1" + sub_zone: + exact_match: "sz-1" result: string_fragment: "abc" 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 e713e5e0..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", + }, }, }, }, @@ -300,17 +302,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() { diff --git a/pkg/api/aggregation/v1/aggregation.pb.go b/pkg/api/aggregation/v1/aggregation.pb.go index 0b52836d..de824677 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 @@ -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 @@ -130,6 +75,153 @@ func (x *KeyerConfiguration) GetFragments() []*KeyerConfiguration_Fragment { return nil } +type StringMatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Type: + // *StringMatch_ExactMatch + // *StringMatch_RegexMatch + Type isStringMatch_Type `protobuf_oneof:"type"` +} + +func (x *StringMatch) Reset() { + *x = StringMatch{} + if protoimpl.UnsafeEnabled { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StringMatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StringMatch) ProtoMessage() {} + +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)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StringMatch.ProtoReflect.Descriptor instead. +func (*StringMatch) Descriptor() ([]byte, []int) { + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{1} +} + +func (m *StringMatch) GetType() isStringMatch_Type { + if m != nil { + return m.Type + } + return nil +} + +func (x *StringMatch) GetExactMatch() string { + if x, ok := x.GetType().(*StringMatch_ExactMatch); ok { + return x.ExactMatch + } + return "" +} + +func (x *StringMatch) GetRegexMatch() string { + if x, ok := x.GetType().(*StringMatch_RegexMatch); ok { + return x.RegexMatch + } + return "" +} + +type isStringMatch_Type interface { + isStringMatch_Type() +} + +type StringMatch_ExactMatch struct { + // Match on the extract string value. + ExactMatch string `protobuf:"bytes,2,opt,name=exact_match,json=exactMatch,proto3,oneof"` +} + +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 (*StringMatch_ExactMatch) isStringMatch_Type() {} + +func (*StringMatch_RegexMatch) isStringMatch_Type() {} + +type LocalityMatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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 *LocalityMatch) Reset() { + *x = LocalityMatch{} + if protoimpl.UnsafeEnabled { + mi := &file_aggregation_v1_aggregation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalityMatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalityMatch) ProtoMessage() {} + +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)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalityMatch.ProtoReflect.Descriptor instead. +func (*LocalityMatch) Descriptor() ([]byte, []int) { + return file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2} +} + +func (x *LocalityMatch) GetRegion() *StringMatch { + if x != nil { + return x.Region + } + return nil +} + +func (x *LocalityMatch) GetZone() *StringMatch { + if x != nil { + return x.Zone + } + return nil +} + +func (x *LocalityMatch) GetSubZone() *StringMatch { + if x != nil { + return x.SubZone + } + return nil +} + // This is a recursive structure which allows complex nested match // configurations to be built using various logical operators. // [#next-free-field: 7] @@ -151,7 +243,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 +256,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 +269,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 +390,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 +403,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 +416,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 +500,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 +513,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 +553,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 +566,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 +611,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 +624,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 +637,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 +647,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 +677,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 +690,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 +700,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() *StringMatch { + 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() *StringMatch { + if x, ok := x.GetType().(*MatchPredicate_RequestNodeMatch_ClusterMatch); ok { + return x.ClusterMatch } - return "" + return nil +} + +func (x *MatchPredicate_RequestNodeMatch) GetLocalityMatch() *LocalityMatch { + 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 *StringMatch `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 *StringMatch `protobuf:"bytes,2,opt,name=cluster_match,json=clusterMatch,proto3,oneof"` +} + +type MatchPredicate_RequestNodeMatch_LocalityMatch struct { + LocalityMatch *LocalityMatch `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 +757,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 +770,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 +783,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 +807,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 +820,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 +833,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 { @@ -782,6 +875,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 @@ -793,7 +951,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[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -806,7 +964,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[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -819,7 +977,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, 2} } func (x *ResultPredicate_AndResult) GetResultPredicates() []*ResultPredicate { @@ -830,20 +988,23 @@ 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() { *x = ResultPredicate_RequestNodeFragment{} if protoimpl.UnsafeEnabled { - mi := &file_aggregation_v1_aggregation_proto_msgTypes[10] + mi := &file_aggregation_v1_aggregation_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -856,7 +1017,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[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -869,23 +1030,61 @@ 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, 3} } -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() *ResultPredicate_LocalityResultAction { + 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 *ResultPredicate_LocalityResultAction `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 { @@ -902,7 +1101,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[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -915,7 +1114,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[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -928,7 +1127,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, 4} } func (x *ResultPredicate_ResourceNamesFragment) GetElement() int32 { @@ -960,7 +1159,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[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -973,7 +1172,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[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -986,7 +1185,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,124 +1230,161 @@ 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, - 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, + 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, 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, 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, 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, + 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, 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, 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, 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, + 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, 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, + 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, 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, } @@ -1165,49 +1401,59 @@ 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, 13) +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 - (*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 + (*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{ - 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 + 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 + 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() } @@ -1229,7 +1475,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.(*StringMatch); i { case 0: return &v.state case 1: @@ -1241,7 +1487,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.(*LocalityMatch); i { case 0: return &v.state case 1: @@ -1253,7 +1499,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 +1511,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 +1523,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 +1535,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 +1547,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 +1559,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 +1571,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 +1583,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 +1595,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_LocalityResultAction); i { case 0: return &v.state case 1: @@ -1361,6 +1607,42 @@ 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_AndResult); 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_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[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 @@ -1374,6 +1656,10 @@ func file_aggregation_v1_aggregation_proto_init() { } } file_aggregation_v1_aggregation_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*StringMatch_ExactMatch)(nil), + (*StringMatch_RegexMatch)(nil), + } + file_aggregation_v1_aggregation_proto_msgTypes[3].OneofWrappers = []interface{}{ (*MatchPredicate_AndMatch)(nil), (*MatchPredicate_OrMatch)(nil), (*MatchPredicate_NotMatch)(nil), @@ -1381,33 +1667,38 @@ 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), } + file_aggregation_v1_aggregation_proto_msgTypes[13].OneofWrappers = []interface{}{ + (*ResultPredicate_RequestNodeFragment_IdAction)(nil), + (*ResultPredicate_RequestNodeFragment_ClusterAction)(nil), + (*ResultPredicate_RequestNodeFragment_LocalityAction)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_aggregation_v1_aggregation_proto_rawDesc, - NumEnums: 1, - NumMessages: 13, + 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 diff --git a/pkg/api/aggregation/v1/aggregation.pb.validate.go b/pkg/api/aggregation/v1/aggregation.pb.validate.go index e5e4101e..61538a3c 100644 --- a/pkg/api/aggregation/v1/aggregation.pb.validate.go +++ b/pkg/api/aggregation/v1/aggregation.pb.validate.go @@ -125,6 +125,182 @@ var _ interface { ErrorName() string } = KeyerConfigurationValidationError{} +// 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 *StringMatch_ExactMatch: + // no validation rules for ExactMatch + + case *StringMatch_RegexMatch: + // no validation rules for RegexMatch + + default: + return StringMatchValidationError{ + field: "Type", + reason: "value is required", + } + + } + + return nil +} + +// 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 + key bool +} + +// Field function returns field value. +func (e StringMatchValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StringMatchValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StringMatchValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StringMatchValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StringMatchValidationError) ErrorName() string { return "StringMatchValidationError" } + +// Error satisfies the builtin error interface +func (e StringMatchValidationError) 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 %sStringMatch.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StringMatchValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StringMatchValidationError{} + +// 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 + } + + 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, + } + } + } + + 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, + } + } + } + + 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 +} + +// 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 + key bool +} + +// Field function returns field value. +func (e LocalityMatchValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e LocalityMatchValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e LocalityMatchValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e LocalityMatchValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e LocalityMatchValidationError) ErrorName() string { return "LocalityMatchValidationError" } + +// Error satisfies the builtin error interface +func (e LocalityMatchValidationError) 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 %sLocalityMatch.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = LocalityMatchValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = 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 // is returned. @@ -658,20 +834,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{ @@ -929,6 +1128,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. @@ -1026,28 +1323,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 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