// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.10
// 	protoc        v7.35.1
// source: envoy/type/matcher/regex.proto

package matcher

import (
	_ "github.com/cncf/xds/go/udpa/annotations"
	_ "github.com/envoyproxy/protoc-gen-validate/validate"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

// A regex matcher designed for safety when used with untrusted input.
type RegexMatcher struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// Types that are valid to be assigned to EngineType:
	//
	//	*RegexMatcher_GoogleRe2
	EngineType isRegexMatcher_EngineType `protobuf_oneof:"engine_type"`
	// The regex match string. The string must be supported by the configured engine.
	Regex         string `protobuf:"bytes,2,opt,name=regex,proto3" json:"regex,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *RegexMatcher) Reset() {
	*x = RegexMatcher{}
	mi := &file_envoy_type_matcher_regex_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *RegexMatcher) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*RegexMatcher) ProtoMessage() {}

func (x *RegexMatcher) ProtoReflect() protoreflect.Message {
	mi := &file_envoy_type_matcher_regex_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use RegexMatcher.ProtoReflect.Descriptor instead.
func (*RegexMatcher) Descriptor() ([]byte, []int) {
	return file_envoy_type_matcher_regex_proto_rawDescGZIP(), []int{0}
}

func (x *RegexMatcher) GetEngineType() isRegexMatcher_EngineType {
	if x != nil {
		return x.EngineType
	}
	return nil
}

func (x *RegexMatcher) GetGoogleRe2() *RegexMatcher_GoogleRE2 {
	if x != nil {
		if x, ok := x.EngineType.(*RegexMatcher_GoogleRe2); ok {
			return x.GoogleRe2
		}
	}
	return nil
}

func (x *RegexMatcher) GetRegex() string {
	if x != nil {
		return x.Regex
	}
	return ""
}

type isRegexMatcher_EngineType interface {
	isRegexMatcher_EngineType()
}

type RegexMatcher_GoogleRe2 struct {
	// Google's RE2 regex engine.
	GoogleRe2 *RegexMatcher_GoogleRE2 `protobuf:"bytes,1,opt,name=google_re2,json=googleRe2,proto3,oneof"`
}

func (*RegexMatcher_GoogleRe2) isRegexMatcher_EngineType() {}

// Describes how to match a string and then produce a new string using a regular
// expression and a substitution string.
type RegexMatchAndSubstitute struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// The regular expression used to find portions of a string (hereafter called
	// the "subject string") that should be replaced. When a new string is
	// produced during the substitution operation, the new string is initially
	// the same as the subject string, but then all matches in the subject string
	// are replaced by the substitution string. If replacing all matches isn't
	// desired, regular expression anchors can be used to ensure a single match,
	// so as to replace just one occurrence of a pattern. Capture groups can be
	// used in the pattern to extract portions of the subject string, and then
	// referenced in the substitution string.
	Pattern *RegexMatcher `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"`
	// The string that should be substituted into matching portions of the
	// subject string during a substitution operation to produce a new string.
	// Capture groups in the pattern can be referenced in the substitution
	// string. Note, however, that the syntax for referring to capture groups is
	// defined by the chosen regular expression engine. Google's `RE2
	// <https://github.com/google/re2>`_ regular expression engine uses a
	// backslash followed by the capture group number to denote a numbered
	// capture group. E.g., “\1“ refers to capture group 1, and “\2“ refers
	// to capture group 2.
	Substitution  string `protobuf:"bytes,2,opt,name=substitution,proto3" json:"substitution,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *RegexMatchAndSubstitute) Reset() {
	*x = RegexMatchAndSubstitute{}
	mi := &file_envoy_type_matcher_regex_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *RegexMatchAndSubstitute) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*RegexMatchAndSubstitute) ProtoMessage() {}

func (x *RegexMatchAndSubstitute) ProtoReflect() protoreflect.Message {
	mi := &file_envoy_type_matcher_regex_proto_msgTypes[1]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use RegexMatchAndSubstitute.ProtoReflect.Descriptor instead.
func (*RegexMatchAndSubstitute) Descriptor() ([]byte, []int) {
	return file_envoy_type_matcher_regex_proto_rawDescGZIP(), []int{1}
}

func (x *RegexMatchAndSubstitute) GetPattern() *RegexMatcher {
	if x != nil {
		return x.Pattern
	}
	return nil
}

func (x *RegexMatchAndSubstitute) GetSubstitution() string {
	if x != nil {
		return x.Substitution
	}
	return ""
}

// Google's `RE2 <https://github.com/google/re2>`_ regex engine. The regex string must adhere to
// the documented `syntax <https://github.com/google/re2/wiki/Syntax>`_. The engine is designed
// to complete execution in linear time as well as limit the amount of memory used.
//
// Envoy supports program size checking via runtime. The runtime keys “re2.max_program_size.error_level“
// and “re2.max_program_size.warn_level“ can be set to integers as the maximum program size or
// complexity that a compiled regex can have before an exception is thrown or a warning is
// logged, respectively. “re2.max_program_size.error_level“ defaults to 100, and
// “re2.max_program_size.warn_level“ has no default if unset (will not check/log a warning).
//
// Envoy emits two stats for tracking the program size of regexes: the histogram `re2.program_size`,
// which records the program size, and the counter `re2.exceeded_warn_level`, which is incremented
// each time the program size exceeds the warn level threshold.
type RegexMatcher_GoogleRE2 struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// This field controls the RE2 "program size" which is a rough estimate of how complex a
	// compiled regex is to evaluate. A regex that has a program size greater than the configured
	// value will fail to compile. In this case, the configured max program size can be increased
	// or the regex can be simplified. If not specified, the default is 100.
	//
	// This field is deprecated; regexp validation should be performed on the management server
	// instead of being done by each individual client.
	//
	// Deprecated: Marked as deprecated in envoy/type/matcher/regex.proto.
	MaxProgramSize *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=max_program_size,json=maxProgramSize,proto3" json:"max_program_size,omitempty"`
	unknownFields  protoimpl.UnknownFields
	sizeCache      protoimpl.SizeCache
}

