mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 04:15:54 +02:00
* deps: update protobufs; add pkg/protobufs/generate.go * generate protobuf in CI * make: remove generate target * pin protoc
159 lines
5.5 KiB
Go
159 lines
5.5 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.5.1
|
|
// - protoc v3.21.12
|
|
// source: notifier.proto
|
|
|
|
package protobufs
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
Notifier_Notify_FullMethodName = "/proto.Notifier/Notify"
|
|
Notifier_Configure_FullMethodName = "/proto.Notifier/Configure"
|
|
)
|
|
|
|
// NotifierClient is the client API for Notifier 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.
|
|
type NotifierClient interface {
|
|
Notify(ctx context.Context, in *Notification, opts ...grpc.CallOption) (*Empty, error)
|
|
Configure(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Empty, error)
|
|
}
|
|
|
|
type notifierClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewNotifierClient(cc grpc.ClientConnInterface) NotifierClient {
|
|
return ¬ifierClient{cc}
|
|
}
|
|
|
|
func (c *notifierClient) Notify(ctx context.Context, in *Notification, opts ...grpc.CallOption) (*Empty, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Empty)
|
|
err := c.cc.Invoke(ctx, Notifier_Notify_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *notifierClient) Configure(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Empty, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Empty)
|
|
err := c.cc.Invoke(ctx, Notifier_Configure_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// NotifierServer is the server API for Notifier service.
|
|
// All implementations must embed UnimplementedNotifierServer
|
|
// for forward compatibility.
|
|
type NotifierServer interface {
|
|
Notify(context.Context, *Notification) (*Empty, error)
|
|
Configure(context.Context, *Config) (*Empty, error)
|
|
mustEmbedUnimplementedNotifierServer()
|
|
}
|
|
|
|
// UnimplementedNotifierServer 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 UnimplementedNotifierServer struct{}
|
|
|
|
func (UnimplementedNotifierServer) Notify(context.Context, *Notification) (*Empty, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Notify not implemented")
|
|
}
|
|
func (UnimplementedNotifierServer) Configure(context.Context, *Config) (*Empty, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented")
|
|
}
|
|
func (UnimplementedNotifierServer) mustEmbedUnimplementedNotifierServer() {}
|
|
func (UnimplementedNotifierServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeNotifierServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to NotifierServer will
|
|
// result in compilation errors.
|
|
type UnsafeNotifierServer interface {
|
|
mustEmbedUnimplementedNotifierServer()
|
|
}
|
|
|
|
func RegisterNotifierServer(s grpc.ServiceRegistrar, srv NotifierServer) {
|
|
// If the following call pancis, it indicates UnimplementedNotifierServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&Notifier_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Notifier_Notify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Notification)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(NotifierServer).Notify(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Notifier_Notify_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(NotifierServer).Notify(ctx, req.(*Notification))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Notifier_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Config)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(NotifierServer).Configure(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Notifier_Configure_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(NotifierServer).Configure(ctx, req.(*Config))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// Notifier_ServiceDesc is the grpc.ServiceDesc for Notifier service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Notifier_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "proto.Notifier",
|
|
HandlerType: (*NotifierServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Notify",
|
|
Handler: _Notifier_Notify_Handler,
|
|
},
|
|
{
|
|
MethodName: "Configure",
|
|
Handler: _Notifier_Configure_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "notifier.proto",
|
|
}
|