Skip to content

Commit

Permalink
xds: Import RLQS protos (#11418)
Browse files Browse the repository at this point in the history
Imports the protos of Rate Limiting Quota Service (RLQS) and Rate
Limit Quota HTTP Filter.

Note: the list below only shows the new top-level protos, and excludes
their direct and transitional dependencies (those from import
statements).

#### RLQS Imports
- Service — envoy/service/rate_limit_quota/v3/rlqs.proto
  (Service): 7b8a304
- HTTP Filter —
  envoy/extensions/filters/http/rate_limit_quota/v3/rate_limit_quota.proto:
  49c77c4

#### CEL Imports
- Initial third-party repo setup: 99a64bd
- Parsed CEL Expression: cel/expr/syntax.proto: 99a64bd
- Parsed and type-checked CEL Expression: cel/expr/checked.proto:
  99a64bd


#### Required typed_config extensions
##### `bucket_matchers` predicate input
- `HttpAttributesCelMatchInput` —
  xds/type/matcher/v3/http_inputs.proto: 54924e0
- `HttpRequestHeaderMatchInput` —
  envoy/type/matcher/v3/http_inputs.proto: 49c77c4

##### `bucket_matchers` predicate custom_match
- `CelMatcher` — xds/type/matcher/v3/cel.proto: 54924e0
  • Loading branch information
sergiitk authored Aug 2, 2024
1 parent 0013609 commit c29763d
Show file tree
Hide file tree
Showing 18 changed files with 2,503 additions and 0 deletions.
3 changes: 3 additions & 0 deletions xds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sourceSets {
srcDir 'third_party/envoy/src/main/proto'
srcDir 'third_party/protoc-gen-validate/src/main/proto'
srcDir 'third_party/xds/src/main/proto'
srcDir 'third_party/cel-spec/src/main/proto'
srcDir 'third_party/googleapis/src/main/proto'
srcDir 'third_party/istio/src/main/proto'
}
Expand Down Expand Up @@ -185,6 +186,7 @@ tasks.named("shadowJar").configure {
relocate 'com.google.api.expr', "${prefixName}.shaded.com.google.api.expr"
relocate 'com.google.security', "${prefixName}.shaded.com.google.security"
// TODO: missing java_package option in .proto
relocate 'dev.cel.expr', "${prefixName}.shaded.dev.cel.expr"
relocate 'envoy.annotations', "${prefixName}.shaded.envoy.annotations"
relocate 'io.envoyproxy', "${prefixName}.shaded.io.envoyproxy"
relocate 'io.grpc.netty', 'io.grpc.netty.shaded.io.grpc.netty'
Expand Down Expand Up @@ -212,6 +214,7 @@ tasks.named("jacocoTestReport").configure {
'**/com/github/xds/**',
'**/com/google/api/expr/**',
'**/com/google/security/**',
'**/cel/expr/**',
'**/envoy/annotations/**',
'**/io/envoyproxy/**',
'**/udpa/annotations/**',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
package io.envoyproxy.envoy.service.rate_limit_quota.v3;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
* <pre>
* Defines the Rate Limit Quota Service (RLQS).
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: envoy/service/rate_limit_quota/v3/rlqs.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class RateLimitQuotaServiceGrpc {

private RateLimitQuotaServiceGrpc() {}

public static final java.lang.String SERVICE_NAME = "envoy.service.rate_limit_quota.v3.RateLimitQuotaService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports,
io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse> getStreamRateLimitQuotasMethod;

@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "StreamRateLimitQuotas",
requestType = io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports.class,
responseType = io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports,
io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse> getStreamRateLimitQuotasMethod() {
io.grpc.MethodDescriptor<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports, io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse> getStreamRateLimitQuotasMethod;
if ((getStreamRateLimitQuotasMethod = RateLimitQuotaServiceGrpc.getStreamRateLimitQuotasMethod) == null) {
synchronized (RateLimitQuotaServiceGrpc.class) {
if ((getStreamRateLimitQuotasMethod = RateLimitQuotaServiceGrpc.getStreamRateLimitQuotasMethod) == null) {
RateLimitQuotaServiceGrpc.getStreamRateLimitQuotasMethod = getStreamRateLimitQuotasMethod =
io.grpc.MethodDescriptor.<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports, io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamRateLimitQuotas"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse.getDefaultInstance()))
.setSchemaDescriptor(new RateLimitQuotaServiceMethodDescriptorSupplier("StreamRateLimitQuotas"))
.build();
}
}
}
return getStreamRateLimitQuotasMethod;
}

/**
* Creates a new async stub that supports all call types for the service
*/
public static RateLimitQuotaServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceStub>() {
@java.lang.Override
public RateLimitQuotaServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new RateLimitQuotaServiceStub(channel, callOptions);
}
};
return RateLimitQuotaServiceStub.newStub(factory, channel);
}

/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static RateLimitQuotaServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceBlockingStub>() {
@java.lang.Override
public RateLimitQuotaServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new RateLimitQuotaServiceBlockingStub(channel, callOptions);
}
};
return RateLimitQuotaServiceBlockingStub.newStub(factory, channel);
}

