Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterSourceServer(s grpc.ServiceRegistrar, srv SourceServer)
- func Serve(p map[string]plugin.Plugin)
- type Config
- type MetadataResponse
- func (*MetadataResponse) Descriptor() ([]byte, []int)deprecated
- func (x *MetadataResponse) GetDescription() string
- func (x *MetadataResponse) GetVersion() string
- func (*MetadataResponse) ProtoMessage()
- func (x *MetadataResponse) ProtoReflect() protoreflect.Message
- func (x *MetadataResponse) Reset()
- func (x *MetadataResponse) String() string
- type Plugin
- type Source
- type SourceClient
- type SourceServer
- type Source_StreamClient
- type Source_StreamServer
- type StreamInput
- type StreamOutput
- type StreamRequest
- type StreamResponse
- type UnimplementedSourceServer
- type UnsafeSourceServer
Constants ¶
const ProtocolVersion = 1
ProtocolVersion is the version that must match between Botkube core and Botkube plugins. This should be bumped whenever a change happens in one or the other that makes it so that they can't safely communicate. This could be adding a new interface value, it could be how helper/schema computes diffs, etc.
NOTE: In the future we can consider using VersionedPlugins. These can be used to negotiate a compatible version between client and server. If this is set, Handshake.ProtocolVersion is not required.
Variables ¶
var File_source_proto protoreflect.FileDescriptor
var Source_ServiceDesc = grpc.ServiceDesc{ ServiceName: "source.Source", HandlerType: (*SourceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Metadata", Handler: _Source_Metadata_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Stream", Handler: _Source_Stream_Handler, ServerStreams: true, }, }, Metadata: "source.proto", }
Source_ServiceDesc is the grpc.ServiceDesc for Source service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterSourceServer ¶
func RegisterSourceServer(s grpc.ServiceRegistrar, srv SourceServer)
Types ¶
type Config ¶
type Config struct { // RawYAML contains the Source configuration in YAML definitions. RawYAML []byte `protobuf:"bytes,1,opt,name=rawYAML,proto3" json:"rawYAML,omitempty"` // contains filtered or unexported fields }
func (*Config) Descriptor
deprecated
func (*Config) GetRawYAML ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
type MetadataResponse ¶
type MetadataResponse struct { // Version is a version of a given plugin. It should follow the SemVer syntax. Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Descriptions is a description of a given plugin. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // contains filtered or unexported fields }
func (*MetadataResponse) Descriptor
deprecated
func (*MetadataResponse) Descriptor() ([]byte, []int)
Deprecated: Use MetadataResponse.ProtoReflect.Descriptor instead.
func (*MetadataResponse) GetDescription ¶
func (x *MetadataResponse) GetDescription() string
func (*MetadataResponse) GetVersion ¶
func (x *MetadataResponse) GetVersion() string
func (*MetadataResponse) ProtoMessage ¶
func (*MetadataResponse) ProtoMessage()
func (*MetadataResponse) ProtoReflect ¶
func (x *MetadataResponse) ProtoReflect() protoreflect.Message
func (*MetadataResponse) Reset ¶
func (x *MetadataResponse) Reset()
func (*MetadataResponse) String ¶
func (x *MetadataResponse) String() string
type Plugin ¶
type Plugin struct { // The GRPC plugin must still implement the Plugin interface. plugin.NetRPCUnsupportedPlugin // Source represent a concrete implementation that handles the business logic. Source Source }
Plugin This is the implementation of plugin.GRPCPlugin, so we can serve and consume different Botkube Sources.
func (*Plugin) GRPCClient ¶
func (p *Plugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient returns the interface implementation for the plugin that is serving via gRPC by GRPCServer.
type Source ¶
type Source interface { Stream(context.Context, StreamInput) (StreamOutput, error) Metadata(context.Context) (api.MetadataOutput, error) }
Source defines the Botkube source plugin functionality.
type SourceClient ¶
type SourceClient interface { Stream(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (Source_StreamClient, error) Metadata(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*MetadataResponse, error) }
SourceClient is the client API for Source 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.
func NewSourceClient ¶
func NewSourceClient(cc grpc.ClientConnInterface) SourceClient
type SourceServer ¶
type SourceServer interface { Stream(*StreamRequest, Source_StreamServer) error Metadata(context.Context, *emptypb.Empty) (*MetadataResponse, error) // contains filtered or unexported methods }
SourceServer is the server API for Source service. All implementations must embed UnimplementedSourceServer for forward compatibility
type Source_StreamClient ¶
type Source_StreamClient interface { Recv() (*StreamResponse, error) grpc.ClientStream }
type Source_StreamServer ¶
type Source_StreamServer interface { Send(*StreamResponse) error grpc.ServerStream }
type StreamInput ¶
type StreamInput struct { // Configs is a list of Source configurations specified by users. Configs []*Config }
StreamInput holds the input of the Stream function.
type StreamOutput ¶
type StreamOutput struct { // Output represents the streamed events. It is from start of plugin execution. Output chan []byte }
StreamOutput holds the output of the Stream function.
type StreamRequest ¶
type StreamRequest struct { // Configs is a list of Source configurations specified by users. Configs []*Config `protobuf:"bytes,1,rep,name=configs,proto3" json:"configs,omitempty"` // contains filtered or unexported fields }
func (*StreamRequest) Descriptor
deprecated
func (*StreamRequest) Descriptor() ([]byte, []int)
Deprecated: Use StreamRequest.ProtoReflect.Descriptor instead.
func (*StreamRequest) GetConfigs ¶
func (x *StreamRequest) GetConfigs() []*Config
func (*StreamRequest) ProtoMessage ¶
func (*StreamRequest) ProtoMessage()
func (*StreamRequest) ProtoReflect ¶
func (x *StreamRequest) ProtoReflect() protoreflect.Message
func (*StreamRequest) Reset ¶
func (x *StreamRequest) Reset()
func (*StreamRequest) String ¶
func (x *StreamRequest) String() string
type StreamResponse ¶
type StreamResponse struct { // Output represents the streamed Source events. It is from start of Source execution. Output []byte `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` // contains filtered or unexported fields }
func (*StreamResponse) Descriptor
deprecated
func (*StreamResponse) Descriptor() ([]byte, []int)
Deprecated: Use StreamResponse.ProtoReflect.Descriptor instead.
func (*StreamResponse) GetOutput ¶
func (x *StreamResponse) GetOutput() []byte
func (*StreamResponse) ProtoMessage ¶
func (*StreamResponse) ProtoMessage()
func (*StreamResponse) ProtoReflect ¶
func (x *StreamResponse) ProtoReflect() protoreflect.Message
func (*StreamResponse) Reset ¶
func (x *StreamResponse) Reset()
func (*StreamResponse) String ¶
func (x *StreamResponse) String() string
type UnimplementedSourceServer ¶
type UnimplementedSourceServer struct { }
UnimplementedSourceServer must be embedded to have forward compatible implementations.
func (UnimplementedSourceServer) Metadata ¶
func (UnimplementedSourceServer) Metadata(context.Context, *emptypb.Empty) (*MetadataResponse, error)
func (UnimplementedSourceServer) Stream ¶
func (UnimplementedSourceServer) Stream(*StreamRequest, Source_StreamServer) error
type UnsafeSourceServer ¶
type UnsafeSourceServer interface {
// contains filtered or unexported methods
}
UnsafeSourceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SourceServer will result in compilation errors.