diff --git a/BUILD b/BUILD index e28c8f3e..29414b11 100644 --- a/BUILD +++ b/BUILD @@ -217,6 +217,7 @@ proto_library( "//envoy/extensions/filters/network/sni_dynamic_forward_proxy/v3:pkg", "//envoy/extensions/filters/network/tcp_proxy/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/filters/header_to_metadata/v3:pkg", + "//envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/filters/ratelimit/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/router/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/v3:pkg", diff --git a/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3/BUILD b/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3/BUILD new file mode 100644 index 00000000..693f0b92 --- /dev/null +++ b/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3/BUILD @@ -0,0 +1,12 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = [ + "//envoy/type/matcher/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3/payload_to_metadata.proto b/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3/payload_to_metadata.proto new file mode 100644 index 00000000..894df76e --- /dev/null +++ b/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3/payload_to_metadata.proto @@ -0,0 +1,100 @@ +syntax = "proto3"; + +package envoy.extensions.filters.network.thrift_proxy.filters.payload_to_metadata.v3; + +import "envoy/type/matcher/v3/regex.proto"; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.network.thrift_proxy.filters.payload_to_metadata.v3"; +option java_outer_classname = "PayloadToMetadataProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3;payload_to_metadatav3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Payload-To-Metadata Filter] +// +// The configuration for transforming payloads into metadata. This is useful +// for matching load balancer subsets, logging, etc. +// +// Payload to Metadata :ref:`configuration overview `. +// [#extension: envoy.filters.thrift.payload_to_metadata] + +message PayloadToMetadata { + enum ValueType { + STRING = 0; + NUMBER = 1; + } + + // [#next-free-field: 6] + message KeyValuePair { + // The namespace — if this is empty, the filter's namespace will be used. + string metadata_namespace = 1; + + // The key to use within the namespace. + string key = 2 [(validate.rules).string = {min_len: 1}]; + + oneof value_type { + // The value to pair with the given key. + // + // When used for on_present case, if value is non-empty it'll be used instead + // of the field value. If both are empty, the field value is used as-is. + // + // When used for on_missing case, a non-empty value must be provided. + string value = 3; + + // If present, the header's value will be matched and substituted with this. + // If there is no match or substitution, the field value is used as-is. + // + // This is only used for on_present. + type.matcher.v3.RegexMatchAndSubstitute regex_value_rewrite = 4; + } + + // The value's type — defaults to string. + ValueType type = 5 [(validate.rules).enum = {defined_only: true}]; + } + + // A Rule defines what metadata to apply when a field is present or missing. + // [#next-free-field: 6] + message Rule { + oneof match_specifier { + option (validate.required) = true; + + // If specified, the route must exactly match the request method name. As a special case, + // an empty string matches any request method name. + string method_name = 1; + + // If specified, the route must have the service name as the request method name prefix. + // As a special case, an empty string matches any service name. Only relevant when service + // multiplexing. + string service_name = 2; + } + + // Specifies that a match will be performed on the value of a field. + FieldSelector field_selector = 3 [(validate.rules).message = {required: true}]; + + // If the field is present, apply this metadata KeyValuePair. + KeyValuePair on_present = 4; + + // If the field is missing, apply this metadata KeyValuePair. + // + // The value in the KeyValuePair must be set, since it'll be used in lieu + // of the missing field value. + KeyValuePair on_missing = 5; + } + + message FieldSelector { + // field name to log + string name = 1 [(validate.rules).string = {min_len: 1}]; + + // field id to match + int32 id = 2 [(validate.rules).int32 = {lte: 32767 gte: -32768}]; + + // next node of the field selector + FieldSelector child = 3; + } + + // The list of rules to apply to requests. + repeated Rule request_rules = 1 [(validate.rules).repeated = {min_items: 1}]; +} diff --git a/versioning/BUILD b/versioning/BUILD index 28dd2b0a..a3935c83 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -156,6 +156,7 @@ proto_library( "//envoy/extensions/filters/network/sni_dynamic_forward_proxy/v3:pkg", "//envoy/extensions/filters/network/tcp_proxy/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/filters/header_to_metadata/v3:pkg", + "//envoy/extensions/filters/network/thrift_proxy/filters/payload_to_metadata/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/filters/ratelimit/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/router/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/v3:pkg",