lightning-terminal/litrpc/lit-scripts_grpc.pb.go
sputn1ck 5cf25ca624 scripting: add Starlark scripting system for LiT automation
This commit introduces a comprehensive Starlark scripting system that
enables custom automation with access to all subdaemon RPCs (lnd, loop,
pool, faraday, taproot-assets). Scripts use native LND macaroons for
permission enforcement.

Key features:
- Starlark execution engine with sandboxed resource limits
- Standard builtins: print, log, sleep, now, json_encode/decode
- HTTP GET requests with URL allowlisting
- Persistent KV store with bucket-based permissions
- LND event subscriptions for long-running daemon scripts
- Script CRUD operations with macaroon baking
- Execution history and running script tracking
- Complete CLI commands (litcli scripts ...)

Database schema:
- scripts: Store script definitions with macaroon permissions
- script_executions: Audit trail for script runs
- script_kv_store: Persistent key-value storage for scripts
- running_scripts: Track currently running scripts

Security model:
- Each script has an LND macaroon baked with specific permissions
- RPC calls from scripts include this macaroon in the header
- LND/subdaemons validate permissions natively
- URL and bucket allowlists validated at runtime
2026-01-30 23:28:52 +01:00

683 lines
27 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v3.12.4
// source: lit-scripts.proto
package litrpc
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 (
Scripts_CreateScript_FullMethodName = "/litrpc.Scripts/CreateScript"
Scripts_UpdateScript_FullMethodName = "/litrpc.Scripts/UpdateScript"
Scripts_DeleteScript_FullMethodName = "/litrpc.Scripts/DeleteScript"
Scripts_GetScript_FullMethodName = "/litrpc.Scripts/GetScript"
Scripts_ListScripts_FullMethodName = "/litrpc.Scripts/ListScripts"
Scripts_StartScript_FullMethodName = "/litrpc.Scripts/StartScript"
Scripts_StopScript_FullMethodName = "/litrpc.Scripts/StopScript"
Scripts_ListRunningScripts_FullMethodName = "/litrpc.Scripts/ListRunningScripts"
Scripts_ValidateScript_FullMethodName = "/litrpc.Scripts/ValidateScript"
Scripts_GetExecutionHistory_FullMethodName = "/litrpc.Scripts/GetExecutionHistory"
Scripts_KVGet_FullMethodName = "/litrpc.Scripts/KVGet"
Scripts_KVPut_FullMethodName = "/litrpc.Scripts/KVPut"
Scripts_KVDelete_FullMethodName = "/litrpc.Scripts/KVDelete"
Scripts_KVList_FullMethodName = "/litrpc.Scripts/KVList"
)
// ScriptsClient is the client API for Scripts 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.
//
// Scripts provides a Starlark scripting system for automating LND operations.
// Scripts can access LND and subdaemon RPCs using native macaroon permissions.
type ScriptsClient interface {
// litcli: `scripts create`
// CreateScript creates a new script with the specified permissions.
// A macaroon will be baked with the given permissions for the script to use.
CreateScript(ctx context.Context, in *CreateScriptRequest, opts ...grpc.CallOption) (*CreateScriptResponse, error)
// litcli: `scripts update`
// UpdateScript updates an existing script's source code or configuration.
UpdateScript(ctx context.Context, in *UpdateScriptRequest, opts ...grpc.CallOption) (*UpdateScriptResponse, error)
// litcli: `scripts delete`
// DeleteScript removes a script from the system. Running scripts will be
// stopped first.
DeleteScript(ctx context.Context, in *DeleteScriptRequest, opts ...grpc.CallOption) (*DeleteScriptResponse, error)
// litcli: `scripts get`
// GetScript retrieves a script by name.
GetScript(ctx context.Context, in *GetScriptRequest, opts ...grpc.CallOption) (*GetScriptResponse, error)
// litcli: `scripts list`
// ListScripts returns all scripts in the system.
ListScripts(ctx context.Context, in *ListScriptsRequest, opts ...grpc.CallOption) (*ListScriptsResponse, error)
// litcli: `scripts start`
// StartScript begins execution of a script. For long-running scripts, this
// will start the script in the background with any configured subscriptions.
StartScript(ctx context.Context, in *StartScriptRequest, opts ...grpc.CallOption) (*StartScriptResponse, error)
// litcli: `scripts stop`
// StopScript stops a running script.
StopScript(ctx context.Context, in *StopScriptRequest, opts ...grpc.CallOption) (*StopScriptResponse, error)
// litcli: `scripts running`
// ListRunningScripts returns all currently running scripts.
ListRunningScripts(ctx context.Context, in *ListRunningScriptsRequest, opts ...grpc.CallOption) (*ListRunningScriptsResponse, error)
// litcli: `scripts validate`
// ValidateScript checks the syntax of a script without creating it.
ValidateScript(ctx context.Context, in *ValidateScriptRequest, opts ...grpc.CallOption) (*ValidateScriptResponse, error)
// litcli: `scripts history`
// GetExecutionHistory returns the execution history for a script.
GetExecutionHistory(ctx context.Context, in *GetExecutionHistoryRequest, opts ...grpc.CallOption) (*GetExecutionHistoryResponse, error)
// litcli: `scripts kv get`
// KVGet retrieves a value from the script KV store.
KVGet(ctx context.Context, in *KVGetRequest, opts ...grpc.CallOption) (*KVGetResponse, error)
// litcli: `scripts kv put`
// KVPut stores a value in the script KV store.
KVPut(ctx context.Context, in *KVPutRequest, opts ...grpc.CallOption) (*KVPutResponse, error)
// litcli: `scripts kv delete`
// KVDelete removes a value from the script KV store.
KVDelete(ctx context.Context, in *KVDeleteRequest, opts ...grpc.CallOption) (*KVDeleteResponse, error)
// litcli: `scripts kv list`
// KVList returns all keys in a bucket, optionally filtered by prefix.
KVList(ctx context.Context, in *KVListRequest, opts ...grpc.CallOption) (*KVListResponse, error)
}
type scriptsClient struct {
cc grpc.ClientConnInterface
}
func NewScriptsClient(cc grpc.ClientConnInterface) ScriptsClient {
return &scriptsClient{cc}
}
func (c *scriptsClient) CreateScript(ctx context.Context, in *CreateScriptRequest, opts ...grpc.CallOption) (*CreateScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateScriptResponse)
err := c.cc.Invoke(ctx, Scripts_CreateScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) UpdateScript(ctx context.Context, in *UpdateScriptRequest, opts ...grpc.CallOption) (*UpdateScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateScriptResponse)
err := c.cc.Invoke(ctx, Scripts_UpdateScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) DeleteScript(ctx context.Context, in *DeleteScriptRequest, opts ...grpc.CallOption) (*DeleteScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteScriptResponse)
err := c.cc.Invoke(ctx, Scripts_DeleteScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) GetScript(ctx context.Context, in *GetScriptRequest, opts ...grpc.CallOption) (*GetScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetScriptResponse)
err := c.cc.Invoke(ctx, Scripts_GetScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) ListScripts(ctx context.Context, in *ListScriptsRequest, opts ...grpc.CallOption) (*ListScriptsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListScriptsResponse)
err := c.cc.Invoke(ctx, Scripts_ListScripts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) StartScript(ctx context.Context, in *StartScriptRequest, opts ...grpc.CallOption) (*StartScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StartScriptResponse)
err := c.cc.Invoke(ctx, Scripts_StartScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) StopScript(ctx context.Context, in *StopScriptRequest, opts ...grpc.CallOption) (*StopScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StopScriptResponse)
err := c.cc.Invoke(ctx, Scripts_StopScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) ListRunningScripts(ctx context.Context, in *ListRunningScriptsRequest, opts ...grpc.CallOption) (*ListRunningScriptsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRunningScriptsResponse)
err := c.cc.Invoke(ctx, Scripts_ListRunningScripts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) ValidateScript(ctx context.Context, in *ValidateScriptRequest, opts ...grpc.CallOption) (*ValidateScriptResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ValidateScriptResponse)
err := c.cc.Invoke(ctx, Scripts_ValidateScript_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) GetExecutionHistory(ctx context.Context, in *GetExecutionHistoryRequest, opts ...grpc.CallOption) (*GetExecutionHistoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetExecutionHistoryResponse)
err := c.cc.Invoke(ctx, Scripts_GetExecutionHistory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) KVGet(ctx context.Context, in *KVGetRequest, opts ...grpc.CallOption) (*KVGetResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(KVGetResponse)
err := c.cc.Invoke(ctx, Scripts_KVGet_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) KVPut(ctx context.Context, in *KVPutRequest, opts ...grpc.CallOption) (*KVPutResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(KVPutResponse)
err := c.cc.Invoke(ctx, Scripts_KVPut_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) KVDelete(ctx context.Context, in *KVDeleteRequest, opts ...grpc.CallOption) (*KVDeleteResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(KVDeleteResponse)
err := c.cc.Invoke(ctx, Scripts_KVDelete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptsClient) KVList(ctx context.Context, in *KVListRequest, opts ...grpc.CallOption) (*KVListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(KVListResponse)
err := c.cc.Invoke(ctx, Scripts_KVList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ScriptsServer is the server API for Scripts service.
// All implementations must embed UnimplementedScriptsServer
// for forward compatibility.
//
// Scripts provides a Starlark scripting system for automating LND operations.
// Scripts can access LND and subdaemon RPCs using native macaroon permissions.
type ScriptsServer interface {
// litcli: `scripts create`
// CreateScript creates a new script with the specified permissions.
// A macaroon will be baked with the given permissions for the script to use.
CreateScript(context.Context, *CreateScriptRequest) (*CreateScriptResponse, error)
// litcli: `scripts update`
// UpdateScript updates an existing script's source code or configuration.
UpdateScript(context.Context, *UpdateScriptRequest) (*UpdateScriptResponse, error)
// litcli: `scripts delete`
// DeleteScript removes a script from the system. Running scripts will be
// stopped first.
DeleteScript(context.Context, *DeleteScriptRequest) (*DeleteScriptResponse, error)
// litcli: `scripts get`
// GetScript retrieves a script by name.
GetScript(context.Context, *GetScriptRequest) (*GetScriptResponse, error)
// litcli: `scripts list`
// ListScripts returns all scripts in the system.
ListScripts(context.Context, *ListScriptsRequest) (*ListScriptsResponse, error)
// litcli: `scripts start`
// StartScript begins execution of a script. For long-running scripts, this
// will start the script in the background with any configured subscriptions.
StartScript(context.Context, *StartScriptRequest) (*StartScriptResponse, error)
// litcli: `scripts stop`
// StopScript stops a running script.
StopScript(context.Context, *StopScriptRequest) (*StopScriptResponse, error)
// litcli: `scripts running`
// ListRunningScripts returns all currently running scripts.
ListRunningScripts(context.Context, *ListRunningScriptsRequest) (*ListRunningScriptsResponse, error)
// litcli: `scripts validate`
// ValidateScript checks the syntax of a script without creating it.
ValidateScript(context.Context, *ValidateScriptRequest) (*ValidateScriptResponse, error)
// litcli: `scripts history`
// GetExecutionHistory returns the execution history for a script.
GetExecutionHistory(context.Context, *GetExecutionHistoryRequest) (*GetExecutionHistoryResponse, error)
// litcli: `scripts kv get`
// KVGet retrieves a value from the script KV store.
KVGet(context.Context, *KVGetRequest) (*KVGetResponse, error)
// litcli: `scripts kv put`
// KVPut stores a value in the script KV store.
KVPut(context.Context, *KVPutRequest) (*KVPutResponse, error)
// litcli: `scripts kv delete`
// KVDelete removes a value from the script KV store.
KVDelete(context.Context, *KVDeleteRequest) (*KVDeleteResponse, error)
// litcli: `scripts kv list`
// KVList returns all keys in a bucket, optionally filtered by prefix.
KVList(context.Context, *KVListRequest) (*KVListResponse, error)
mustEmbedUnimplementedScriptsServer()
}
// UnimplementedScriptsServer 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 UnimplementedScriptsServer struct{}
func (UnimplementedScriptsServer) CreateScript(context.Context, *CreateScriptRequest) (*CreateScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateScript not implemented")
}
func (UnimplementedScriptsServer) UpdateScript(context.Context, *UpdateScriptRequest) (*UpdateScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateScript not implemented")
}
func (UnimplementedScriptsServer) DeleteScript(context.Context, *DeleteScriptRequest) (*DeleteScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteScript not implemented")
}
func (UnimplementedScriptsServer) GetScript(context.Context, *GetScriptRequest) (*GetScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetScript not implemented")
}
func (UnimplementedScriptsServer) ListScripts(context.Context, *ListScriptsRequest) (*ListScriptsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListScripts not implemented")
}
func (UnimplementedScriptsServer) StartScript(context.Context, *StartScriptRequest) (*StartScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method StartScript not implemented")
}
func (UnimplementedScriptsServer) StopScript(context.Context, *StopScriptRequest) (*StopScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method StopScript not implemented")
}
func (UnimplementedScriptsServer) ListRunningScripts(context.Context, *ListRunningScriptsRequest) (*ListRunningScriptsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListRunningScripts not implemented")
}
func (UnimplementedScriptsServer) ValidateScript(context.Context, *ValidateScriptRequest) (*ValidateScriptResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ValidateScript not implemented")
}
func (UnimplementedScriptsServer) GetExecutionHistory(context.Context, *GetExecutionHistoryRequest) (*GetExecutionHistoryResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetExecutionHistory not implemented")
}
func (UnimplementedScriptsServer) KVGet(context.Context, *KVGetRequest) (*KVGetResponse, error) {
return nil, status.Error(codes.Unimplemented, "method KVGet not implemented")
}
func (UnimplementedScriptsServer) KVPut(context.Context, *KVPutRequest) (*KVPutResponse, error) {
return nil, status.Error(codes.Unimplemented, "method KVPut not implemented")
}
func (UnimplementedScriptsServer) KVDelete(context.Context, *KVDeleteRequest) (*KVDeleteResponse, error) {
return nil, status.Error(codes.Unimplemented, "method KVDelete not implemented")
}
func (UnimplementedScriptsServer) KVList(context.Context, *KVListRequest) (*KVListResponse, error) {
return nil, status.Error(codes.Unimplemented, "method KVList not implemented")
}
func (UnimplementedScriptsServer) mustEmbedUnimplementedScriptsServer() {}
func (UnimplementedScriptsServer) testEmbeddedByValue() {}
// UnsafeScriptsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ScriptsServer will
// result in compilation errors.
type UnsafeScriptsServer interface {
mustEmbedUnimplementedScriptsServer()
}
func RegisterScriptsServer(s grpc.ServiceRegistrar, srv ScriptsServer) {
// If the following call panics, it indicates UnimplementedScriptsServer 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(&Scripts_ServiceDesc, srv)
}
func _Scripts_CreateScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).CreateScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_CreateScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).CreateScript(ctx, req.(*CreateScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_UpdateScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).UpdateScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_UpdateScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).UpdateScript(ctx, req.(*UpdateScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_DeleteScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).DeleteScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_DeleteScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).DeleteScript(ctx, req.(*DeleteScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_GetScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).GetScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_GetScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).GetScript(ctx, req.(*GetScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_ListScripts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListScriptsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).ListScripts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_ListScripts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).ListScripts(ctx, req.(*ListScriptsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_StartScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).StartScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_StartScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).StartScript(ctx, req.(*StartScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_StopScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StopScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).StopScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_StopScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).StopScript(ctx, req.(*StopScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_ListRunningScripts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRunningScriptsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).ListRunningScripts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_ListRunningScripts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).ListRunningScripts(ctx, req.(*ListRunningScriptsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_ValidateScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ValidateScriptRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).ValidateScript(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_ValidateScript_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).ValidateScript(ctx, req.(*ValidateScriptRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_GetExecutionHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetExecutionHistoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).GetExecutionHistory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_GetExecutionHistory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).GetExecutionHistory(ctx, req.(*GetExecutionHistoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_KVGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(KVGetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).KVGet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_KVGet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).KVGet(ctx, req.(*KVGetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_KVPut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(KVPutRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).KVPut(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_KVPut_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).KVPut(ctx, req.(*KVPutRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_KVDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(KVDeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).KVDelete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_KVDelete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).KVDelete(ctx, req.(*KVDeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Scripts_KVList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(KVListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptsServer).KVList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scripts_KVList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptsServer).KVList(ctx, req.(*KVListRequest))
}
return interceptor(ctx, in, info, handler)
}
// Scripts_ServiceDesc is the grpc.ServiceDesc for Scripts service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Scripts_ServiceDesc = grpc.ServiceDesc{
ServiceName: "litrpc.Scripts",
HandlerType: (*ScriptsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateScript",
Handler: _Scripts_CreateScript_Handler,
},
{
MethodName: "UpdateScript",
Handler: _Scripts_UpdateScript_Handler,
},
{
MethodName: "DeleteScript",
Handler: _Scripts_DeleteScript_Handler,
},
{
MethodName: "GetScript",
Handler: _Scripts_GetScript_Handler,
},
{
MethodName: "ListScripts",
Handler: _Scripts_ListScripts_Handler,
},
{
MethodName: "StartScript",
Handler: _Scripts_StartScript_Handler,
},
{
MethodName: "StopScript",
Handler: _Scripts_StopScript_Handler,
},
{
MethodName: "ListRunningScripts",
Handler: _Scripts_ListRunningScripts_Handler,
},
{
MethodName: "ValidateScript",
Handler: _Scripts_ValidateScript_Handler,
},
{
MethodName: "GetExecutionHistory",
Handler: _Scripts_GetExecutionHistory_Handler,
},
{
MethodName: "KVGet",
Handler: _Scripts_KVGet_Handler,
},
{
MethodName: "KVPut",
Handler: _Scripts_KVPut_Handler,
},
{
MethodName: "KVDelete",
Handler: _Scripts_KVDelete_Handler,
},
{
MethodName: "KVList",
Handler: _Scripts_KVList_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "lit-scripts.proto",
}