/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static RateLimitQuotaServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceFutureStub>() {
@java.lang.Override
public RateLimitQuotaServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new RateLimitQuotaServiceFutureStub(channel, callOptions);
}
};
return RateLimitQuotaServiceFutureStub.newStub(factory, channel);
}

/**
* <pre>
* Defines the Rate Limit Quota Service (RLQS).
* </pre>
*/
public interface AsyncService {

/**
* <pre>
* Main communication channel: the data plane sends usage reports to the RLQS server,
* and the server asynchronously responding with the assignments.
* </pre>
*/
default io.grpc.stub.StreamObserver<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports> streamRateLimitQuotas(
io.grpc.stub.StreamObserver<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse> responseObserver) {
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamRateLimitQuotasMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service RateLimitQuotaService.
* <pre>
* Defines the Rate Limit Quota Service (RLQS).
* </pre>
*/
public static abstract class RateLimitQuotaServiceImplBase
implements io.grpc.BindableService, AsyncService {

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return RateLimitQuotaServiceGrpc.bindService(this);
}
}

/**
* A stub to allow clients to do asynchronous rpc calls to service RateLimitQuotaService.
* <pre>
* Defines the Rate Limit Quota Service (RLQS).
* </pre>
*/
public static final class RateLimitQuotaServiceStub
extends io.grpc.stub.AbstractAsyncStub<RateLimitQuotaServiceStub> {
private RateLimitQuotaServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}

@java.lang.Override
protected RateLimitQuotaServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new RateLimitQuotaServiceStub(channel, callOptions);
}

/**
* <pre>
* Main communication channel: the data plane sends usage reports to the RLQS server,
* and the server asynchronously responding with the assignments.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports> streamRateLimitQuotas(
io.grpc.stub.StreamObserver<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse> responseObserver) {
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
getChannel().newCall(getStreamRateLimitQuotasMethod(), getCallOptions()), responseObserver);
}
}

/**
* A stub to allow clients to do synchronous rpc calls to service RateLimitQuotaService.
* <pre>
* Defines the Rate Limit Quota Service (RLQS).
* </pre>
*/
public static final class RateLimitQuotaServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub<RateLimitQuotaServiceBlockingStub> {
private RateLimitQuotaServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}

@java.lang.Override
protected RateLimitQuotaServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new RateLimitQuotaServiceBlockingStub(channel, callOptions);
}
}

/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service RateLimitQuotaService.
* <pre>
* Defines the Rate Limit Quota Service (RLQS).
* </pre>
*/
public static final class RateLimitQuotaServiceFutureStub
extends io.grpc.stub.AbstractFutureStub<RateLimitQuotaServiceFutureStub> {
private RateLimitQuotaServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}

@java.lang.Override
protected RateLimitQuotaServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new RateLimitQuotaServiceFutureStub(channel, callOptions);
}
}

private static final int METHODID_STREAM_RATE_LIMIT_QUOTAS = 0;

private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}

@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}

@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_STREAM_RATE_LIMIT_QUOTAS:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamRateLimitQuotas(
(io.grpc.stub.StreamObserver<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse>) responseObserver);
default:
throw new AssertionError();
}
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getStreamRateLimitQuotasMethod(),
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
new MethodHandlers<
io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports,
io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse>(
service, METHODID_STREAM_RATE_LIMIT_QUOTAS)))
.build();
}

private static abstract class RateLimitQuotaServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
RateLimitQuotaServiceBaseDescriptorSupplier() {}

@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.envoyproxy.envoy.service.rate_limit_quota.v3.RlqsProto.getDescriptor();
}

@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("RateLimitQuotaService");
}
}

private static final class RateLimitQuotaServiceFileDescriptorSupplier
extends RateLimitQuotaServiceBaseDescriptorSupplier {
RateLimitQuotaServiceFileDescriptorSupplier() {}
}

private static final class RateLimitQuotaServiceMethodDescriptorSupplier
extends RateLimitQuotaServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final java.lang.String methodName;

RateLimitQuotaServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}

private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (RateLimitQuotaServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new RateLimitQuotaServiceFileDescriptorSupplier())
.addMethod(getStreamRateLimitQuotasMethod())
.build();
}
}
}
return result;
}
}
Loading

0 comments on commit c29763d

Please sign in to comment.