func (x *RegexMatcher_GoogleRE2) Reset() {
	*x = RegexMatcher_GoogleRE2{}
	mi := &file_envoy_type_matcher_regex_proto_msgTypes[2]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *RegexMatcher_GoogleRE2) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*RegexMatcher_GoogleRE2) ProtoMessage() {}

func (x *RegexMatcher_GoogleRE2) ProtoReflect() protoreflect.Message {
	mi := &file_envoy_type_matcher_regex_proto_msgTypes[2]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use RegexMatcher_GoogleRE2.ProtoReflect.Descriptor instead.
func (*RegexMatcher_GoogleRE2) Descriptor() ([]byte, []int) {
	return file_envoy_type_matcher_regex_proto_rawDescGZIP(), []int{0, 0}
}

// Deprecated: Marked as deprecated in envoy/type/matcher/regex.proto.
func (x *RegexMatcher_GoogleRE2) GetMaxProgramSize() *wrapperspb.UInt32Value {
	if x != nil {
		return x.MaxProgramSize
	}
	return nil
}

var File_envoy_type_matcher_regex_proto protoreflect.FileDescriptor

const file_envoy_type_matcher_regex_proto_rawDesc = "" +
	"\n" +
	"\x1eenvoy/type/matcher/regex.proto\x12\x12envoy.type.matcher\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\xf1\x01\n" +
	"\fRegexMatcher\x12U\n" +
	"\n" +
	"google_re2\x18\x01 \x01(\v2*.envoy.type.matcher.RegexMatcher.GoogleRE2B\b\xfaB\x05\x8a\x01\x02\x10\x01H\x00R\tgoogleRe2\x12\x1d\n" +
	"\x05regex\x18\x02 \x01(\tB\a\xfaB\x04r\x02\x10\x01R\x05regex\x1aW\n" +
	"\tGoogleRE2\x12J\n" +
	"\x10max_program_size\x18\x01 \x01(\v2\x1c.google.protobuf.UInt32ValueB\x02\x18\x01R\x0emaxProgramSizeB\x12\n" +
	"\vengine_type\x12\x03\xf8B\x01\"y\n" +
	"\x17RegexMatchAndSubstitute\x12:\n" +
	"\apattern\x18\x01 \x01(\v2 .envoy.type.matcher.RegexMatcherR\apattern\x12\"\n" +
	"\fsubstitution\x18\x02 \x01(\tR\fsubstitutionBs\xba\x80\xc8\xd1\x06\x02\x10\x01\n" +
	" io.envoyproxy.envoy.type.matcherB\n" +
	"RegexProtoP\x01Z9github.com/envoyproxy/go-control-plane/envoy/type/matcherb\x06proto3"

var (
	file_envoy_type_matcher_regex_proto_rawDescOnce sync.Once
	file_envoy_type_matcher_regex_proto_rawDescData []byte
)

func file_envoy_type_matcher_regex_proto_rawDescGZIP() []byte {
	file_envoy_type_matcher_regex_proto_rawDescOnce.Do(func() {
		file_envoy_type_matcher_regex_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_type_matcher_regex_proto_rawDesc), len(file_envoy_type_matcher_regex_proto_rawDesc)))
	})
	return file_envoy_type_matcher_regex_proto_rawDescData
}

