rate_limit_quotav3

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RateLimitQuotaService_StreamRateLimitQuotas_FullMethodName = "/envoy.service.rate_limit_quota.v3.RateLimitQuotaService/StreamRateLimitQuotas"
)

Variables

View Source
var File_envoy_service_rate_limit_quota_v3_rlqs_proto protoreflect.FileDescriptor
View Source
var RateLimitQuotaService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "envoy.service.rate_limit_quota.v3.RateLimitQuotaService",
	HandlerType: (*RateLimitQuotaServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamRateLimitQuotas",
			Handler:       _RateLimitQuotaService_StreamRateLimitQuotas_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "envoy/service/rate_limit_quota/v3/rlqs.proto",
}

RateLimitQuotaService_ServiceDesc is the grpc.ServiceDesc for RateLimitQuotaService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterRateLimitQuotaServiceServer

func RegisterRateLimitQuotaServiceServer(s grpc.ServiceRegistrar, srv RateLimitQuotaServiceServer)

Types

type BucketId

type BucketId struct {
	Bucket map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

The identifier for the bucket. Used to match the bucket between the control plane (RLQS server), and the data plane (RLQS client), f.e.:

  • the data plane sends a usage report for requests matched into the bucket with “BucketId“ to the control plane
  • the control plane sends an assignment for the bucket with “BucketId“ to the data plane Bucket ID.

Example:

.. validated-code-block:: yaml

:type-name: envoy.service.rate_limit_quota.v3.BucketId

bucket:
  name: my_bucket
  env: staging

.. note::

The order of ``BucketId`` keys do not matter. Buckets ``{ a: 'A', b: 'B' }`` and
``{ b: 'B', a: 'A' }`` are identical.

func (*BucketId) Descriptor deprecated

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

Deprecated: Use BucketId.ProtoReflect.Descriptor instead.

func (*BucketId) GetBucket

func (x *BucketId) GetBucket() map[string]string

func (*BucketId) ProtoMessage

func (*BucketId) ProtoMessage()

func (*BucketId) ProtoReflect

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

func (*BucketId) Reset

func (x *BucketId) Reset()

func (*BucketId) String

func (x *BucketId) String() string

type RateLimitQuotaResponse

type RateLimitQuotaResponse struct {

	// An ordered list of actions to be applied to the buckets. The actions are applied in the
	// given order, from top to bottom.
	BucketAction []*RateLimitQuotaResponse_BucketAction `protobuf:"bytes,1,rep,name=bucket_action,json=bucketAction,proto3" json:"bucket_action,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimitQuotaResponse) Descriptor deprecated

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

Deprecated: Use RateLimitQuotaResponse.ProtoReflect.Descriptor instead.

func (*RateLimitQuotaResponse) GetBucketAction

func (*RateLimitQuotaResponse) ProtoMessage

func (*RateLimitQuotaResponse) ProtoMessage()

func (*RateLimitQuotaResponse) ProtoReflect

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

func (*RateLimitQuotaResponse) Reset

func (x *RateLimitQuotaResponse) Reset()

func (*RateLimitQuotaResponse) String

func (x *RateLimitQuotaResponse) String() string

type RateLimitQuotaResponse_BucketAction

type RateLimitQuotaResponse_BucketAction struct {

	// “BucketId“ for which request the action is applied.
	BucketId *BucketId `protobuf:"bytes,1,opt,name=bucket_id,json=bucketId,proto3" json:"bucket_id,omitempty"`
	// Types that are assignable to BucketAction:
	//
	//	*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction_
	//	*RateLimitQuotaResponse_BucketAction_AbandonAction_
	BucketAction isRateLimitQuotaResponse_BucketAction_BucketAction `protobuf_oneof:"bucket_action"`
	// contains filtered or unexported fields
}

Commands the data plane to apply one of the actions to the bucket with the :ref:`bucket_id <envoy_v3_api_field_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.bucket_id>`.

func (*RateLimitQuotaResponse_BucketAction) Descriptor deprecated

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

Deprecated: Use RateLimitQuotaResponse_BucketAction.ProtoReflect.Descriptor instead.

func (*RateLimitQuotaResponse_BucketAction) GetAbandonAction

func (*RateLimitQuotaResponse_BucketAction) GetBucketAction

func (m *RateLimitQuotaResponse_BucketAction) GetBucketAction() isRateLimitQuotaResponse_BucketAction_BucketAction

func (*RateLimitQuotaResponse_BucketAction) GetBucketId

func (*RateLimitQuotaResponse_BucketAction) GetQuotaAssignmentAction

func (*RateLimitQuotaResponse_BucketAction) ProtoMessage

func (*RateLimitQuotaResponse_BucketAction) ProtoMessage()

func (*RateLimitQuotaResponse_BucketAction) ProtoReflect

func (*RateLimitQuotaResponse_BucketAction) Reset

func (*RateLimitQuotaResponse_BucketAction) String

type RateLimitQuotaResponse_BucketAction_AbandonAction

type RateLimitQuotaResponse_BucketAction_AbandonAction struct {
	// contains filtered or unexported fields
}

Abandon action for the bucket. Indicates that the RLQS server will no longer be sending updates for the given :ref:`bucket_id <envoy_v3_api_field_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.bucket_id>`.

If no requests are reported for a bucket, after some time the server considers the bucket inactive. The server stops tracking the bucket, and instructs the the data plane to abandon the bucket via this message.

**Abandoning the assignment**

The data plane is to erase the bucket (including its usage data) from the memory. It should stop tracking the bucket, and stop reporting its usage. This effectively resets the data plane to the state prior to matching the first request into the bucket.

**Restarting the subscription**

If a new request is matched into a bucket previously abandoned, the data plane must behave as if it has never tracked the bucket, and it's the first request matched into it:

  1. The process of :ref:`subscription and reporting <envoy_v3_api_field_extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings.reporting_interval>` starts from the beginning.

  2. The bucket transitions to the :ref:`"no assignment" <envoy_v3_api_field_extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings.no_assignment_behavior>` state.

  3. Once the new assignment is received, it's applied per "Applying the first assignment to the bucket" section of the :ref:`QuotaAssignmentAction <envoy_v3_api_msg_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction>`.

func (*RateLimitQuotaResponse_BucketAction_AbandonAction) Descriptor deprecated

Deprecated: Use RateLimitQuotaResponse_BucketAction_AbandonAction.ProtoReflect.Descriptor instead.

func (*RateLimitQuotaResponse_BucketAction_AbandonAction) ProtoMessage

func (*RateLimitQuotaResponse_BucketAction_AbandonAction) ProtoReflect

func (*RateLimitQuotaResponse_BucketAction_AbandonAction) Reset

func (*RateLimitQuotaResponse_BucketAction_AbandonAction) String

type RateLimitQuotaResponse_BucketAction_AbandonAction_

type RateLimitQuotaResponse_BucketAction_AbandonAction_ struct {
	// Abandon the bucket.
	//
	// Commands the data plane to abandon the bucket.
	// The process of abandoning the bucket is described in the :ref:`AbandonAction
	// <envoy_v3_api_msg_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.AbandonAction>`
	// message.
	AbandonAction *RateLimitQuotaResponse_BucketAction_AbandonAction `protobuf:"bytes,3,opt,name=abandon_action,json=abandonAction,proto3,oneof"`
}

type RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction

type RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction struct {

	// A duration after which the assignment is be considered “expired“. The process of the
	// expiration is described :ref:`above
	// <envoy_v3_api_msg_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction>`.
	//
	//   - If unset, the assignment has no expiration date.
	//   - If set to “0“, the assignment expires immediately, forcing the client into the
	//     :ref:`"expired assignment"
	//     <envoy_v3_api_field_extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings.ExpiredAssignmentBehavior.expired_assignment_behavior_timeout>`
	//     state. This may be used by the RLQS server in cases when it needs clients to proactively
	//     fall back to the pre-configured :ref:`ExpiredAssignmentBehavior
	//     <envoy_v3_api_msg_extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings.ExpiredAssignmentBehavior>`,
	//     f.e. before the server going into restart.
	//
	// .. attention::
	//
	//	Note that :ref:`expiring
	//	<envoy_v3_api_msg_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction>`
	//	the assignment is not the same as :ref:`abandoning
	//	<envoy_v3_api_msg_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.AbandonAction>`
	//	the assignment. While expiring the assignment just transitions the bucket to
	//	the "expired assignment" state; abandoning the assignment completely erases
	//	the bucket from the data plane memory, and stops the usage reports.
	AssignmentTimeToLive *durationpb.Duration `protobuf:"bytes,2,opt,name=assignment_time_to_live,json=assignmentTimeToLive,proto3" json:"assignment_time_to_live,omitempty"`
	// Configures the local rate limiter for the request matched to the bucket.
	// If not set, allow all requests.
	RateLimitStrategy *v3.RateLimitStrategy `protobuf:"bytes,3,opt,name=rate_limit_strategy,json=rateLimitStrategy,proto3" json:"rate_limit_strategy,omitempty"`
	// contains filtered or unexported fields
}

Quota assignment for the bucket. Configures the rate limiting strategy and the duration for the given :ref:`bucket_id <envoy_v3_api_field_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.bucket_id>`.

**Applying the first assignment to the bucket**

Once the data plane receives the “QuotaAssignmentAction“, it must send the current usage report for the bucket, and start rate limiting requests matched into the bucket using the strategy configured in the :ref:`rate_limit_strategy <envoy_v3_api_field_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction.rate_limit_strategy>` field. The assignment becomes bucket's “active“ assignment.

**Expiring the assignment**

The duration of the assignment defined in the :ref:`assignment_time_to_live <envoy_v3_api_field_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction.assignment_time_to_live>` field. When the duration runs off, the assignment is “expired“, and no longer “active“. The data plane should stop applying the rate limiting strategy to the bucket, and transition the bucket to the "expired assignment" state. This activates the behavior configured in the :ref:`expired_assignment_behavior <envoy_v3_api_field_extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings.expired_assignment_behavior>` field.

**Replacing the assignment**

  • If the rate limiting strategy is different from bucket's “active“ assignment, or the current bucket assignment is “expired“, the data plane must immediately end the current assignment, report the bucket usage, and apply the new assignment. The new assignment becomes bucket's “active“ assignment.
  • If the rate limiting strategy is the same as the bucket's “active“ (not “expired“) assignment, the data plane should extend the duration of the “active“ assignment for the duration of the new assignment provided in the :ref:`assignment_time_to_live <envoy_v3_api_field_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction.assignment_time_to_live>` field. The “active“ assignment is considered unchanged.

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) Descriptor deprecated

