syntax = "proto3";

package envoy.extensions.common.matching.v3;

import "envoy/config/common/matcher/v3/matcher.proto";
import "envoy/config/core/v3/extension.proto";

import "xds/type/matcher/v3/matcher.proto";

import "envoy/annotations/deprecation.proto";
import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.common.matching.v3";
option java_outer_classname = "ExtensionMatcherProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/common/matching/v3;matchingv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Extension matcher]

// Wrapper around an existing extension that provides an associated matcher. This allows
// decorating an existing extension with a matcher, which can be used to match against
// relevant protocol data.
message ExtensionWithMatcher {
  // The associated matcher. This is deprecated in favor of xds_matcher.
  config.common.matcher.v3.Matcher matcher = 1
      [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

  // The associated matcher.
  xds.type.matcher.v3.Matcher xds_matcher = 3;

  // The underlying extension config.
  config.core.v3.TypedExtensionConfig extension_config = 2
      [(validate.rules).message = {required: true}];
}

// Extra settings on a per virtualhost/route/weighted-cluster level.
message ExtensionWithMatcherPerRoute {
  // Matcher override.
  xds.type.matcher.v3.Matcher xds_matcher = 1;
}