var file_envoy_type_matcher_regex_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_envoy_type_matcher_regex_proto_goTypes = []any{
	(*RegexMatcher)(nil),            // 0: envoy.type.matcher.RegexMatcher
	(*RegexMatchAndSubstitute)(nil), // 1: envoy.type.matcher.RegexMatchAndSubstitute
	(*RegexMatcher_GoogleRE2)(nil),  // 2: envoy.type.matcher.RegexMatcher.GoogleRE2
	(*wrapperspb.UInt32Value)(nil),  // 3: google.protobuf.UInt32Value
}
var file_envoy_type_matcher_regex_proto_depIdxs = []int32{
	2, // 0: envoy.type.matcher.RegexMatcher.google_re2:type_name -> envoy.type.matcher.RegexMatcher.GoogleRE2
	0, // 1: envoy.type.matcher.RegexMatchAndSubstitute.pattern:type_name -> envoy.type.matcher.RegexMatcher
	3, // 2: envoy.type.matcher.RegexMatcher.GoogleRE2.max_program_size:type_name -> google.protobuf.UInt32Value
	3, // [3:3] is the sub-list for method output_type
	3, // [3:3] is the sub-list for method input_type
	3, // [3:3] is the sub-list for extension type_name
	3, // [3:3] is the sub-list for extension extendee
	0, // [0:3] is the sub-list for field type_name
}

func init() { file_envoy_type_matcher_regex_proto_init() }
func file_envoy_type_matcher_regex_proto_init() {
	if File_envoy_type_matcher_regex_proto != nil {
		return
	}
	file_envoy_type_matcher_regex_proto_msgTypes[0].OneofWrappers = []any{
		(*RegexMatcher_GoogleRe2)(nil),
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_type_matcher_regex_proto_rawDesc), len(file_envoy_type_matcher_regex_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   3,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_envoy_type_matcher_regex_proto_goTypes,
		DependencyIndexes: file_envoy_type_matcher_regex_proto_depIdxs,
		MessageInfos:      file_envoy_type_matcher_regex_proto_msgTypes,
	}.Build()
	File_envoy_type_matcher_regex_proto = out.File
	file_envoy_type_matcher_regex_proto_goTypes = nil
	file_envoy_type_matcher_regex_proto_depIdxs = nil
}
