From 50a59f6a72b945b108eca173dc78affec03bbc35 Mon Sep 17 00:00:00 2001 From: Auni Ahsan Date: Fri, 22 Jan 2021 14:42:04 -0500 Subject: [PATCH] filters: Add dependencies.proto (#14750) Introduces the FilterDependency proto. This isn't quite an extension, but it's a common proto to be used by all filter extensions. Risk Level: Low (proto addition only) #14470 Signed-off-by: Auni Ahsan --- api/BUILD | 1 + .../filters/common/dependency/v3/BUILD | 9 ++++ .../common/dependency/v3/dependency.proto | 45 +++++++++++++++++++ api/versioning/BUILD | 1 + .../common_messages/common_messages.rst | 1 + .../filters/common/dependency/v3/BUILD | 9 ++++ .../common/dependency/v3/dependency.proto | 45 +++++++++++++++++++ 7 files changed, 111 insertions(+) create mode 100644 api/envoy/extensions/filters/common/dependency/v3/BUILD create mode 100644 api/envoy/extensions/filters/common/dependency/v3/dependency.proto create mode 100644 generated_api_shadow/envoy/extensions/filters/common/dependency/v3/BUILD create mode 100644 generated_api_shadow/envoy/extensions/filters/common/dependency/v3/dependency.proto diff --git a/api/BUILD b/api/BUILD index 5b4131922cd0..effde23bad70 100644 --- a/api/BUILD +++ b/api/BUILD @@ -166,6 +166,7 @@ proto_library( "//envoy/extensions/common/tap/v3:pkg", "//envoy/extensions/compression/gzip/compressor/v3:pkg", "//envoy/extensions/compression/gzip/decompressor/v3:pkg", + "//envoy/extensions/filters/common/dependency/v3:pkg", "//envoy/extensions/filters/common/fault/v3:pkg", "//envoy/extensions/filters/common/matcher/action/v3:pkg", "//envoy/extensions/filters/http/adaptive_concurrency/v3:pkg", diff --git a/api/envoy/extensions/filters/common/dependency/v3/BUILD b/api/envoy/extensions/filters/common/dependency/v3/BUILD new file mode 100644 index 000000000000..ee92fb652582 --- /dev/null +++ b/api/envoy/extensions/filters/common/dependency/v3/BUILD @@ -0,0 +1,9 @@ +# 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 = ["@com_github_cncf_udpa//udpa/annotations:pkg"], +) diff --git a/api/envoy/extensions/filters/common/dependency/v3/dependency.proto b/api/envoy/extensions/filters/common/dependency/v3/dependency.proto new file mode 100644 index 000000000000..c21408dc0701 --- /dev/null +++ b/api/envoy/extensions/filters/common/dependency/v3/dependency.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package envoy.extensions.filters.common.dependency.v3; + +import "udpa/annotations/migrate.proto"; +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.common.dependency.v3"; +option java_outer_classname = "DependencyProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Filter dependency specification] + +// Dependency specification and string identifier. +message Dependency { + enum DependencyType { + HEADER = 0; + FILTER_STATE_KEY = 1; + DYNAMIC_METADATA = 2; + } + + // The kind of dependency. + DependencyType type = 1; + + // The string identifier for the dependency. + string name = 2 [(validate.rules).string = {min_len: 1}]; +} + +// Dependency specification for a filter. For a filter chain to be valid, any +// dependency that is required must be provided by an earlier filter. +message FilterDependencies { + // A list of dependencies required on the decode path. + repeated Dependency decode_required = 1; + + // A list of dependencies provided on the encode path. + repeated Dependency decode_provided = 2; + + // A list of dependencies required on the decode path. + repeated Dependency encode_required = 3; + + // A list of dependencies provided on the encode path. + repeated Dependency encode_provided = 4; +} diff --git a/api/versioning/BUILD b/api/versioning/BUILD index 3204d928f1a9..ba5c589d6fc3 100644 --- a/api/versioning/BUILD +++ b/api/versioning/BUILD @@ -49,6 +49,7 @@ proto_library( "//envoy/extensions/common/tap/v3:pkg", "//envoy/extensions/compression/gzip/compressor/v3:pkg", "//envoy/extensions/compression/gzip/decompressor/v3:pkg", + "//envoy/extensions/filters/common/dependency/v3:pkg", "//envoy/extensions/filters/common/fault/v3:pkg", "//envoy/extensions/filters/common/matcher/action/v3:pkg", "//envoy/extensions/filters/http/adaptive_concurrency/v3:pkg", diff --git a/docs/root/api-v3/common_messages/common_messages.rst b/docs/root/api-v3/common_messages/common_messages.rst index 24309a9d7815..1e04318e4736 100644 --- a/docs/root/api-v3/common_messages/common_messages.rst +++ b/docs/root/api-v3/common_messages/common_messages.rst @@ -22,4 +22,5 @@ Common messages ../extensions/filters/common/fault/v3/fault.proto ../extensions/network/socket_interface/v3/default_socket_interface.proto ../extensions/common/matching/v3/extension_matcher.proto + ../extensions/filters/common/dependency/v3/dependency.proto ../extensions/filters/common/matcher/action/v3/skip_action.proto diff --git a/generated_api_shadow/envoy/extensions/filters/common/dependency/v3/BUILD b/generated_api_shadow/envoy/extensions/filters/common/dependency/v3/BUILD new file mode 100644 index 000000000000..ee92fb652582 --- /dev/null +++ b/generated_api_shadow/envoy/extensions/filters/common/dependency/v3/BUILD @@ -0,0 +1,9 @@ +# 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 = ["@com_github_cncf_udpa//udpa/annotations:pkg"], +) diff --git a/generated_api_shadow/envoy/extensions/filters/common/dependency/v3/dependency.proto b/generated_api_shadow/envoy/extensions/filters/common/dependency/v3/dependency.proto new file mode 100644 index 000000000000..c21408dc0701 --- /dev/null +++ b/generated_api_shadow/envoy/extensions/filters/common/dependency/v3/dependency.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package envoy.extensions.filters.common.dependency.v3; + +import "udpa/annotations/migrate.proto"; +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.common.dependency.v3"; +option java_outer_classname = "DependencyProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Filter dependency specification] + +// Dependency specification and string identifier. +message Dependency { + enum DependencyType { + HEADER = 0; + FILTER_STATE_KEY = 1; + DYNAMIC_METADATA = 2; + } + + // The kind of dependency. + DependencyType type = 1; + + // The string identifier for the dependency. + string name = 2 [(validate.rules).string = {min_len: 1}]; +} + +// Dependency specification for a filter. For a filter chain to be valid, any +// dependency that is required must be provided by an earlier filter. +message FilterDependencies { + // A list of dependencies required on the decode path. + repeated Dependency decode_required = 1; + + // A list of dependencies provided on the encode path. + repeated Dependency decode_provided = 2; + + // A list of dependencies required on the decode path. + repeated Dependency encode_required = 3; + + // A list of dependencies provided on the encode path. + repeated Dependency encode_provided = 4; +}