syntax = "proto3";

package envoy.type.matcher.v3;

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

option java_package = "io.envoyproxy.envoy.type.matcher.v3";
option java_outer_classname = "HttpInputsProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3;matcherv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Common HTTP inputs]

// Match input indicates that matching should be done on a specific request header.
// The resulting input string will be all headers for the given key joined by a comma,
// e.g. if the request contains two 'foo' headers with value 'bar' and 'baz', the input
// string will be 'bar,baz'.
// [#comment:TODO(snowp): Link to unified matching docs.]
// [#extension: envoy.matching.inputs.request_headers]
message HttpRequestHeaderMatchInput {
  // The request header to match on.
  string header_name = 1
      [(validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}];
}

// Match input indicates that matching should be done on a specific request trailer.
// The resulting input string will be all headers for the given key joined by a comma,
// e.g. if the request contains two 'foo' headers with value 'bar' and 'baz', the input
// string will be 'bar,baz'.
// [#comment:TODO(snowp): Link to unified matching docs.]
// [#extension: envoy.matching.inputs.request_trailers]
message HttpRequestTrailerMatchInput {
  // The request trailer to match on.
  string header_name = 1
      [(validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}];
}

// Match input indicating that matching should be done on a specific response header.
// The resulting input string will be all headers for the given key joined by a comma,
// e.g. if the response contains two 'foo' headers with value 'bar' and 'baz', the input
// string will be 'bar,baz'.
// [#comment:TODO(snowp): Link to unified matching docs.]
// [#extension: envoy.matching.inputs.response_headers]
message HttpResponseHeaderMatchInput {
  // The response header to match on.
  string header_name = 1
      [(validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}];
}

// Match input indicates that matching should be done on a specific response trailer.
// The resulting input string will be all headers for the given key joined by a comma,
// e.g. if the request contains two 'foo' headers with value 'bar' and 'baz', the input
// string will be 'bar,baz'.
// [#comment:TODO(snowp): Link to unified matching docs.]
// [#extension: envoy.matching.inputs.response_trailers]
message HttpResponseTrailerMatchInput {
  // The response trailer to match on.
  string header_name = 1
      [(validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}];
}

// Match input indicates that matching should be done on a specific query parameter.
// The resulting input string will be the first query parameter for the value
// 'query_param'.
// [#extension: envoy.matching.inputs.query_params]
message HttpRequestQueryParamMatchInput {
  // The query parameter to match on.
  string query_param = 1 [(validate.rules).string = {min_len: 1}];
}