Deprecated: Use RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction.ProtoReflect.Descriptor instead.

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) GetAssignmentTimeToLive

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) GetRateLimitStrategy

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) ProtoMessage

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) ProtoReflect

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) Reset

func (*RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) String

type RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction_

type RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction_ struct {
	// Apply the quota assignment to the bucket.
	//
	// Commands the data plane to apply a rate limiting strategy to the bucket.
	// The process of applying and expiring the rate limiting strategy is detailed in the
	// :ref:`QuotaAssignmentAction
	// <envoy_v3_api_msg_service.rate_limit_quota.v3.RateLimitQuotaResponse.BucketAction.QuotaAssignmentAction>`
	// message.
	QuotaAssignmentAction *RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction `protobuf:"bytes,2,opt,name=quota_assignment_action,json=quotaAssignmentAction,proto3,oneof"`
}

type RateLimitQuotaServiceClient

type RateLimitQuotaServiceClient interface {
	// Main communication channel: the data plane sends usage reports to the RLQS server,
	// and the server asynchronously responding with the assignments.
	StreamRateLimitQuotas(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[RateLimitQuotaUsageReports, RateLimitQuotaResponse], error)
}

RateLimitQuotaServiceClient is the client API for RateLimitQuotaService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

Defines the Rate Limit Quota Service (RLQS).

