| 1 |
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. |
| 2 |
// versions: |
| 3 |
// - protoc-gen-go-grpc v1.3.0 |
| 4 |
// - protoc v5.29.1 |
| 5 |
// source: envoy/service/ratelimit/v2/rls.proto |
| 6 |
|
| 7 |
package ratelimitv2 |
| 8 |
|
| 9 |
import ( |
| 10 |
context "context" |
| 11 |
grpc "google.golang.org/grpc" |
| 12 |
codes "google.golang.org/grpc/codes" |
| 13 |
status "google.golang.org/grpc/status" |
| 14 |
) |
| 15 |
|
| 16 |
// This is a compile-time assertion to ensure that this generated file |
| 17 |
// is compatible with the grpc package it is being compiled against. |
| 18 |
// Requires gRPC-Go v1.32.0 or later. |
| 19 |
const _ = grpc.SupportPackageIsVersion7 |
| 20 |
|
| 21 |
const ( |
| 22 |
RateLimitService_ShouldRateLimit_FullMethodName = "/envoy.service.ratelimit.v2.RateLimitService/ShouldRateLimit" |
| 23 |
) |
| 24 |
|
| 25 |
// RateLimitServiceClient is the client API for RateLimitService service. |
| 26 |
// |
| 27 |
// 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. |
| 28 |
type RateLimitServiceClient interface { |
| 29 |
// Determine whether rate limiting should take place. |
| 30 |
ShouldRateLimit(ctx context.Context, in *RateLimitRequest, opts ...grpc.CallOption) (*RateLimitResponse, error) |
| 31 |
} |
| 32 |
|
| 33 |
type rateLimitServiceClient struct { |
| 34 |
cc grpc.ClientConnInterface |
| 35 |
} |
| 36 |
|
| 37 |
func NewRateLimitServiceClient(cc grpc.ClientConnInterface) RateLimitServiceClient { |
| 38 |
return &rateLimitServiceClient{cc} |
| 39 |
} |
| 40 |
|
| 41 |
func (c *rateLimitServiceClient) ShouldRateLimit(ctx context.Context, in *RateLimitRequest, opts ...grpc.CallOption) (*RateLimitResponse, error) { |
| 42 |
out := new(RateLimitResponse) |
| 43 |
err := c.cc.Invoke(ctx, RateLimitService_ShouldRateLimit_FullMethodName, in, out, opts...) |
| 44 |
if err != nil { |
| 45 |
return nil, err |
| 46 |
} |
| 47 |
return out, nil |
| 48 |
} |
| 49 |
|
| 50 |
// RateLimitServiceServer is the server API for RateLimitService service. |
| 51 |
// All implementations should embed UnimplementedRateLimitServiceServer |
| 52 |
// for forward compatibility |
| 53 |
type RateLimitServiceServer interface { |
| 54 |
// Determine whether rate limiting should take place. |
| 55 |
ShouldRateLimit(context.Context, *RateLimitRequest) (*RateLimitResponse, error) |
| 56 |
} |
| 57 |
|
| 58 |
// UnimplementedRateLimitServiceServer should be embedded to have forward compatible implementations. |
| 59 |
type UnimplementedRateLimitServiceServer struct { |
| 60 |
} |
| 61 |
|
| 62 |
func (UnimplementedRateLimitServiceServer) ShouldRateLimit(context.Context, *RateLimitRequest) (*RateLimitResponse, error) { |
| 63 |
return nil, status.Errorf(codes.Unimplemented, "method ShouldRateLimit not implemented") |
| 64 |
} |
| 65 |
|
| 66 |
// UnsafeRateLimitServiceServer may be embedded to opt out of forward compatibility for this service. |
| 67 |
// Use of this interface is not recommended, as added methods to RateLimitServiceServer will |
| 68 |
// result in compilation errors. |
| 69 |
type UnsafeRateLimitServiceServer interface { |
| 70 |
mustEmbedUnimplementedRateLimitServiceServer() |
| 71 |
} |
| 72 |
|
| 73 |
func RegisterRateLimitServiceServer(s grpc.ServiceRegistrar, srv RateLimitServiceServer) { |
| 74 |
s.RegisterService(&RateLimitService_ServiceDesc, srv) |
| 75 |
} |
| 76 |
|
| 77 |
func _RateLimitService_ShouldRateLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| 78 |
in := new(RateLimitRequest) |
| 79 |
if err := dec(in); err != nil { |
| 80 |
return nil, err |
| 81 |
} |
| 82 |
if interceptor == nil { |
| 83 |
return srv.(RateLimitServiceServer).ShouldRateLimit(ctx, in) |
| 84 |
} |
| 85 |
info := &grpc.UnaryServerInfo{ |
| 86 |
Server: srv, |
| 87 |
FullMethod: RateLimitService_ShouldRateLimit_FullMethodName, |
| 88 |
} |
| 89 |
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| 90 |
return srv.(RateLimitServiceServer).ShouldRateLimit(ctx, req.(*RateLimitRequest)) |
| 91 |
} |
| 92 |
return interceptor(ctx, in, info, handler) |
| 93 |
} |
| 94 |
|
| 95 |
// RateLimitService_ServiceDesc is the grpc.ServiceDesc for RateLimitService service. |
| 96 |
// It's only intended for direct use with grpc.RegisterService, |
| 97 |
// and not to be introspected or modified (even as a copy) |
| 98 |
var RateLimitService_ServiceDesc = grpc.ServiceDesc{ |
| 99 |
ServiceName: "envoy.service.ratelimit.v2.RateLimitService", |
| 100 |
HandlerType: (*RateLimitServiceServer)(nil), |
| 101 |
Methods: []grpc.MethodDesc{ |
| 102 |
{ |
| 103 |
MethodName: "ShouldRateLimit", |
| 104 |
Handler: _RateLimitService_ShouldRateLimit_Handler, |
| 105 |
}, |
| 106 |
}, |
| 107 |
Streams: []grpc.StreamDesc{}, |
| 108 |
Metadata: "envoy/service/ratelimit/v2/rls.proto", |
| 109 |
} |