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

package typev3

import (
	_ "github.com/cncf/xds/go/udpa/annotations"
	_ "github.com/cncf/xds/go/xds/annotations/v3"
	_ "github.com/envoyproxy/protoc-gen-validate/validate"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	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)
)

// Choose between allow all and deny all.
type RateLimitStrategy_BlanketRule int32

const (
	RateLimitStrategy_ALLOW_ALL RateLimitStrategy_BlanketRule = 0
	RateLimitStrategy_DENY_ALL  RateLimitStrategy_BlanketRule = 1
)

// Enum value maps for RateLimitStrategy_BlanketRule.
var (
	RateLimitStrategy_BlanketRule_name = map[int32]string{
		0: "ALLOW_ALL",
		1: "DENY_ALL",
	}
	RateLimitStrategy_BlanketRule_value = map[string]int32{
		"ALLOW_ALL": 0,
		"DENY_ALL":  1,
	}
)

func (x RateLimitStrategy_BlanketRule) Enum() *RateLimitStrategy_BlanketRule {
	p := new(RateLimitStrategy_BlanketRule)
	*p = x
	return p
}

func (x RateLimitStrategy_BlanketRule) String() string {
	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}

func (RateLimitStrategy_BlanketRule) Descriptor() protoreflect.EnumDescriptor {
	return file_envoy_type_v3_ratelimit_strategy_proto_enumTypes[0].Descriptor()
}

func (RateLimitStrategy_BlanketRule) Type() protoreflect.EnumType {
	return &file_envoy_type_v3_ratelimit_strategy_proto_enumTypes[0]
}

func (x RateLimitStrategy_BlanketRule) Number() protoreflect.EnumNumber {
	return protoreflect.EnumNumber(x)
}

// Deprecated: Use RateLimitStrategy_BlanketRule.Descriptor instead.
func (RateLimitStrategy_BlanketRule) EnumDescriptor() ([]byte, []int) {
	return file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP(), []int{0, 0}
}

type RateLimitStrategy struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// Types that are valid to be assigned to Strategy:
	//
	//	*RateLimitStrategy_BlanketRule_
	//	*RateLimitStrategy_RequestsPerTimeUnit_
	//	*RateLimitStrategy_TokenBucket
	Strategy      isRateLimitStrategy_Strategy `protobuf_oneof:"strategy"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

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

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

func (*RateLimitStrategy) ProtoMessage() {}

func (x *RateLimitStrategy) ProtoReflect() protoreflect.Message {
	mi := &file_envoy_type_v3_ratelimit_strategy_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 RateLimitStrategy.ProtoReflect.Descriptor instead.
func (*RateLimitStrategy) Descriptor() ([]byte, []int) {
	return file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP(), []int{0}
}

func (x *RateLimitStrategy) GetStrategy() isRateLimitStrategy_Strategy {
	if x != nil {
		return x.Strategy
	}
	return nil
}

func (x *RateLimitStrategy) GetBlanketRule() RateLimitStrategy_BlanketRule {
	if x != nil {
		if x, ok := x.Strategy.(*RateLimitStrategy_BlanketRule_); ok {
			return x.BlanketRule
		}
	}
	return RateLimitStrategy_ALLOW_ALL
}

func (x *RateLimitStrategy) GetRequestsPerTimeUnit() *RateLimitStrategy_RequestsPerTimeUnit {
	if x != nil {
		if x, ok := x.Strategy.(*RateLimitStrategy_RequestsPerTimeUnit_); ok {
			return x.RequestsPerTimeUnit
		}
	}
	return nil
}

func (x *RateLimitStrategy) GetTokenBucket() *TokenBucket {
	if x != nil {
		if x, ok := x.Strategy.(*RateLimitStrategy_TokenBucket); ok {
			return x.TokenBucket
		}
	}
	return nil
}

type isRateLimitStrategy_Strategy interface {
	isRateLimitStrategy_Strategy()
}

type RateLimitStrategy_BlanketRule_ struct {
	// Allow or Deny the requests.
	// If unset, allow all.
	BlanketRule RateLimitStrategy_BlanketRule `protobuf:"varint,1,opt,name=blanket_rule,json=blanketRule,proto3,enum=envoy.type.v3.RateLimitStrategy_BlanketRule,oneof"`
}

type RateLimitStrategy_RequestsPerTimeUnit_ struct {
	// Best-effort limit of the number of requests per time unit, f.e. requests per second.
	// Does not prescribe any specific rate limiting algorithm, see :ref:`RequestsPerTimeUnit
	// <envoy_v3_api_msg_type.v3.RateLimitStrategy.RequestsPerTimeUnit>` for details.
	RequestsPerTimeUnit *RateLimitStrategy_RequestsPerTimeUnit `protobuf:"bytes,2,opt,name=requests_per_time_unit,json=requestsPerTimeUnit,proto3,oneof"`
}