type RateLimitQuotaServiceServer

type RateLimitQuotaServiceServer interface {
	// Main communication channel: the data plane sends usage reports to the RLQS server,
	// and the server asynchronously responding with the assignments.
	StreamRateLimitQuotas(grpc.BidiStreamingServer[RateLimitQuotaUsageReports, RateLimitQuotaResponse]) error
	// contains filtered or unexported methods
}

RateLimitQuotaServiceServer is the server API for RateLimitQuotaService service. All implementations must embed UnimplementedRateLimitQuotaServiceServer for forward compatibility.

Defines the Rate Limit Quota Service (RLQS).

type RateLimitQuotaService_StreamRateLimitQuotasClient

type RateLimitQuotaService_StreamRateLimitQuotasClient = grpc.BidiStreamingClient[RateLimitQuotaUsageReports, RateLimitQuotaResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type RateLimitQuotaService_StreamRateLimitQuotasServer

type RateLimitQuotaService_StreamRateLimitQuotasServer = grpc.BidiStreamingServer[RateLimitQuotaUsageReports, RateLimitQuotaResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type RateLimitQuotaUsageReports

type RateLimitQuotaUsageReports struct {

	// All quota requests must specify the domain. This enables sharing the quota
	// server between different applications without fear of overlap.
	// E.g., "envoy".
	//
	// Should only be provided in the first report, all subsequent messages on the same
	// stream are considered to be in the same domain. In case the domain needs to be
	// changes, close the stream, and reopen a new one with the different domain.
	Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"`
	// A list of quota usage reports. The list is processed by the RLQS server in the same order
	// it's provided by the client.
	BucketQuotaUsages []*RateLimitQuotaUsageReports_BucketQuotaUsage `protobuf:"bytes,2,rep,name=bucket_quota_usages,json=bucketQuotaUsages,proto3" json:"bucket_quota_usages,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimitQuotaUsageReports) Descriptor deprecated

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

Deprecated: Use RateLimitQuotaUsageReports.ProtoReflect.Descriptor instead.

func (*RateLimitQuotaUsageReports) GetBucketQuotaUsages

func (*RateLimitQuotaUsageReports) GetDomain

func (x *RateLimitQuotaUsageReports) GetDomain() string

func (*RateLimitQuotaUsageReports) ProtoMessage

func (*RateLimitQuotaUsageReports) ProtoMessage()

func (*RateLimitQuotaUsageReports) ProtoReflect

func (*RateLimitQuotaUsageReports) Reset

func (x *RateLimitQuotaUsageReports) Reset()

func (*RateLimitQuotaUsageReports) String

func (x *RateLimitQuotaUsageReports) String() string

type RateLimitQuotaUsageReports_BucketQuotaUsage

type RateLimitQuotaUsageReports_BucketQuotaUsage struct {

	// “BucketId“ for which request quota usage is reported.
	BucketId *BucketId `protobuf:"bytes,1,opt,name=bucket_id,json=bucketId,proto3" json:"bucket_id,omitempty"`
	// Time elapsed since the last report.
	TimeElapsed *durationpb.Duration `protobuf:"bytes,2,opt,name=time_elapsed,json=timeElapsed,proto3" json:"time_elapsed,omitempty"`
	// Requests the data plane has allowed through.
	NumRequestsAllowed uint64 `protobuf:"varint,3,opt,name=num_requests_allowed,json=numRequestsAllowed,proto3" json:"num_requests_allowed,omitempty"`
	// Requests throttled.
	NumRequestsDenied uint64 `protobuf:"varint,4,opt,name=num_requests_denied,json=numRequestsDenied,proto3" json:"num_requests_denied,omitempty"`
	// contains filtered or unexported fields
}

The usage report for a bucket.

.. note::

Note that the first report sent for a ``BucketId`` indicates to the RLQS server that
the RLQS client is subscribing for the future assignments for this ``BucketId``.

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) Descriptor deprecated

Deprecated: Use RateLimitQuotaUsageReports_BucketQuotaUsage.ProtoReflect.Descriptor instead.

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) GetBucketId

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) GetNumRequestsAllowed

func (x *RateLimitQuotaUsageReports_BucketQuotaUsage) GetNumRequestsAllowed() uint64

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) GetNumRequestsDenied

func (x *RateLimitQuotaUsageReports_BucketQuotaUsage) GetNumRequestsDenied() uint64

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) GetTimeElapsed

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) ProtoMessage

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) ProtoReflect

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) Reset

func (*RateLimitQuotaUsageReports_BucketQuotaUsage) String

type UnimplementedRateLimitQuotaServiceServer

type UnimplementedRateLimitQuotaServiceServer struct{}

UnimplementedRateLimitQuotaServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

type UnsafeRateLimitQuotaServiceServer

type UnsafeRateLimitQuotaServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeRateLimitQuotaServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RateLimitQuotaServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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