// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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}];
}
