ratelimit

package
v0.0.0-...-d225e58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RateLimit_Unit_name = map[int32]string{
		0: "UNKNOWN",
		1: "SECOND",
		2: "MINUTE",
		3: "HOUR",
		4: "DAY",
	}
	RateLimit_Unit_value = map[string]int32{
		"UNKNOWN": 0,
		"SECOND":  1,
		"MINUTE":  2,
		"HOUR":    3,
		"DAY":     4,
	}
)

Enum value maps for RateLimit_Unit.

View Source
var (
	// See `ServiceOptionsRateLimits`.
	//
	// optional s12.protobuf.ratelimit.ServiceOptionsRateLimits api_limit = 50007;
	E_ApiLimit = &file_s12_protobuf_ratelimit_annotations_proto_extTypes[1]
)

Extension fields to descriptorpb.ServiceOptions.

View Source
var (
	// See `MethodOptionsRateLimits`.
	//
	// optional s12.protobuf.ratelimit.MethodOptionsRateLimits limit = 50006;
	E_Limit = &file_s12_protobuf_ratelimit_annotations_proto_extTypes[0]
)

Extension fields to descriptorpb.MethodOptions.

View Source
var File_s12_protobuf_ratelimit_annotations_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type MethodOptionsRateLimits

type MethodOptionsRateLimits struct {

	// Rate limits to apply to this method.
	// Cannot be used with `bucket`.
	Limits map[string]*RateLimit `` /* 153-byte string literal not displayed */
	// Bucket to apply to this method, if multiple methods/services need to be rate limited together.
	// Cannot be used with `limits`.
	Bucket string `protobuf:"bytes,2,opt,name=bucket,proto3" json:"bucket,omitempty"`
	// contains filtered or unexported fields
}

MethodOptionsRateLimits are the rate limiting options for a method.

func (*MethodOptionsRateLimits) Descriptor deprecated

func (*MethodOptionsRateLimits) Descriptor() ([]byte, []int)

Deprecated: Use MethodOptionsRateLimits.ProtoReflect.Descriptor instead.

func (*MethodOptionsRateLimits) GetBucket

func (x *MethodOptionsRateLimits) GetBucket() string

func (*MethodOptionsRateLimits) GetLimits

func (x *MethodOptionsRateLimits) GetLimits() map[string]*RateLimit

func (*MethodOptionsRateLimits) ProtoMessage

func (*MethodOptionsRateLimits) ProtoMessage()

func (*MethodOptionsRateLimits) ProtoReflect

func (x *MethodOptionsRateLimits) ProtoReflect() protoreflect.Message

func (*MethodOptionsRateLimits) Reset

func (x *MethodOptionsRateLimits) Reset()

func (*MethodOptionsRateLimits) String

func (x *MethodOptionsRateLimits) String() string

type RateLimit

type RateLimit struct {

	// The unit of time.
	Unit string `protobuf:"bytes,1,opt,name=unit,proto3" json:"unit,omitempty"`
	// The number of requests per unit of time.
	RequestsPerUnit int64 `protobuf:"varint,2,opt,name=requests_per_unit,json=requestsPerUnit,proto3" json:"requests_per_unit,omitempty"`
	// If this limit should be unlimited.
	Unlimited bool `protobuf:"varint,3,opt,name=unlimited,proto3" json:"unlimited,omitempty"`
	// contains filtered or unexported fields
}

Defines an actual rate limit in terms of requests per unit of time and the unit itself.

func (*RateLimit) Descriptor deprecated

func (*RateLimit) Descriptor() ([]byte, []int)

Deprecated: Use RateLimit.ProtoReflect.Descriptor instead.

func (*RateLimit) GetRequestsPerUnit

func (x *RateLimit) GetRequestsPerUnit() int64

func (*RateLimit) GetUnit

func (x *RateLimit) GetUnit() string

func (*RateLimit) GetUnlimited

func (x *RateLimit) GetUnlimited() bool

func (*RateLimit) ProtoMessage

func (*RateLimit) ProtoMessage()

func (*RateLimit) ProtoReflect

func (x *RateLimit) ProtoReflect() protoreflect.Message

func (*RateLimit) Reset

func (x *RateLimit) Reset()

func (*RateLimit) String

func (x *RateLimit) String() string

type RateLimit_Unit

type RateLimit_Unit int32
const (
	// The time unit is not known.
	RateLimit_UNKNOWN RateLimit_Unit = 0
	// The time unit representing a second.
	RateLimit_SECOND RateLimit_Unit = 1
	// The time unit representing a minute.
	RateLimit_MINUTE RateLimit_Unit = 2
	// The time unit representing an hour.
	RateLimit_HOUR RateLimit_Unit = 3
	// The time unit representing a day.
	RateLimit_DAY RateLimit_Unit = 4
)

func (RateLimit_Unit) Descriptor

func (RateLimit_Unit) Enum

func (x RateLimit_Unit) Enum() *RateLimit_Unit

func (RateLimit_Unit) EnumDescriptor deprecated

func (RateLimit_Unit) EnumDescriptor() ([]byte, []int)

Deprecated: Use RateLimit_Unit.Descriptor instead.

func (RateLimit_Unit) Number

func (RateLimit_Unit) String

func (x RateLimit_Unit) String() string

func (RateLimit_Unit) Type

type ServiceOptionsRateLimits

type ServiceOptionsRateLimits struct {

	// Rate limits to apply to this service.
	// Cannot be used with `bucket`.
	Limits map[string]*RateLimit `` /* 153-byte string literal not displayed */
	// Bucket to apply to this service, if multiple methods/services need to be rate limited together.
	// Cannot be used with `limits`.
	Bucket string `protobuf:"bytes,2,opt,name=bucket,proto3" json:"bucket,omitempty"`
	// contains filtered or unexported fields
}

func (*ServiceOptionsRateLimits) Descriptor deprecated

func (*ServiceOptionsRateLimits) Descriptor() ([]byte, []int)

Deprecated: Use ServiceOptionsRateLimits.ProtoReflect.Descriptor instead.

func (*ServiceOptionsRateLimits) GetBucket

func (x *ServiceOptionsRateLimits) GetBucket() string

func (*ServiceOptionsRateLimits) GetLimits

func (x *ServiceOptionsRateLimits) GetLimits() map[string]*RateLimit

func (*ServiceOptionsRateLimits) ProtoMessage

func (*ServiceOptionsRateLimits) ProtoMessage()

func (*ServiceOptionsRateLimits) ProtoReflect

func (x *ServiceOptionsRateLimits) ProtoReflect() protoreflect.Message

func (*ServiceOptionsRateLimits) Reset

func (x *ServiceOptionsRateLimits) Reset()

func (*ServiceOptionsRateLimits) String

func (x *ServiceOptionsRateLimits) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL