Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterExecutorServer(s grpc.ServiceRegistrar, srv ExecutorServer)
- func Serve(p map[string]plugin.Plugin)
- type Config
- type Dependency
- func (*Dependency) Descriptor() ([]byte, []int)deprecated
- func (x *Dependency) GetUrls() map[string]string
- func (*Dependency) ProtoMessage()
- func (x *Dependency) ProtoReflect() protoreflect.Message
- func (x *Dependency) Reset()
- func (d *Dependency) SetUrls(in map[string]string)
- func (x *Dependency) String() string
- type ExecuteContext
- func (*ExecuteContext) Descriptor() ([]byte, []int)deprecated
- func (x *ExecuteContext) GetIsInteractivitySupported() bool
- func (x *ExecuteContext) GetKubeConfig() []byte
- func (x *ExecuteContext) GetSlackState() []byte
- func (*ExecuteContext) ProtoMessage()
- func (x *ExecuteContext) ProtoReflect() protoreflect.Message
- func (x *ExecuteContext) Reset()
- func (x *ExecuteContext) String() string
- type ExecuteInput
- type ExecuteInputContext
- type ExecuteOutput
- type ExecuteRequest
- func (*ExecuteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ExecuteRequest) GetCommand() string
- func (x *ExecuteRequest) GetConfigs() []*Config
- func (x *ExecuteRequest) GetContext() *ExecuteContext
- func (*ExecuteRequest) ProtoMessage()
- func (x *ExecuteRequest) ProtoReflect() protoreflect.Message
- func (x *ExecuteRequest) Reset()
- func (x *ExecuteRequest) String() string
- type ExecuteResponse
- func (*ExecuteResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ExecuteResponse) GetData() string
- func (x *ExecuteResponse) GetMessage() []byte
- func (*ExecuteResponse) ProtoMessage()
- func (x *ExecuteResponse) ProtoReflect() protoreflect.Message
- func (x *ExecuteResponse) Reset()
- func (x *ExecuteResponse) String() string
- type Executor
- type ExecutorClient
- type ExecutorServer
- type HelpResponse
- type JSONSchema
- type MetadataResponse
- func (*MetadataResponse) Descriptor() ([]byte, []int)deprecated
- func (x *MetadataResponse) GetDependencies() map[string]*Dependency
- func (x *MetadataResponse) GetDescription() string
- func (x *MetadataResponse) GetJsonSchema() *JSONSchema
- 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 UnimplementedExecutorServer
- func (UnimplementedExecutorServer) Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error)
- func (UnimplementedExecutorServer) Help(context.Context, *emptypb.Empty) (*HelpResponse, error)
- func (UnimplementedExecutorServer) Metadata(context.Context, *emptypb.Empty) (*MetadataResponse, error)
- type UnsafeExecutorServer
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 Executor_ServiceDesc = grpc.ServiceDesc{ ServiceName: "executor.Executor", HandlerType: (*ExecutorServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Execute", Handler: _Executor_Execute_Handler, }, { MethodName: "Metadata", Handler: _Executor_Metadata_Handler, }, { MethodName: "Help", Handler: _Executor_Help_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "executor.proto", }
Executor_ServiceDesc is the grpc.ServiceDesc for Executor service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_executor_proto protoreflect.FileDescriptor
Functions ¶
func RegisterExecutorServer ¶
func RegisterExecutorServer(s grpc.ServiceRegistrar, srv ExecutorServer)
Types ¶
type Config ¶
type Config struct { // rawYAML contains the Executor 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 Dependency ¶ added in v0.18.0
type Dependency struct { // urls is the map of URL of the dependency. The key is in format of "os/arch", such as "linux/amd64". Urls map[string]string `` /* 149-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Dependency) Descriptor
deprecated
added in
v0.18.0
func (*Dependency) Descriptor() ([]byte, []int)
Deprecated: Use Dependency.ProtoReflect.Descriptor instead.
func (*Dependency) GetUrls ¶ added in v0.18.0
func (x *Dependency) GetUrls() map[string]string
func (*Dependency) ProtoMessage ¶ added in v0.18.0
func (*Dependency) ProtoMessage()
func (*Dependency) ProtoReflect ¶ added in v0.18.0
func (x *Dependency) ProtoReflect() protoreflect.Message
func (*Dependency) Reset ¶ added in v0.18.0
func (x *Dependency) Reset()
func (*Dependency) SetUrls ¶ added in v0.18.0
func (d *Dependency) SetUrls(in map[string]string)
SetUrls sets the urls map for the dependency.
This method is needed because of current Go limitation: > The Go compiler does not support accessing a struct field x.f where x is of type parameter type even if all types in the type parameter's type set have a field f. We may remove this restriction in a future release. See https://go.dev/doc/go1.18 and https://github.com/golang/go/issues/48522
func (*Dependency) String ¶ added in v0.18.0
func (x *Dependency) String() string
type ExecuteContext ¶ added in v1.0.0
type ExecuteContext struct { IsInteractivitySupported bool `protobuf:"varint,1,opt,name=isInteractivitySupported,proto3" json:"isInteractivitySupported,omitempty"` SlackState []byte `protobuf:"bytes,2,opt,name=slackState,proto3" json:"slackState,omitempty"` KubeConfig []byte `protobuf:"bytes,3,opt,name=kubeConfig,proto3" json:"kubeConfig,omitempty"` // contains filtered or unexported fields }
func (*ExecuteContext) Descriptor
deprecated
added in
v1.0.0
func (*ExecuteContext) Descriptor() ([]byte, []int)
Deprecated: Use ExecuteContext.ProtoReflect.Descriptor instead.
func (*ExecuteContext) GetIsInteractivitySupported ¶ added in v1.0.0
func (x *ExecuteContext) GetIsInteractivitySupported() bool
func (*ExecuteContext) GetKubeConfig ¶ added in v1.0.0
func (x *ExecuteContext) GetKubeConfig() []byte
func (*ExecuteContext) GetSlackState ¶ added in v1.0.0
func (x *ExecuteContext) GetSlackState() []byte
func (*ExecuteContext) ProtoMessage ¶ added in v1.0.0
func (*ExecuteContext) ProtoMessage()
func (*ExecuteContext) ProtoReflect ¶ added in v1.0.0
func (x *ExecuteContext) ProtoReflect() protoreflect.Message
func (*ExecuteContext) Reset ¶ added in v1.0.0
func (x *ExecuteContext) Reset()
func (*ExecuteContext) String ¶ added in v1.0.0
func (x *ExecuteContext) String() string
type ExecuteInput ¶
type ExecuteInput struct { // Context holds execution context. Context ExecuteInputContext // Command holds the command to be executed. Command string // Configs is a list of Executor configurations specified by users. Configs []*Config }
ExecuteInput holds the input of the Execute function.
type ExecuteInputContext ¶ added in v1.0.0
type ExecuteInputContext struct { // IsInteractivitySupported is set to true only if communication platform supports interactive Messages. IsInteractivitySupported bool // KubeConfig is the slice of byte representation of kubeconfig file content KubeConfig []byte // SlackState represents modal state. It's available only if: // - IsInteractivitySupported is set to true, // - and interactive actions were used in the response Message. // This is an alpha feature and may change in the future. // Most likely, it will be generalized to support all communication platforms. SlackState *slack.BlockActionStates }
ExecuteInputContext holds execution context.
type ExecuteOutput ¶
type ExecuteOutput struct { // Data represents the output of processing a given input command. // Deprecated: Use the Message field instead. // // Migration path: // // Old approach: // return executor.ExecuteOutput{ // Data: data, // } // // New approach: // return executor.ExecuteOutput{ // Message: api.NewPlaintextMessage(data, true), // } Data string // Message represents the output of processing a given input command. // You can construct a complex message or just use one of our helper functions: // - api.NewCodeBlockMessage("body", true) // - api.NewPlaintextMessage("body", true) Message api.Message }
ExecuteOutput holds the output of the Execute function.
type ExecuteRequest ¶
type ExecuteRequest struct { // command represents the exact command that was specified by the user. Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` // configs is a list of Executor configurations specified by users. Configs []*Config `protobuf:"bytes,2,rep,name=configs,proto3" json:"configs,omitempty"` // context holds context execution. Context *ExecuteContext `protobuf:"bytes,3,opt,name=context,proto3" json:"context,omitempty"` // contains filtered or unexported fields }
func (*ExecuteRequest) Descriptor
deprecated
func (*ExecuteRequest) Descriptor() ([]byte, []int)
Deprecated: Use ExecuteRequest.ProtoReflect.Descriptor instead.
func (*ExecuteRequest) GetCommand ¶
func (x *ExecuteRequest) GetCommand() string
func (*ExecuteRequest) GetConfigs ¶
func (x *ExecuteRequest) GetConfigs() []*Config
func (*ExecuteRequest) GetContext ¶ added in v1.0.0
func (x *ExecuteRequest) GetContext() *ExecuteContext
func (*ExecuteRequest) ProtoMessage ¶
func (*ExecuteRequest) ProtoMessage()
func (*ExecuteRequest) ProtoReflect ¶
func (x *ExecuteRequest) ProtoReflect() protoreflect.Message
func (*ExecuteRequest) Reset ¶
func (x *ExecuteRequest) Reset()
func (*ExecuteRequest) String ¶
func (x *ExecuteRequest) String() string
type ExecuteResponse ¶
type ExecuteResponse struct { Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*ExecuteResponse) Descriptor
deprecated
func (*ExecuteResponse) Descriptor() ([]byte, []int)
Deprecated: Use ExecuteResponse.ProtoReflect.Descriptor instead.
func (*ExecuteResponse) GetData ¶
func (x *ExecuteResponse) GetData() string
func (*ExecuteResponse) GetMessage ¶ added in v1.0.0
func (x *ExecuteResponse) GetMessage() []byte
func (*ExecuteResponse) ProtoMessage ¶
func (*ExecuteResponse) ProtoMessage()
func (*ExecuteResponse) ProtoReflect ¶
func (x *ExecuteResponse) ProtoReflect() protoreflect.Message
func (*ExecuteResponse) Reset ¶
func (x *ExecuteResponse) Reset()
func (*ExecuteResponse) String ¶
func (x *ExecuteResponse) String() string
type Executor ¶
type Executor interface { Execute(context.Context, ExecuteInput) (ExecuteOutput, error) Metadata(ctx context.Context) (api.MetadataOutput, error) Help(context.Context) (api.Message, error) }
Executor defines the Botkube executor plugin functionality.
type ExecutorClient ¶
type ExecutorClient interface { Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) Metadata(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*MetadataResponse, error) Help(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*HelpResponse, error) }
ExecutorClient is the client API for Executor 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 NewExecutorClient ¶
func NewExecutorClient(cc grpc.ClientConnInterface) ExecutorClient
type ExecutorServer ¶
type ExecutorServer interface { Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) Metadata(context.Context, *emptypb.Empty) (*MetadataResponse, error) Help(context.Context, *emptypb.Empty) (*HelpResponse, error) // contains filtered or unexported methods }
ExecutorServer is the server API for Executor service. All implementations must embed UnimplementedExecutorServer for forward compatibility
type HelpResponse ¶ added in v0.18.0
type HelpResponse struct { Help []byte `protobuf:"bytes,1,opt,name=help,proto3" json:"help,omitempty"` // contains filtered or unexported fields }
func (*HelpResponse) Descriptor
deprecated
added in
v0.18.0
func (*HelpResponse) Descriptor() ([]byte, []int)
Deprecated: Use HelpResponse.ProtoReflect.Descriptor instead.
func (*HelpResponse) GetHelp ¶ added in v0.18.0
func (x *HelpResponse) GetHelp() []byte
func (*HelpResponse) ProtoMessage ¶ added in v0.18.0
func (*HelpResponse) ProtoMessage()
func (*HelpResponse) ProtoReflect ¶ added in v0.18.0
func (x *HelpResponse) ProtoReflect() protoreflect.Message
func (*HelpResponse) Reset ¶ added in v0.18.0
func (x *HelpResponse) Reset()
func (*HelpResponse) String ¶ added in v0.18.0
func (x *HelpResponse) String() string
type JSONSchema ¶ added in v0.18.0
type JSONSchema struct { // value is the string value of the JSON schema. Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // ref_url is the remote reference of the JSON schema. RefUrl string `protobuf:"bytes,2,opt,name=ref_url,json=refUrl,proto3" json:"ref_url,omitempty"` // contains filtered or unexported fields }
func (*JSONSchema) Descriptor
deprecated
added in
v0.18.0
func (*JSONSchema) Descriptor() ([]byte, []int)
Deprecated: Use JSONSchema.ProtoReflect.Descriptor instead.
func (*JSONSchema) GetRefUrl ¶ added in v0.18.0
func (x *JSONSchema) GetRefUrl() string
func (*JSONSchema) GetValue ¶ added in v0.18.0
func (x *JSONSchema) GetValue() string
func (*JSONSchema) ProtoMessage ¶ added in v0.18.0
func (*JSONSchema) ProtoMessage()
func (*JSONSchema) ProtoReflect ¶ added in v0.18.0
func (x *JSONSchema) ProtoReflect() protoreflect.Message
func (*JSONSchema) Reset ¶ added in v0.18.0
func (x *JSONSchema) Reset()
func (*JSONSchema) String ¶ added in v0.18.0
func (x *JSONSchema) String() string
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"` // description is a description of a given plugin. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // json_schema is a JSON schema of a given plugin. JsonSchema *JSONSchema `protobuf:"bytes,3,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` // dependencies is a list of dependencies of a given plugin. Dependencies map[string]*Dependency `` /* 165-byte string literal not displayed */ // contains filtered or unexported fields }
func (*MetadataResponse) Descriptor
deprecated
func (*MetadataResponse) Descriptor() ([]byte, []int)
Deprecated: Use MetadataResponse.ProtoReflect.Descriptor instead.
func (*MetadataResponse) GetDependencies ¶ added in v0.18.0
func (x *MetadataResponse) GetDependencies() map[string]*Dependency
func (*MetadataResponse) GetDescription ¶
func (x *MetadataResponse) GetDescription() string
func (*MetadataResponse) GetJsonSchema ¶ added in v0.18.0
func (x *MetadataResponse) GetJsonSchema() *JSONSchema
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 // Executor represent a concrete implementation that handles the business logic. Executor Executor }
Plugin This is the implementation of plugin.GRPCPlugin, so we can serve and consume different Botkube Executors.
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 UnimplementedExecutorServer ¶
type UnimplementedExecutorServer struct { }
UnimplementedExecutorServer must be embedded to have forward compatible implementations.
func (UnimplementedExecutorServer) Execute ¶
func (UnimplementedExecutorServer) Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error)
func (UnimplementedExecutorServer) Help ¶ added in v0.18.0
func (UnimplementedExecutorServer) Help(context.Context, *emptypb.Empty) (*HelpResponse, error)
func (UnimplementedExecutorServer) Metadata ¶
func (UnimplementedExecutorServer) Metadata(context.Context, *emptypb.Empty) (*MetadataResponse, error)
type UnsafeExecutorServer ¶
type UnsafeExecutorServer interface {
// contains filtered or unexported methods
}
UnsafeExecutorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ExecutorServer will result in compilation errors.