diff --git a/pkg/cache/types/types.go b/pkg/cache/types/types.go index 80cbdb620a..b99aacb84f 100644 --- a/pkg/cache/types/types.go +++ b/pkg/cache/types/types.go @@ -48,5 +48,6 @@ const ( Secret Runtime ExtensionConfig + RateLimitConfig UnknownType // token to count the total number of supported types ) diff --git a/pkg/cache/v3/resource.go b/pkg/cache/v3/resource.go index 386595757d..ea57e4714a 100644 --- a/pkg/cache/v3/resource.go +++ b/pkg/cache/v3/resource.go @@ -30,6 +30,7 @@ import ( runtime "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" "github.com/envoyproxy/go-control-plane/pkg/cache/types" "github.com/envoyproxy/go-control-plane/pkg/resource/v3" + ratelimit "github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3" ) // GetResponseType returns the enumeration for a valid xDS type URL. @@ -53,6 +54,8 @@ func GetResponseType(typeURL resource.Type) types.ResponseType { return types.Runtime case resource.ExtensionConfigType: return types.ExtensionConfig + case resource.RateLimitConfigType: + return types.RateLimitConfig } return types.UnknownType } @@ -78,6 +81,8 @@ func GetResponseTypeURL(responseType types.ResponseType) (string, error) { return resource.RuntimeType, nil case types.ExtensionConfig: return resource.ExtensionConfigType, nil + case types.RateLimitConfig: + return resource.RateLimitConfigType, nil default: return "", fmt.Errorf("couldn't map response type %v to known resource type", responseType) } @@ -104,6 +109,8 @@ func GetResourceName(res types.Resource) string { return v.GetName() case *core.TypedExtensionConfig: return v.GetName() + case *ratelimit.RateLimitConfig: + return v.GetName() case types.ResourceWithName: return v.GetName() default: diff --git a/pkg/resource/v3/resource.go b/pkg/resource/v3/resource.go index 6bc33ec0f6..6bf09d8b64 100644 --- a/pkg/resource/v3/resource.go +++ b/pkg/resource/v3/resource.go @@ -26,6 +26,9 @@ const ( RuntimeType = APITypePrefix + "envoy.service.runtime.v3.Runtime" ThriftRouteType = APITypePrefix + "envoy.extensions.filters.network.thrift_proxy.v3.RouteConfiguration" + // Rate Limit service + RateLimitConfigType = APITypePrefix + "ratelimit.config.ratelimit.v3.RateLimitConfig" + // AnyType is used only by ADS AnyType = "" ) diff --git a/pkg/server/v3/server.go b/pkg/server/v3/server.go index ed0b0cb6be..79b66881c4 100644 --- a/pkg/server/v3/server.go +++ b/pkg/server/v3/server.go @@ -38,6 +38,7 @@ import ( secretservice "github.com/envoyproxy/go-control-plane/envoy/service/secret/v3" "github.com/envoyproxy/go-control-plane/pkg/cache/v3" "github.com/envoyproxy/go-control-plane/pkg/resource/v3" + rlsconfigservice "github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3" ) // Server is a collection of handlers for streaming discovery requests. @@ -52,6 +53,7 @@ type Server interface { secretservice.SecretDiscoveryServiceServer runtimeservice.RuntimeDiscoveryServiceServer extensionconfigservice.ExtensionConfigDiscoveryServiceServer + rlsconfigservice.RateLimitConfigDiscoveryServiceServer rest.Server sotw.Server @@ -220,6 +222,10 @@ func (s *server) StreamExtensionConfigs(stream extensionconfigservice.ExtensionC return s.StreamHandler(stream, resource.ExtensionConfigType) } +func (s *server) StreamRlsConfigs(stream rlsconfigservice.RateLimitConfigDiscoveryService_StreamRlsConfigsServer) error { + return s.StreamHandler(stream, resource.RateLimitConfigType) +} + // VHDS doesn't support SOTW requests, so no handler for it exists. // Fetch is the universal fetch method. @@ -291,6 +297,14 @@ func (s *server) FetchExtensionConfigs(ctx context.Context, req *discovery.Disco return s.Fetch(ctx, req) } +func (s *server) FetchRlsConfigs(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { + if req == nil { + return nil, status.Errorf(codes.Unavailable, "empty request") + } + req.TypeUrl = resource.RateLimitConfigType + return s.Fetch(ctx, req) +} + // VHDS doesn't support REST requests, so no handler exists for this. func (s *server) DeltaStreamHandler(stream stream.DeltaStream, typeURL string) error { diff --git a/ratelimit/config/ratelimit/v3/rls_conf.pb.go b/ratelimit/config/ratelimit/v3/rls_conf.pb.go new file mode 100644 index 0000000000..a04e8852de --- /dev/null +++ b/ratelimit/config/ratelimit/v3/rls_conf.pb.go @@ -0,0 +1,551 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0-devel +// protoc v3.13.0 +// source: ratelimit/config/ratelimit/v3/rls_conf.proto + +package ratelimitv3 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// Identifies the unit of of time for rate limit. +type RateLimitUnit int32 + +const ( + // The time unit is not known. + RateLimitUnit_UNKNOWN RateLimitUnit = 0 + // The time unit representing a second. + RateLimitUnit_SECOND RateLimitUnit = 1 + // The time unit representing a minute. + RateLimitUnit_MINUTE RateLimitUnit = 2 + // The time unit representing an hour. + RateLimitUnit_HOUR RateLimitUnit = 3 + // The time unit representing a day. + RateLimitUnit_DAY RateLimitUnit = 4 +) + +// Enum value maps for RateLimitUnit. +var ( + RateLimitUnit_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SECOND", + 2: "MINUTE", + 3: "HOUR", + 4: "DAY", + } + RateLimitUnit_value = map[string]int32{ + "UNKNOWN": 0, + "SECOND": 1, + "MINUTE": 2, + "HOUR": 3, + "DAY": 4, + } +) + +func (x RateLimitUnit) Enum() *RateLimitUnit { + p := new(RateLimitUnit) + *p = x + return p +} + +func (x RateLimitUnit) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RateLimitUnit) Descriptor() protoreflect.EnumDescriptor { + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_enumTypes[0].Descriptor() +} + +func (RateLimitUnit) Type() protoreflect.EnumType { + return &file_ratelimit_config_ratelimit_v3_rls_conf_proto_enumTypes[0] +} + +func (x RateLimitUnit) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RateLimitUnit.Descriptor instead. +func (RateLimitUnit) EnumDescriptor() ([]byte, []int) { + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescGZIP(), []int{0} +} + +// Rate limit configuration for a single domain. +type RateLimitConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the rate limit configuration. This should be unique for each configuration. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Domain name for the rate limit configuration. + Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` + // List of rate limit configuration descriptors. + Descriptors []*RateLimitDescriptor `protobuf:"bytes,3,rep,name=descriptors,proto3" json:"descriptors,omitempty"` +} + +func (x *RateLimitConfig) Reset() { + *x = RateLimitConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RateLimitConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RateLimitConfig) ProtoMessage() {} + +func (x *RateLimitConfig) ProtoReflect() protoreflect.Message { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RateLimitConfig.ProtoReflect.Descriptor instead. +func (*RateLimitConfig) Descriptor() ([]byte, []int) { + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescGZIP(), []int{0} +} + +func (x *RateLimitConfig) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RateLimitConfig) GetDomain() string { + if x != nil { + return x.Domain + } + return "" +} + +func (x *RateLimitConfig) GetDescriptors() []*RateLimitDescriptor { + if x != nil { + return x.Descriptors + } + return nil +} + +// Rate limit configuration descriptor. +type RateLimitDescriptor struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Key of the descriptor. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Optional value of the descriptor. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // Rate limit policy of the descriptor. + RateLimit *RateLimitPolicy `protobuf:"bytes,3,opt,name=rate_limit,json=rateLimit,proto3" json:"rate_limit,omitempty"` + // List of sub rate limit descriptors. + Descriptors []*RateLimitDescriptor `protobuf:"bytes,4,rep,name=descriptors,proto3" json:"descriptors,omitempty"` + // Mark the descriptor as shadow. When the values is true, rate limit service allow requests to the backend. + ShadowMode bool `protobuf:"varint,5,opt,name=shadow_mode,json=shadowMode,proto3" json:"shadow_mode,omitempty"` +} + +func (x *RateLimitDescriptor) Reset() { + *x = RateLimitDescriptor{} + if protoimpl.UnsafeEnabled { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RateLimitDescriptor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RateLimitDescriptor) ProtoMessage() {} + +func (x *RateLimitDescriptor) ProtoReflect() protoreflect.Message { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RateLimitDescriptor.ProtoReflect.Descriptor instead. +func (*RateLimitDescriptor) Descriptor() ([]byte, []int) { + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescGZIP(), []int{1} +} + +func (x *RateLimitDescriptor) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *RateLimitDescriptor) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *RateLimitDescriptor) GetRateLimit() *RateLimitPolicy { + if x != nil { + return x.RateLimit + } + return nil +} + +func (x *RateLimitDescriptor) GetDescriptors() []*RateLimitDescriptor { + if x != nil { + return x.Descriptors + } + return nil +} + +func (x *RateLimitDescriptor) GetShadowMode() bool { + if x != nil { + return x.ShadowMode + } + return false +} + +// Rate-limit policy. +type RateLimitPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Unit of time for the rate limit. + Unit RateLimitUnit `protobuf:"varint,1,opt,name=unit,proto3,enum=ratelimit.config.ratelimit.v3.RateLimitUnit" json:"unit,omitempty"` + // Number of requests allowed in the policy within `unit` time. + RequestsPerUnit uint32 `protobuf:"varint,2,opt,name=requests_per_unit,json=requestsPerUnit,proto3" json:"requests_per_unit,omitempty"` + // Mark the rate limit policy as unlimited. All requests are allowed to the backend. + Unlimited bool `protobuf:"varint,3,opt,name=unlimited,proto3" json:"unlimited,omitempty"` + // Optional name for the rate limit policy. Name the policy, if it should be replaced (dropped evaluation) by + // another policy. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // List of rate limit policies, this rate limit policy will replace (drop evaluation) + // For more information: https://github.com/envoyproxy/ratelimit/tree/0b2f4d5fb04bf55e1873e2c5e2bb28da67c0643f#replaces + // Example: https://github.com/envoyproxy/ratelimit/tree/0b2f4d5fb04bf55e1873e2c5e2bb28da67c0643f#example-7 + Replaces []*RateLimitReplace `protobuf:"bytes,5,rep,name=replaces,proto3" json:"replaces,omitempty"` +} + +func (x *RateLimitPolicy) Reset() { + *x = RateLimitPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RateLimitPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RateLimitPolicy) ProtoMessage() {} + +func (x *RateLimitPolicy) ProtoReflect() protoreflect.Message { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RateLimitPolicy.ProtoReflect.Descriptor instead. +func (*RateLimitPolicy) Descriptor() ([]byte, []int) { + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescGZIP(), []int{2} +} + +func (x *RateLimitPolicy) GetUnit() RateLimitUnit { + if x != nil { + return x.Unit + } + return RateLimitUnit_UNKNOWN +} + +func (x *RateLimitPolicy) GetRequestsPerUnit() uint32 { + if x != nil { + return x.RequestsPerUnit + } + return 0 +} + +func (x *RateLimitPolicy) GetUnlimited() bool { + if x != nil { + return x.Unlimited + } + return false +} + +func (x *RateLimitPolicy) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RateLimitPolicy) GetReplaces() []*RateLimitReplace { + if x != nil { + return x.Replaces + } + return nil +} + +// Replace specifies the rate limit policy that should be replaced (dropped evaluation). +// For more information: https://github.com/envoyproxy/ratelimit/tree/0b2f4d5fb04bf55e1873e2c5e2bb28da67c0643f#replaces +type RateLimitReplace struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the rate limit policy, that is being replaced (dropped evaluation). + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *RateLimitReplace) Reset() { + *x = RateLimitReplace{} + if protoimpl.UnsafeEnabled { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RateLimitReplace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RateLimitReplace) ProtoMessage() {} + +func (x *RateLimitReplace) ProtoReflect() protoreflect.Message { + mi := &file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RateLimitReplace.ProtoReflect.Descriptor instead. +func (*RateLimitReplace) Descriptor() ([]byte, []int) { + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescGZIP(), []int{3} +} + +func (x *RateLimitReplace) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_ratelimit_config_ratelimit_v3_rls_conf_proto protoreflect.FileDescriptor + +var file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x76, 0x33, 0x2f, + 0x72, 0x6c, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1d, + 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x76, 0x33, 0x22, 0x93, 0x01, + 0x0a, 0x0f, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x54, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, + 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x44, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x73, 0x22, 0x83, 0x02, 0x0a, 0x13, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x09, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x12, 0x54, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x61, 0x64, + 0x6f, 0x77, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, + 0x68, 0x61, 0x64, 0x6f, 0x77, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0xfe, 0x01, 0x0a, 0x0f, 0x52, 0x61, + 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x40, 0x0a, + 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x72, 0x61, + 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, + 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x12, + 0x2a, 0x0a, 0x11, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, + 0x75, 0x6e, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x73, 0x50, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, + 0x6e, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x75, 0x6e, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x4b, 0x0a, + 0x08, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2f, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x76, 0x33, 0x2e, + 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, + 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x10, 0x52, 0x61, + 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x2a, 0x47, 0x0a, 0x0d, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x55, + 0x6e, 0x69, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x43, 0x4f, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, + 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x55, 0x52, + 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x41, 0x59, 0x10, 0x04, 0x42, 0x91, 0x01, 0x0a, 0x2b, + 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x72, 0x61, + 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, + 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x76, 0x33, 0x42, 0x0e, 0x52, 0x6c, 0x73, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x50, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, + 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x2f, 0x76, 0x33, 0x3b, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x76, 0x33, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescOnce sync.Once + file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescData = file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDesc +) + +func file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescGZIP() []byte { + file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescOnce.Do(func() { + file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescData = protoimpl.X.CompressGZIP(file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescData) + }) + return file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDescData +} + +var file_ratelimit_config_ratelimit_v3_rls_conf_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ratelimit_config_ratelimit_v3_rls_conf_proto_goTypes = []interface{}{ + (RateLimitUnit)(0), // 0: ratelimit.config.ratelimit.v3.RateLimitUnit + (*RateLimitConfig)(nil), // 1: ratelimit.config.ratelimit.v3.RateLimitConfig + (*RateLimitDescriptor)(nil), // 2: ratelimit.config.ratelimit.v3.RateLimitDescriptor + (*RateLimitPolicy)(nil), // 3: ratelimit.config.ratelimit.v3.RateLimitPolicy + (*RateLimitReplace)(nil), // 4: ratelimit.config.ratelimit.v3.RateLimitReplace +} +var file_ratelimit_config_ratelimit_v3_rls_conf_proto_depIdxs = []int32{ + 2, // 0: ratelimit.config.ratelimit.v3.RateLimitConfig.descriptors:type_name -> ratelimit.config.ratelimit.v3.RateLimitDescriptor + 3, // 1: ratelimit.config.ratelimit.v3.RateLimitDescriptor.rate_limit:type_name -> ratelimit.config.ratelimit.v3.RateLimitPolicy + 2, // 2: ratelimit.config.ratelimit.v3.RateLimitDescriptor.descriptors:type_name -> ratelimit.config.ratelimit.v3.RateLimitDescriptor + 0, // 3: ratelimit.config.ratelimit.v3.RateLimitPolicy.unit:type_name -> ratelimit.config.ratelimit.v3.RateLimitUnit + 4, // 4: ratelimit.config.ratelimit.v3.RateLimitPolicy.replaces:type_name -> ratelimit.config.ratelimit.v3.RateLimitReplace + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_ratelimit_config_ratelimit_v3_rls_conf_proto_init() } +func file_ratelimit_config_ratelimit_v3_rls_conf_proto_init() { + if File_ratelimit_config_ratelimit_v3_rls_conf_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitDescriptor); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitPolicy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitReplace); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ratelimit_config_ratelimit_v3_rls_conf_proto_goTypes, + DependencyIndexes: file_ratelimit_config_ratelimit_v3_rls_conf_proto_depIdxs, + EnumInfos: file_ratelimit_config_ratelimit_v3_rls_conf_proto_enumTypes, + MessageInfos: file_ratelimit_config_ratelimit_v3_rls_conf_proto_msgTypes, + }.Build() + File_ratelimit_config_ratelimit_v3_rls_conf_proto = out.File + file_ratelimit_config_ratelimit_v3_rls_conf_proto_rawDesc = nil + file_ratelimit_config_ratelimit_v3_rls_conf_proto_goTypes = nil + file_ratelimit_config_ratelimit_v3_rls_conf_proto_depIdxs = nil +} diff --git a/ratelimit/service/ratelimit/v3/rls_conf_ds.pb.go b/ratelimit/service/ratelimit/v3/rls_conf_ds.pb.go new file mode 100644 index 0000000000..bc8f489e64 --- /dev/null +++ b/ratelimit/service/ratelimit/v3/rls_conf_ds.pb.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0-devel +// protoc v3.13.0 +// source: ratelimit/service/ratelimit/v3/rls_conf_ds.proto + +package configv3 + +import ( + context "context" + v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_ratelimit_service_ratelimit_v3_rls_conf_ds_proto protoreflect.FileDescriptor + +var file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_rawDesc = []byte{ + 0x0a, 0x30, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x76, 0x33, + 0x2f, 0x72, 0x6c, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x1e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, + 0x76, 0x33, 0x1a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x8a, + 0x02, 0x0a, 0x1f, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x75, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x6c, 0x73, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, + 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0f, 0x46, 0x65, 0x74, + 0x63, 0x68, 0x52, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x2c, 0x2e, 0x65, + 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, + 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, + 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x8d, 0x01, 0x0a, 0x29, + 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x72, 0x61, + 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x33, 0x42, 0x0e, 0x52, 0x6c, 0x73, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4b, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, + 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, + 0x61, 0x6e, 0x65, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x33, 0x3b, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x76, 0x33, 0x88, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_goTypes = []interface{}{ + (*v3.DiscoveryRequest)(nil), // 0: envoy.service.discovery.v3.DiscoveryRequest + (*v3.DiscoveryResponse)(nil), // 1: envoy.service.discovery.v3.DiscoveryResponse +} +var file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_depIdxs = []int32{ + 0, // 0: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.StreamRlsConfigs:input_type -> envoy.service.discovery.v3.DiscoveryRequest + 0, // 1: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.FetchRlsConfigs:input_type -> envoy.service.discovery.v3.DiscoveryRequest + 1, // 2: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.StreamRlsConfigs:output_type -> envoy.service.discovery.v3.DiscoveryResponse + 1, // 3: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.FetchRlsConfigs:output_type -> envoy.service.discovery.v3.DiscoveryResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_init() } +func file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_init() { + if File_ratelimit_service_ratelimit_v3_rls_conf_ds_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_goTypes, + DependencyIndexes: file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_depIdxs, + }.Build() + File_ratelimit_service_ratelimit_v3_rls_conf_ds_proto = out.File + file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_rawDesc = nil + file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_goTypes = nil + file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// RateLimitConfigDiscoveryServiceClient is the client API for RateLimitConfigDiscoveryService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type RateLimitConfigDiscoveryServiceClient interface { + StreamRlsConfigs(ctx context.Context, opts ...grpc.CallOption) (RateLimitConfigDiscoveryService_StreamRlsConfigsClient, error) + FetchRlsConfigs(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) +} + +type rateLimitConfigDiscoveryServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRateLimitConfigDiscoveryServiceClient(cc grpc.ClientConnInterface) RateLimitConfigDiscoveryServiceClient { + return &rateLimitConfigDiscoveryServiceClient{cc} +} + +func (c *rateLimitConfigDiscoveryServiceClient) StreamRlsConfigs(ctx context.Context, opts ...grpc.CallOption) (RateLimitConfigDiscoveryService_StreamRlsConfigsClient, error) { + stream, err := c.cc.NewStream(ctx, &_RateLimitConfigDiscoveryService_serviceDesc.Streams[0], "/ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService/StreamRlsConfigs", opts...) + if err != nil { + return nil, err + } + x := &rateLimitConfigDiscoveryServiceStreamRlsConfigsClient{stream} + return x, nil +} + +type RateLimitConfigDiscoveryService_StreamRlsConfigsClient interface { + Send(*v3.DiscoveryRequest) error + Recv() (*v3.DiscoveryResponse, error) + grpc.ClientStream +} + +type rateLimitConfigDiscoveryServiceStreamRlsConfigsClient struct { + grpc.ClientStream +} + +func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsClient) Send(m *v3.DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsClient) Recv() (*v3.DiscoveryResponse, error) { + m := new(v3.DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *rateLimitConfigDiscoveryServiceClient) FetchRlsConfigs(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { + out := new(v3.DiscoveryResponse) + err := c.cc.Invoke(ctx, "/ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService/FetchRlsConfigs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RateLimitConfigDiscoveryServiceServer is the server API for RateLimitConfigDiscoveryService service. +type RateLimitConfigDiscoveryServiceServer interface { + StreamRlsConfigs(RateLimitConfigDiscoveryService_StreamRlsConfigsServer) error + FetchRlsConfigs(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) +} + +// UnimplementedRateLimitConfigDiscoveryServiceServer can be embedded to have forward compatible implementations. +type UnimplementedRateLimitConfigDiscoveryServiceServer struct { +} + +func (*UnimplementedRateLimitConfigDiscoveryServiceServer) StreamRlsConfigs(RateLimitConfigDiscoveryService_StreamRlsConfigsServer) error { + return status.Errorf(codes.Unimplemented, "method StreamRlsConfigs not implemented") +} +func (*UnimplementedRateLimitConfigDiscoveryServiceServer) FetchRlsConfigs(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchRlsConfigs not implemented") +} + +func RegisterRateLimitConfigDiscoveryServiceServer(s *grpc.Server, srv RateLimitConfigDiscoveryServiceServer) { + s.RegisterService(&_RateLimitConfigDiscoveryService_serviceDesc, srv) +} + +func _RateLimitConfigDiscoveryService_StreamRlsConfigs_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(RateLimitConfigDiscoveryServiceServer).StreamRlsConfigs(&rateLimitConfigDiscoveryServiceStreamRlsConfigsServer{stream}) +} + +type RateLimitConfigDiscoveryService_StreamRlsConfigsServer interface { + Send(*v3.DiscoveryResponse) error + Recv() (*v3.DiscoveryRequest, error) + grpc.ServerStream +} + +type rateLimitConfigDiscoveryServiceStreamRlsConfigsServer struct { + grpc.ServerStream +} + +func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsServer) Send(m *v3.DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsServer) Recv() (*v3.DiscoveryRequest, error) { + m := new(v3.DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _RateLimitConfigDiscoveryService_FetchRlsConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v3.DiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RateLimitConfigDiscoveryServiceServer).FetchRlsConfigs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService/FetchRlsConfigs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RateLimitConfigDiscoveryServiceServer).FetchRlsConfigs(ctx, req.(*v3.DiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _RateLimitConfigDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService", + HandlerType: (*RateLimitConfigDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchRlsConfigs", + Handler: _RateLimitConfigDiscoveryService_FetchRlsConfigs_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamRlsConfigs", + Handler: _RateLimitConfigDiscoveryService_StreamRlsConfigs_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "ratelimit/service/ratelimit/v3/rls_conf_ds.proto", +}