type RateLimitStrategy_TokenBucket struct {
	// Limit the requests by consuming tokens from the Token Bucket.
	// Allow the same number of requests as the number of tokens available in
	// the token bucket.
	TokenBucket *TokenBucket `protobuf:"bytes,3,opt,name=token_bucket,json=tokenBucket,proto3,oneof"`
}

func (*RateLimitStrategy_BlanketRule_) isRateLimitStrategy_Strategy() {}

func (*RateLimitStrategy_RequestsPerTimeUnit_) isRateLimitStrategy_Strategy() {}

func (*RateLimitStrategy_TokenBucket) isRateLimitStrategy_Strategy() {}

// Best-effort limit of the number of requests per time unit.
//
// Allows to specify the desired requests per second (RPS, QPS), requests per minute (QPM, RPM),
// etc., without specifying a rate limiting algorithm implementation.
//
// “RequestsPerTimeUnit“ strategy does not demand any specific rate limiting algorithm to be
// used (in contrast to the :ref:`TokenBucket <envoy_v3_api_msg_type.v3.TokenBucket>`,
// for example). It implies that the implementation details of rate limiting algorithm are
// irrelevant as long as the configured number of "requests per time unit" is achieved.
//
// Note that the “TokenBucket“ is still a valid implementation of the “RequestsPerTimeUnit“
// strategy, and may be chosen to enforce the rate limit. However, there's no guarantee it will be
// the “TokenBucket“ in particular, and not the Leaky Bucket, the Sliding Window, or any other
// rate limiting algorithm that fulfills the requirements.
type RateLimitStrategy_RequestsPerTimeUnit struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// The desired number of requests per :ref:`time_unit
	// <envoy_v3_api_field_type.v3.RateLimitStrategy.RequestsPerTimeUnit.time_unit>` to allow.
	// If set to “0“, deny all (equivalent to “BlanketRule.DENY_ALL“).
	//
	// .. note::
	//
	//	Note that the algorithm implementation determines the course of action for the requests
	//	over the limit. As long as the ``requests_per_time_unit`` converges on the desired value,
	//	it's allowed to treat this field as a soft-limit: allow bursts, redistribute the allowance
	//	over time, etc.
	RequestsPerTimeUnit uint64 `protobuf:"varint,1,opt,name=requests_per_time_unit,json=requestsPerTimeUnit,proto3" json:"requests_per_time_unit,omitempty"`
	// The unit of time. Ignored when :ref:`requests_per_time_unit
	// <envoy_v3_api_field_type.v3.RateLimitStrategy.RequestsPerTimeUnit.requests_per_time_unit>`
	// is “0“ (deny all).
	TimeUnit      RateLimitUnit `protobuf:"varint,2,opt,name=time_unit,json=timeUnit,proto3,enum=envoy.type.v3.RateLimitUnit" json:"time_unit,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

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

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

func (*RateLimitStrategy_RequestsPerTimeUnit) ProtoMessage() {}

func (x *RateLimitStrategy_RequestsPerTimeUnit) ProtoReflect() protoreflect.Message {
	mi := &file_envoy_type_v3_ratelimit_strategy_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 RateLimitStrategy_RequestsPerTimeUnit.ProtoReflect.Descriptor instead.
func (*RateLimitStrategy_RequestsPerTimeUnit) Descriptor() ([]byte, []int) {
	return file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP(), []int{0, 0}
}

func (x *RateLimitStrategy_RequestsPerTimeUnit) GetRequestsPerTimeUnit() uint64 {
	if x != nil {
		return x.RequestsPerTimeUnit
	}
	return 0
}

func (x *RateLimitStrategy_RequestsPerTimeUnit) GetTimeUnit() RateLimitUnit {
	if x != nil {
		return x.TimeUnit
	}
	return RateLimitUnit_UNKNOWN
}

var File_envoy_type_v3_ratelimit_strategy_proto protoreflect.FileDescriptor

const file_envoy_type_v3_ratelimit_strategy_proto_rawDesc = "" +
	"\n" +
	"&envoy/type/v3/ratelimit_strategy.proto\x12\renvoy.type.v3\x1a\"envoy/type/v3/ratelimit_unit.proto\x1a envoy/type/v3/token_bucket.proto\x1a\x1fxds/annotations/v3/status.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\xed\x03\n" +
	"\x11RateLimitStrategy\x12[\n" +
	"\fblanket_rule\x18\x01 \x01(\x0e2,.envoy.type.v3.RateLimitStrategy.BlanketRuleB\b\xfaB\x05\x82\x01\x02\x10\x01H\x00R\vblanketRule\x12k\n" +
	"\x16requests_per_time_unit\x18\x02 \x01(\v24.envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnitH\x00R\x13requestsPerTimeUnit\x12?\n" +
	"\ftoken_bucket\x18\x03 \x01(\v2\x1a.envoy.type.v3.TokenBucketH\x00R\vtokenBucket\x1a\x8f\x01\n" +
	"\x13RequestsPerTimeUnit\x123\n" +
	"\x16requests_per_time_unit\x18\x01 \x01(\x04R\x13requestsPerTimeUnit\x12C\n" +
	"\ttime_unit\x18\x02 \x01(\x0e2\x1c.envoy.type.v3.RateLimitUnitB\b\xfaB\x05\x82\x01\x02\x10\x01R\btimeUnit\"*\n" +
	"\vBlanketRule\x12\r\n" +
	"\tALLOW_ALL\x10\x00\x12\f\n" +
	"\bDENY_ALL\x10\x01B\x0f\n" +
	"\bstrategy\x12\x03\xf8B\x01B\x84\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\xd2Ƥ\xe1\x06\x02\b\x01\n" +
	"\x1bio.envoyproxy.envoy.type.v3B\x16RatelimitStrategyProtoP\x01Z;github.com/envoyproxy/go-control-plane/envoy/type/v3;typev3b\x06proto3"

var (
	file_envoy_type_v3_ratelimit_strategy_proto_rawDescOnce sync.Once
	file_envoy_type_v3_ratelimit_strategy_proto_rawDescData []byte
)

func file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP() []byte {
	file_envoy_type_v3_ratelimit_strategy_proto_rawDescOnce.Do(func() {
		file_envoy_type_v3_ratelimit_strategy_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_type_v3_ratelimit_strategy_proto_rawDesc), len(file_envoy_type_v3_ratelimit_strategy_proto_rawDesc)))
	})
	return file_envoy_type_v3_ratelimit_strategy_proto_rawDescData
}

var file_envoy_type_v3_ratelimit_strategy_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_envoy_type_v3_ratelimit_strategy_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_envoy_type_v3_ratelimit_strategy_proto_goTypes = []any{
	(RateLimitStrategy_BlanketRule)(0),            // 0: envoy.type.v3.RateLimitStrategy.BlanketRule
	(*RateLimitStrategy)(nil),                     // 1: envoy.type.v3.RateLimitStrategy
	(*RateLimitStrategy_RequestsPerTimeUnit)(nil), // 2: envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnit
	(*TokenBucket)(nil),                           // 3: envoy.type.v3.TokenBucket
	(RateLimitUnit)(0),                            // 4: envoy.type.v3.RateLimitUnit
}
var file_envoy_type_v3_ratelimit_strategy_proto_depIdxs = []int32{
	0, // 0: envoy.type.v3.RateLimitStrategy.blanket_rule:type_name -> envoy.type.v3.RateLimitStrategy.BlanketRule
	2, // 1: envoy.type.v3.RateLimitStrategy.requests_per_time_unit:type_name -> envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnit
	3, // 2: envoy.type.v3.RateLimitStrategy.token_bucket:type_name -> envoy.type.v3.TokenBucket
	4, // 3: envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnit.time_unit:type_name -> envoy.type.v3.RateLimitUnit
	4, // [4:4] is the sub-list for method output_type
	4, // [4:4] is the sub-list for method input_type
	4, // [4:4] is the sub-list for extension type_name
	4, // [4:4] is the sub-list for extension extendee
	0, // [0:4] is the sub-list for field type_name
}

func init() { file_envoy_type_v3_ratelimit_strategy_proto_init() }
func file_envoy_type_v3_ratelimit_strategy_proto_init() {
	if File_envoy_type_v3_ratelimit_strategy_proto != nil {
		return
	}
	file_envoy_type_v3_ratelimit_unit_proto_init()
	file_envoy_type_v3_token_bucket_proto_init()
	file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[0].OneofWrappers = []any{
		(*RateLimitStrategy_BlanketRule_)(nil),
		(*RateLimitStrategy_RequestsPerTimeUnit_)(nil),
		(*RateLimitStrategy_TokenBucket)(nil),
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_type_v3_ratelimit_strategy_proto_rawDesc), len(file_envoy_type_v3_ratelimit_strategy_proto_rawDesc)),
			NumEnums:      1,
			NumMessages:   2,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_envoy_type_v3_ratelimit_strategy_proto_goTypes,
		DependencyIndexes: file_envoy_type_v3_ratelimit_strategy_proto_depIdxs,
		EnumInfos:         file_envoy_type_v3_ratelimit_strategy_proto_enumTypes,
		MessageInfos:      file_envoy_type_v3_ratelimit_strategy_proto_msgTypes,
	}.Build()
	File_envoy_type_v3_ratelimit_strategy_proto = out.File
	file_envoy_type_v3_ratelimit_strategy_proto_goTypes = nil
	file_envoy_type_v3_ratelimit_strategy_proto_depIdxs = nil
}
