diff --git a/ignite/cmd/plugin.go b/ignite/cmd/plugin.go index a0e4fbecf0..116926de70 100644 --- a/ignite/cmd/plugin.go +++ b/ignite/cmd/plugin.go @@ -700,7 +700,7 @@ func newAppClientAPI(cmd *cobra.Command) (plugin.ClientAPI, error) { return nil, err } - var options []plugin.APIOption + options := []plugin.APIOption{plugin.WithCmd(cmd)} if c != nil { options = append(options, plugin.WithChain(c)) } diff --git a/ignite/internal/plugin/consumer_test.go b/ignite/internal/plugin/consumer_test.go index cccc64e595..de43e28b83 100644 --- a/ignite/internal/plugin/consumer_test.go +++ b/ignite/internal/plugin/consumer_test.go @@ -1,4 +1,4 @@ -package plugininternal +package plugininternal_test import ( "context" @@ -8,11 +8,17 @@ import ( "github.com/stretchr/testify/require" + ignitecmd "github.com/ignite/cli/v29/ignite/cmd" + plugininternal "github.com/ignite/cli/v29/ignite/internal/plugin" "github.com/ignite/cli/v29/ignite/services/plugin" "github.com/ignite/cli/v29/ignite/services/plugin/mocks" ) func TestConsumerPlugin(t *testing.T) { + cmd, cleanup, err := ignitecmd.New(context.Background()) + require.NoError(t, err) + t.Cleanup(cleanup) + tests := []struct { name string args []string @@ -97,7 +103,13 @@ func TestConsumerPlugin(t *testing.T) { chainer.EXPECT().ConfigPath().Return("configpath").Maybe() chainer.EXPECT().Home().Return(path, nil).Maybe() chainer.EXPECT().RPCPublicAddress().Return("rpcPublicAddress", nil).Maybe() - _, err = Execute(context.Background(), PluginConsumerPath, []string{"writeGenesis"}, plugin.WithChain(chainer)) + _, err = plugininternal.Execute( + context.Background(), + plugininternal.PluginConsumerPath, + []string{"writeGenesis"}, + plugin.WithChain(chainer), + plugin.WithCmd(cmd), + ) require.NoError(t, err) }, expectedOutput: "true", @@ -118,11 +130,12 @@ func TestConsumerPlugin(t *testing.T) { tt.setup(t, homePath) } - out, err := Execute( + out, err := plugininternal.Execute( context.Background(), - PluginConsumerPath, + plugininternal.PluginConsumerPath, tt.args, plugin.WithChain(chainer), + plugin.WithCmd(cmd), ) if tt.expectedError != "" { diff --git a/ignite/internal/plugin/execute_test.go b/ignite/internal/plugin/execute_test.go index a76c8795a9..0fcb48df7c 100644 --- a/ignite/internal/plugin/execute_test.go +++ b/ignite/internal/plugin/execute_test.go @@ -1,4 +1,4 @@ -package plugininternal +package plugininternal_test import ( "context" @@ -9,11 +9,17 @@ import ( "github.com/stretchr/testify/require" + ignitecmd "github.com/ignite/cli/v29/ignite/cmd" + plugininternal "github.com/ignite/cli/v29/ignite/internal/plugin" "github.com/ignite/cli/v29/ignite/services/plugin" "github.com/ignite/cli/v29/ignite/services/plugin/mocks" ) func TestPluginExecute(t *testing.T) { + cmd, cleanup, err := ignitecmd.New(context.Background()) + require.NoError(t, err) + t.Cleanup(cleanup) + tests := []struct { name string pluginPath string @@ -35,6 +41,11 @@ func TestPluginExecute(t *testing.T) { pluginPath: "testdata/execute_fail", expectedError: "fail", }, + { + name: "ok: plugin run command execute", + pluginPath: "testdata/run_command", + expectedError: "....", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -52,11 +63,12 @@ func TestPluginExecute(t *testing.T) { chainer.EXPECT().Home().Return("home", nil).Maybe() chainer.EXPECT().RPCPublicAddress().Return("rpcPublicAddress", nil).Maybe() - out, err := Execute( + out, err := plugininternal.Execute( context.Background(), pluginPath, []string{"arg1", "arg2"}, plugin.WithChain(chainer), + plugin.WithCmd(cmd), ) if tt.expectedError != "" { diff --git a/ignite/internal/plugin/testdata/execute_fail/go.mod b/ignite/internal/plugin/testdata/execute_fail/go.mod index 93c6b097b1..7df2f41721 100644 --- a/ignite/internal/plugin/testdata/execute_fail/go.mod +++ b/ignite/internal/plugin/testdata/execute_fail/go.mod @@ -81,17 +81,17 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.etcd.io/bbolt v1.3.9 // indirect - golang.org/x/crypto v0.23.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.21.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect - google.golang.org/grpc v1.64.0 // indirect + google.golang.org/grpc v1.64.1 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/ignite/internal/plugin/testdata/execute_ok/go.mod b/ignite/internal/plugin/testdata/execute_ok/go.mod index f012ea498e..7ad2f76c44 100644 --- a/ignite/internal/plugin/testdata/execute_ok/go.mod +++ b/ignite/internal/plugin/testdata/execute_ok/go.mod @@ -81,17 +81,17 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.etcd.io/bbolt v1.3.9 // indirect - golang.org/x/crypto v0.23.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.21.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect - google.golang.org/grpc v1.64.0 // indirect + google.golang.org/grpc v1.64.1 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/ignite/internal/plugin/testdata/run_command/.gitignore b/ignite/internal/plugin/testdata/run_command/.gitignore new file mode 100644 index 0000000000..49a4518f7b --- /dev/null +++ b/ignite/internal/plugin/testdata/run_command/.gitignore @@ -0,0 +1 @@ +run_command* diff --git a/ignite/internal/plugin/testdata/run_command/go.mod b/ignite/internal/plugin/testdata/run_command/go.mod new file mode 100644 index 0000000000..7ad2f76c44 --- /dev/null +++ b/ignite/internal/plugin/testdata/run_command/go.mod @@ -0,0 +1,98 @@ +module execute_ok + +go 1.22 + +toolchain go1.22.3 + +require ( + github.com/hashicorp/go-plugin v1.6.0 + github.com/ignite/cli/v29 v29.0.0 +) + +replace github.com/ignite/cli/v29 => ../../../../.. + +require ( + dario.cat/mergo v1.0.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/ProtonMail/go-crypto v1.0.0 // indirect + github.com/aymanbagabas/go-osc52 v1.2.1 // indirect + github.com/aymerick/douceur v0.2.0 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect + github.com/charmbracelet/lipgloss v0.6.0 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-sdk v0.50.7 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.12.0 // indirect + github.com/gobuffalo/flect v0.3.0 // indirect + github.com/gobuffalo/genny/v2 v2.1.0 // indirect + github.com/gobuffalo/github_flavored_markdown v1.1.4 // indirect + github.com/gobuffalo/helpers v0.6.7 // indirect + github.com/gobuffalo/logger v1.0.7 // indirect + github.com/gobuffalo/packd v1.0.2 // indirect + github.com/gobuffalo/plush/v4 v4.1.19 // indirect + github.com/gobuffalo/tags/v3 v3.1.4 // indirect + github.com/gobuffalo/validate/v3 v3.3.3 // indirect + github.com/goccy/go-yaml v1.11.3 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-github/v48 v48.2.0 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/gorilla/css v1.0.0 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/imdario/mergo v0.3.13 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/microcosm-cc/bluemonday v1.0.23 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.14.0 // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/skeema/knownhosts v1.2.2 // indirect + github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect + github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect + github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + go.etcd.io/bbolt v1.3.9 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect + google.golang.org/grpc v1.64.1 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/ignite/internal/plugin/testdata/run_command/main.go b/ignite/internal/plugin/testdata/run_command/main.go new file mode 100644 index 0000000000..4727e47ce7 --- /dev/null +++ b/ignite/internal/plugin/testdata/run_command/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "context" + + hplugin "github.com/hashicorp/go-plugin" + + "github.com/ignite/cli/v29/ignite/services/plugin" +) + +type app struct{} + +func (app) Manifest(ctx context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ + Name: "run_command", + }, nil +} + +func (app) Execute(ctx context.Context, cmd *plugin.ExecutedCommand, api plugin.ClientAPI) error { + return api.RunCommand(ctx, "version") +} + +func (app) ExecuteHookPre(ctx context.Context, h *plugin.ExecutedHook, api plugin.ClientAPI) error { + return nil +} + +func (app) ExecuteHookPost(ctx context.Context, h *plugin.ExecutedHook, api plugin.ClientAPI) error { + return nil +} + +func (app) ExecuteHookCleanUp(ctx context.Context, h *plugin.ExecutedHook, api plugin.ClientAPI) error { + return nil +} + +func main() { + hplugin.Serve(&hplugin.ServeConfig{ + HandshakeConfig: plugin.HandshakeConfig(), + Plugins: map[string]hplugin.Plugin{ + "run_command": plugin.NewGRPC(&app{}), + }, + GRPCServer: hplugin.DefaultGRPCServer, + }) +} diff --git a/ignite/services/plugin/client_api.go b/ignite/services/plugin/client_api.go index 1a7e3781dc..a9b27c1fa9 100644 --- a/ignite/services/plugin/client_api.go +++ b/ignite/services/plugin/client_api.go @@ -3,11 +3,17 @@ package plugin import ( "context" + "github.com/spf13/cobra" + "github.com/ignite/cli/v29/ignite/pkg/errors" ) -// ErrAppChainNotFound indicates that the plugin command is not running inside a blockchain app. -var ErrAppChainNotFound = errors.New("blockchain app not found") +var ( + // ErrAppChainNotFound indicates that the plugin command is not running inside a blockchain app. + ErrAppChainNotFound = errors.New("blockchain app not found") + // ErrCmdNotFound indicates that the plugin command is not running exist in the blockchain app. + ErrCmdNotFound = errors.New("blockchain CLI commands not found") +) //go:generate mockery --srcpkg . --name Chainer --structname ChainerInterface --filename chainer.go --with-expecter type Chainer interface { @@ -31,6 +37,7 @@ type Chainer interface { type APIOption func(*apiOptions) type apiOptions struct { + cmd *cobra.Command chain Chainer } @@ -41,6 +48,13 @@ func WithChain(c Chainer) APIOption { } } +// WithCmd configures the chain CLI commands to use for the client API. +func WithCmd(cmd *cobra.Command) APIOption { + return func(o *apiOptions) { + o.cmd = cmd + } +} + // NewClientAPI creates a new app ClientAPI. func NewClientAPI(options ...APIOption) ClientAPI { o := apiOptions{} @@ -84,9 +98,25 @@ func (api clientAPI) GetChainInfo(context.Context) (*ChainInfo, error) { }, nil } +func (api clientAPI) RunCommand(ctx context.Context, command ...string) error { + cmd, err := api.getCmd() + if err != nil { + return err + } + cmd.SetArgs(command) + return cmd.ExecuteContext(ctx) +} + func (api clientAPI) getChain() (Chainer, error) { if api.o.chain == nil { return nil, ErrAppChainNotFound } return api.o.chain, nil } + +func (api clientAPI) getCmd() (*cobra.Command, error) { + if api.o.cmd == nil { + return nil, ErrCmdNotFound + } + return api.o.cmd, nil +} diff --git a/ignite/services/plugin/grpc/v1/client_api.pb.go b/ignite/services/plugin/grpc/v1/client_api.pb.go index f113c3f6ca..80db976ec2 100644 --- a/ignite/services/plugin/grpc/v1/client_api.pb.go +++ b/ignite/services/plugin/grpc/v1/client_api.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: ignite/services/plugin/grpc/v1/client_api.proto @@ -137,7 +137,7 @@ func file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescGZIP() []byte { } var file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_ignite_services_plugin_grpc_v1_client_api_proto_goTypes = []interface{}{ +var file_ignite_services_plugin_grpc_v1_client_api_proto_goTypes = []any{ (*ChainInfo)(nil), // 0: ignite.services.plugin.grpc.v1.ChainInfo } var file_ignite_services_plugin_grpc_v1_client_api_proto_depIdxs = []int32{ @@ -154,7 +154,7 @@ func file_ignite_services_plugin_grpc_v1_client_api_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ChainInfo); i { case 0: return &v.state diff --git a/ignite/services/plugin/grpc/v1/interface.pb.go b/ignite/services/plugin/grpc/v1/interface.pb.go index f63e64245e..7690e11e00 100644 --- a/ignite/services/plugin/grpc/v1/interface.pb.go +++ b/ignite/services/plugin/grpc/v1/interface.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: ignite/services/plugin/grpc/v1/interface.proto @@ -729,7 +729,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP() []byte { var file_ignite_services_plugin_grpc_v1_interface_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_ignite_services_plugin_grpc_v1_interface_proto_goTypes = []interface{}{ +var file_ignite_services_plugin_grpc_v1_interface_proto_goTypes = []any{ (Flag_Type)(0), // 0: ignite.services.plugin.grpc.v1.Flag.Type (*ExecutedCommand)(nil), // 1: ignite.services.plugin.grpc.v1.ExecutedCommand (*ExecutedHook)(nil), // 2: ignite.services.plugin.grpc.v1.ExecutedHook @@ -762,7 +762,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ExecutedCommand); i { case 0: return &v.state @@ -774,7 +774,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ExecutedHook); i { case 0: return &v.state @@ -786,7 +786,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Manifest); i { case 0: return &v.state @@ -798,7 +798,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Command); i { case 0: return &v.state @@ -810,7 +810,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Flag); i { case 0: return &v.state @@ -822,7 +822,7 @@ func file_ignite_services_plugin_grpc_v1_interface_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Hook); i { case 0: return &v.state diff --git a/ignite/services/plugin/grpc/v1/service.pb.go b/ignite/services/plugin/grpc/v1/service.pb.go index 0845145f5f..0980a5a257 100644 --- a/ignite/services/plugin/grpc/v1/service.pb.go +++ b/ignite/services/plugin/grpc/v1/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: ignite/services/plugin/grpc/v1/service.proto @@ -563,6 +563,91 @@ func (x *GetChainInfoResponse) GetChainInfo() *ChainInfo { return nil } +type RunCommandRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Command []string `protobuf:"bytes,1,rep,name=command,proto3" json:"command,omitempty"` +} + +func (x *RunCommandRequest) Reset() { + *x = RunCommandRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunCommandRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunCommandRequest) ProtoMessage() {} + +func (x *RunCommandRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[12] + 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 RunCommandRequest.ProtoReflect.Descriptor instead. +func (*RunCommandRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{12} +} + +func (x *RunCommandRequest) GetCommand() []string { + if x != nil { + return x.Command + } + return nil +} + +type RunCommandResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RunCommandResponse) Reset() { + *x = RunCommandResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunCommandResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunCommandResponse) ProtoMessage() {} + +func (x *RunCommandResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[13] + 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 RunCommandResponse.ProtoReflect.Descriptor instead. +func (*RunCommandResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{13} +} + var File_ignite_services_plugin_grpc_v1_service_proto protoreflect.FileDescriptor var file_ignite_services_plugin_grpc_v1_service_proto_rawDesc = []byte{ @@ -628,60 +713,72 @@ var file_ignite_services_plugin_grpc_v1_service_proto_rawDesc = []byte{ 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, - 0x66, 0x6f, 0x32, 0x81, 0x05, 0x0a, 0x10, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6d, 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, - 0x65, 0x73, 0x74, 0x12, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, + 0x66, 0x6f, 0x22, 0x2d, 0x0a, 0x11, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x81, 0x05, 0x0a, 0x10, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6d, 0x0a, 0x08, + 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, + 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x69, 0x67, 0x6e, 0x69, + 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x07, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x2e, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x72, 0x65, 0x12, 0x35, 0x2e, 0x69, 0x67, 0x6e, 0x69, + 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x36, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, + 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x0f, 0x45, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x36, 0x2e, 0x69, + 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, - 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, - 0x65, 0x12, 0x2e, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, - 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, - 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, - 0x6b, 0x50, 0x72, 0x65, 0x12, 0x35, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, + 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, + 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, + 0x0a, 0x12, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, + 0x61, 0x6e, 0x55, 0x70, 0x12, 0x39, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, - 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x69, 0x67, - 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, - 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, - 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x36, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x37, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, - 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x12, 0x45, 0x78, 0x65, - 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x55, 0x70, 0x12, - 0x39, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x6b, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x3a, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, - 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x69, 0x67, 0x6e, - 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x55, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8d, 0x01, 0x0a, 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x41, 0x50, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x79, 0x0a, 0x0c, 0x47, - 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x2e, 0x69, 0x67, - 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x34, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x6e, 0x55, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x82, 0x02, 0x0a, 0x10, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x50, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x79, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x33, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x69, 0x2f, - 0x76, 0x32, 0x39, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x0a, 0x52, + 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x31, 0x2e, 0x69, 0x67, 0x6e, 0x69, + 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x69, + 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x75, + 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, + 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x76, 0x32, 0x39, 0x2f, 0x69, 0x67, + 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -696,8 +793,8 @@ func file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP() []byte { return file_ignite_services_plugin_grpc_v1_service_proto_rawDescData } -var file_ignite_services_plugin_grpc_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_ignite_services_plugin_grpc_v1_service_proto_goTypes = []interface{}{ +var file_ignite_services_plugin_grpc_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_ignite_services_plugin_grpc_v1_service_proto_goTypes = []any{ (*ManifestRequest)(nil), // 0: ignite.services.plugin.grpc.v1.ManifestRequest (*ManifestResponse)(nil), // 1: ignite.services.plugin.grpc.v1.ManifestResponse (*ExecuteRequest)(nil), // 2: ignite.services.plugin.grpc.v1.ExecuteRequest @@ -710,32 +807,36 @@ var file_ignite_services_plugin_grpc_v1_service_proto_goTypes = []interface{}{ (*ExecuteHookCleanUpResponse)(nil), // 9: ignite.services.plugin.grpc.v1.ExecuteHookCleanUpResponse (*GetChainInfoRequest)(nil), // 10: ignite.services.plugin.grpc.v1.GetChainInfoRequest (*GetChainInfoResponse)(nil), // 11: ignite.services.plugin.grpc.v1.GetChainInfoResponse - (*Manifest)(nil), // 12: ignite.services.plugin.grpc.v1.Manifest - (*ExecutedCommand)(nil), // 13: ignite.services.plugin.grpc.v1.ExecutedCommand - (*ExecutedHook)(nil), // 14: ignite.services.plugin.grpc.v1.ExecutedHook - (*ChainInfo)(nil), // 15: ignite.services.plugin.grpc.v1.ChainInfo + (*RunCommandRequest)(nil), // 12: ignite.services.plugin.grpc.v1.RunCommandRequest + (*RunCommandResponse)(nil), // 13: ignite.services.plugin.grpc.v1.RunCommandResponse + (*Manifest)(nil), // 14: ignite.services.plugin.grpc.v1.Manifest + (*ExecutedCommand)(nil), // 15: ignite.services.plugin.grpc.v1.ExecutedCommand + (*ExecutedHook)(nil), // 16: ignite.services.plugin.grpc.v1.ExecutedHook + (*ChainInfo)(nil), // 17: ignite.services.plugin.grpc.v1.ChainInfo } var file_ignite_services_plugin_grpc_v1_service_proto_depIdxs = []int32{ - 12, // 0: ignite.services.plugin.grpc.v1.ManifestResponse.manifest:type_name -> ignite.services.plugin.grpc.v1.Manifest - 13, // 1: ignite.services.plugin.grpc.v1.ExecuteRequest.cmd:type_name -> ignite.services.plugin.grpc.v1.ExecutedCommand - 14, // 2: ignite.services.plugin.grpc.v1.ExecuteHookPreRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook - 14, // 3: ignite.services.plugin.grpc.v1.ExecuteHookPostRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook - 14, // 4: ignite.services.plugin.grpc.v1.ExecuteHookCleanUpRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook - 15, // 5: ignite.services.plugin.grpc.v1.GetChainInfoResponse.chain_info:type_name -> ignite.services.plugin.grpc.v1.ChainInfo + 14, // 0: ignite.services.plugin.grpc.v1.ManifestResponse.manifest:type_name -> ignite.services.plugin.grpc.v1.Manifest + 15, // 1: ignite.services.plugin.grpc.v1.ExecuteRequest.cmd:type_name -> ignite.services.plugin.grpc.v1.ExecutedCommand + 16, // 2: ignite.services.plugin.grpc.v1.ExecuteHookPreRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook + 16, // 3: ignite.services.plugin.grpc.v1.ExecuteHookPostRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook + 16, // 4: ignite.services.plugin.grpc.v1.ExecuteHookCleanUpRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook + 17, // 5: ignite.services.plugin.grpc.v1.GetChainInfoResponse.chain_info:type_name -> ignite.services.plugin.grpc.v1.ChainInfo 0, // 6: ignite.services.plugin.grpc.v1.InterfaceService.Manifest:input_type -> ignite.services.plugin.grpc.v1.ManifestRequest 2, // 7: ignite.services.plugin.grpc.v1.InterfaceService.Execute:input_type -> ignite.services.plugin.grpc.v1.ExecuteRequest 4, // 8: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPre:input_type -> ignite.services.plugin.grpc.v1.ExecuteHookPreRequest 6, // 9: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPost:input_type -> ignite.services.plugin.grpc.v1.ExecuteHookPostRequest 8, // 10: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookCleanUp:input_type -> ignite.services.plugin.grpc.v1.ExecuteHookCleanUpRequest 10, // 11: ignite.services.plugin.grpc.v1.ClientAPIService.GetChainInfo:input_type -> ignite.services.plugin.grpc.v1.GetChainInfoRequest - 1, // 12: ignite.services.plugin.grpc.v1.InterfaceService.Manifest:output_type -> ignite.services.plugin.grpc.v1.ManifestResponse - 3, // 13: ignite.services.plugin.grpc.v1.InterfaceService.Execute:output_type -> ignite.services.plugin.grpc.v1.ExecuteResponse - 5, // 14: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPre:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookPreResponse - 7, // 15: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPost:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookPostResponse - 9, // 16: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookCleanUp:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookCleanUpResponse - 11, // 17: ignite.services.plugin.grpc.v1.ClientAPIService.GetChainInfo:output_type -> ignite.services.plugin.grpc.v1.GetChainInfoResponse - 12, // [12:18] is the sub-list for method output_type - 6, // [6:12] is the sub-list for method input_type + 12, // 12: ignite.services.plugin.grpc.v1.ClientAPIService.RunCommand:input_type -> ignite.services.plugin.grpc.v1.RunCommandRequest + 1, // 13: ignite.services.plugin.grpc.v1.InterfaceService.Manifest:output_type -> ignite.services.plugin.grpc.v1.ManifestResponse + 3, // 14: ignite.services.plugin.grpc.v1.InterfaceService.Execute:output_type -> ignite.services.plugin.grpc.v1.ExecuteResponse + 5, // 15: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPre:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookPreResponse + 7, // 16: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPost:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookPostResponse + 9, // 17: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookCleanUp:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookCleanUpResponse + 11, // 18: ignite.services.plugin.grpc.v1.ClientAPIService.GetChainInfo:output_type -> ignite.services.plugin.grpc.v1.GetChainInfoResponse + 13, // 19: ignite.services.plugin.grpc.v1.ClientAPIService.RunCommand:output_type -> ignite.services.plugin.grpc.v1.RunCommandResponse + 13, // [13:20] is the sub-list for method output_type + 6, // [6:13] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name 6, // [6:6] is the sub-list for extension extendee 0, // [0:6] is the sub-list for field type_name @@ -749,7 +850,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { file_ignite_services_plugin_grpc_v1_client_api_proto_init() file_ignite_services_plugin_grpc_v1_interface_proto_init() if !protoimpl.UnsafeEnabled { - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ManifestRequest); i { case 0: return &v.state @@ -761,7 +862,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ManifestResponse); i { case 0: return &v.state @@ -773,7 +874,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ExecuteRequest); i { case 0: return &v.state @@ -785,7 +886,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ExecuteResponse); i { case 0: return &v.state @@ -797,7 +898,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ExecuteHookPreRequest); i { case 0: return &v.state @@ -809,7 +910,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ExecuteHookPreResponse); i { case 0: return &v.state @@ -821,7 +922,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ExecuteHookPostRequest); i { case 0: return &v.state @@ -833,7 +934,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ExecuteHookPostResponse); i { case 0: return &v.state @@ -845,7 +946,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*ExecuteHookCleanUpRequest); i { case 0: return &v.state @@ -857,7 +958,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*ExecuteHookCleanUpResponse); i { case 0: return &v.state @@ -869,7 +970,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*GetChainInfoRequest); i { case 0: return &v.state @@ -881,7 +982,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } - file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*GetChainInfoResponse); i { case 0: return &v.state @@ -893,6 +994,30 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { return nil } } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[12].Exporter = func(v any, i int) any { + switch v := v.(*RunCommandRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[13].Exporter = func(v any, i int) any { + switch v := v.(*RunCommandResponse); 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{ @@ -900,7 +1025,7 @@ func file_ignite_services_plugin_grpc_v1_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ignite_services_plugin_grpc_v1_service_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 2, }, diff --git a/ignite/services/plugin/grpc/v1/service_grpc.pb.go b/ignite/services/plugin/grpc/v1/service_grpc.pb.go index 759410d156..fca508da0c 100644 --- a/ignite/services/plugin/grpc/v1/service_grpc.pb.go +++ b/ignite/services/plugin/grpc/v1/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.4.0 // - protoc (unknown) // source: ignite/services/plugin/grpc/v1/service.proto @@ -16,8 +16,8 @@ import ( // 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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( InterfaceService_Manifest_FullMethodName = "/ignite.services.plugin.grpc.v1.InterfaceService/Manifest" @@ -30,6 +30,8 @@ const ( // InterfaceServiceClient is the client API for InterfaceService 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. +// +// InterfaceService defines the interface that must be implemented by all plugins. type InterfaceServiceClient interface { // Manifest declares the plugin's Command(s) and Hook(s). Manifest(ctx context.Context, in *ManifestRequest, opts ...grpc.CallOption) (*ManifestResponse, error) @@ -64,8 +66,9 @@ func NewInterfaceServiceClient(cc grpc.ClientConnInterface) InterfaceServiceClie } func (c *interfaceServiceClient) Manifest(ctx context.Context, in *ManifestRequest, opts ...grpc.CallOption) (*ManifestResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ManifestResponse) - err := c.cc.Invoke(ctx, InterfaceService_Manifest_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, InterfaceService_Manifest_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -73,8 +76,9 @@ func (c *interfaceServiceClient) Manifest(ctx context.Context, in *ManifestReque } func (c *interfaceServiceClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ExecuteResponse) - err := c.cc.Invoke(ctx, InterfaceService_Execute_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, InterfaceService_Execute_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -82,8 +86,9 @@ func (c *interfaceServiceClient) Execute(ctx context.Context, in *ExecuteRequest } func (c *interfaceServiceClient) ExecuteHookPre(ctx context.Context, in *ExecuteHookPreRequest, opts ...grpc.CallOption) (*ExecuteHookPreResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ExecuteHookPreResponse) - err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookPre_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookPre_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -91,8 +96,9 @@ func (c *interfaceServiceClient) ExecuteHookPre(ctx context.Context, in *Execute } func (c *interfaceServiceClient) ExecuteHookPost(ctx context.Context, in *ExecuteHookPostRequest, opts ...grpc.CallOption) (*ExecuteHookPostResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ExecuteHookPostResponse) - err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookPost_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookPost_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -100,8 +106,9 @@ func (c *interfaceServiceClient) ExecuteHookPost(ctx context.Context, in *Execut } func (c *interfaceServiceClient) ExecuteHookCleanUp(ctx context.Context, in *ExecuteHookCleanUpRequest, opts ...grpc.CallOption) (*ExecuteHookCleanUpResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ExecuteHookCleanUpResponse) - err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookCleanUp_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookCleanUp_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -111,6 +118,8 @@ func (c *interfaceServiceClient) ExecuteHookCleanUp(ctx context.Context, in *Exe // InterfaceServiceServer is the server API for InterfaceService service. // All implementations must embed UnimplementedInterfaceServiceServer // for forward compatibility +// +// InterfaceService defines the interface that must be implemented by all plugins. type InterfaceServiceServer interface { // Manifest declares the plugin's Command(s) and Hook(s). Manifest(context.Context, *ManifestRequest) (*ManifestResponse, error) @@ -293,14 +302,19 @@ var InterfaceService_ServiceDesc = grpc.ServiceDesc{ const ( ClientAPIService_GetChainInfo_FullMethodName = "/ignite.services.plugin.grpc.v1.ClientAPIService/GetChainInfo" + ClientAPIService_RunCommand_FullMethodName = "/ignite.services.plugin.grpc.v1.ClientAPIService/RunCommand" ) // ClientAPIServiceClient is the client API for ClientAPIService 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. +// +// ClientAPIService defines the interface that allows plugins to get chain app analysis info. type ClientAPIServiceClient interface { // GetChainInfo returns basic chain info for the configured app GetChainInfo(ctx context.Context, in *GetChainInfoRequest, opts ...grpc.CallOption) (*GetChainInfoResponse, error) + // RunCommand runs a ignite cobra command + RunCommand(ctx context.Context, in *RunCommandRequest, opts ...grpc.CallOption) (*RunCommandResponse, error) } type clientAPIServiceClient struct { @@ -312,8 +326,19 @@ func NewClientAPIServiceClient(cc grpc.ClientConnInterface) ClientAPIServiceClie } func (c *clientAPIServiceClient) GetChainInfo(ctx context.Context, in *GetChainInfoRequest, opts ...grpc.CallOption) (*GetChainInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetChainInfoResponse) - err := c.cc.Invoke(ctx, ClientAPIService_GetChainInfo_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, ClientAPIService_GetChainInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clientAPIServiceClient) RunCommand(ctx context.Context, in *RunCommandRequest, opts ...grpc.CallOption) (*RunCommandResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RunCommandResponse) + err := c.cc.Invoke(ctx, ClientAPIService_RunCommand_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -323,9 +348,13 @@ func (c *clientAPIServiceClient) GetChainInfo(ctx context.Context, in *GetChainI // ClientAPIServiceServer is the server API for ClientAPIService service. // All implementations must embed UnimplementedClientAPIServiceServer // for forward compatibility +// +// ClientAPIService defines the interface that allows plugins to get chain app analysis info. type ClientAPIServiceServer interface { // GetChainInfo returns basic chain info for the configured app GetChainInfo(context.Context, *GetChainInfoRequest) (*GetChainInfoResponse, error) + // RunCommand runs a ignite cobra command + RunCommand(context.Context, *RunCommandRequest) (*RunCommandResponse, error) mustEmbedUnimplementedClientAPIServiceServer() } @@ -336,6 +365,9 @@ type UnimplementedClientAPIServiceServer struct { func (UnimplementedClientAPIServiceServer) GetChainInfo(context.Context, *GetChainInfoRequest) (*GetChainInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetChainInfo not implemented") } +func (UnimplementedClientAPIServiceServer) RunCommand(context.Context, *RunCommandRequest) (*RunCommandResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RunCommand not implemented") +} func (UnimplementedClientAPIServiceServer) mustEmbedUnimplementedClientAPIServiceServer() {} // UnsafeClientAPIServiceServer may be embedded to opt out of forward compatibility for this service. @@ -367,6 +399,24 @@ func _ClientAPIService_GetChainInfo_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _ClientAPIService_RunCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RunCommandRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClientAPIServiceServer).RunCommand(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ClientAPIService_RunCommand_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClientAPIServiceServer).RunCommand(ctx, req.(*RunCommandRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ClientAPIService_ServiceDesc is the grpc.ServiceDesc for ClientAPIService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -378,6 +428,10 @@ var ClientAPIService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetChainInfo", Handler: _ClientAPIService_GetChainInfo_Handler, }, + { + MethodName: "RunCommand", + Handler: _ClientAPIService_RunCommand_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ignite/services/plugin/grpc/v1/service.proto", diff --git a/ignite/services/plugin/interface.go b/ignite/services/plugin/interface.go index 5f4a8492db..3a369bfc75 100644 --- a/ignite/services/plugin/interface.go +++ b/ignite/services/plugin/interface.go @@ -71,4 +71,6 @@ type Interface interface { type ClientAPI interface { // GetChainInfo returns basic info for the configured blockchain app. GetChainInfo(context.Context) (*ChainInfo, error) + // RunCommand runs a ignite cobra command. + RunCommand(ctx context.Context, command ...string) error } diff --git a/ignite/services/plugin/mocks/client_api.go b/ignite/services/plugin/mocks/client_api.go index 8b0e61be76..755a64083a 100644 --- a/ignite/services/plugin/mocks/client_api.go +++ b/ignite/services/plugin/mocks/client_api.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -77,12 +77,70 @@ func (_c *PluginClientAPI_GetChainInfo_Call) RunAndReturn(run func(context.Conte return _c } -// NewPluginClientAPI creates a new instance of PluginClientAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewPluginClientAPI(t interface { +// RunCommand provides a mock function with given fields: ctx, command +func (_m *PluginClientAPI) RunCommand(ctx context.Context, command ...string) error { + _va := make([]interface{}, len(command)) + for _i := range command { + _va[_i] = command[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ...string) error); ok { + r0 = rf(ctx, command...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// PluginClientAPI_RunCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunCommand' +type PluginClientAPI_RunCommand_Call struct { + *mock.Call +} + +// RunCommand is a helper method to define mock.On call +// - ctx context.Context +// - command ...string +func (_e *PluginClientAPI_Expecter) RunCommand(ctx interface{}, command ...interface{}) *PluginClientAPI_RunCommand_Call { + return &PluginClientAPI_RunCommand_Call{Call: _e.mock.On("RunCommand", + append([]interface{}{ctx}, command...)...)} +} + +func (_c *PluginClientAPI_RunCommand_Call) Run(run func(ctx context.Context, command ...string)) *PluginClientAPI_RunCommand_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *PluginClientAPI_RunCommand_Call) Return(_a0 error) *PluginClientAPI_RunCommand_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PluginClientAPI_RunCommand_Call) RunAndReturn(run func(context.Context, ...string) error) *PluginClientAPI_RunCommand_Call { + _c.Call.Return(run) + return _c +} + +type mockConstructorTestingTNewPluginClientAPI interface { mock.TestingT Cleanup(func()) -}) *PluginClientAPI { +} + +// NewPluginClientAPI creates a new instance of PluginClientAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewPluginClientAPI(t mockConstructorTestingTNewPluginClientAPI) *PluginClientAPI { mock := &PluginClientAPI{} mock.Mock.Test(t) diff --git a/ignite/services/plugin/mocks/interface.go b/ignite/services/plugin/mocks/interface.go index fa3cb814f1..e966fe327b 100644 --- a/ignite/services/plugin/mocks/interface.go +++ b/ignite/services/plugin/mocks/interface.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -8,6 +8,7 @@ import ( mock "github.com/stretchr/testify/mock" plugin "github.com/ignite/cli/v29/ignite/services/plugin" + v1 "github.com/ignite/cli/v29/ignite/services/plugin/grpc/v1" ) @@ -254,12 +255,13 @@ func (_c *PluginInterface_Manifest_Call) RunAndReturn(run func(context.Context) return _c } -// NewPluginInterface creates a new instance of PluginInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewPluginInterface(t interface { +type mockConstructorTestingTNewPluginInterface interface { mock.TestingT Cleanup(func()) -}) *PluginInterface { +} + +// NewPluginInterface creates a new instance of PluginInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewPluginInterface(t mockConstructorTestingTNewPluginInterface) *PluginInterface { mock := &PluginInterface{} mock.Mock.Test(t) diff --git a/ignite/services/plugin/protocol.go b/ignite/services/plugin/protocol.go index 657609165b..d6753058d2 100644 --- a/ignite/services/plugin/protocol.go +++ b/ignite/services/plugin/protocol.go @@ -229,6 +229,13 @@ func (c clientAPIClient) GetChainInfo(ctx context.Context) (*ChainInfo, error) { return r.ChainInfo, nil } +func (c clientAPIClient) RunCommand(ctx context.Context, command ...string) error { + _, err := c.grpc.RunCommand(ctx, &v1.RunCommandRequest{ + Command: command, + }) + return err +} + type clientAPIServer struct { v1.UnimplementedClientAPIServiceServer @@ -243,3 +250,11 @@ func (s clientAPIServer) GetChainInfo(ctx context.Context, _ *v1.GetChainInfoReq return &v1.GetChainInfoResponse{ChainInfo: chainInfo}, nil } + +func (s clientAPIServer) RunCommand(ctx context.Context, req *v1.RunCommandRequest) (*v1.RunCommandResponse, error) { + if err := s.impl.RunCommand(ctx, req.Command...); err != nil { + return nil, err + } + + return &v1.RunCommandResponse{}, nil +} diff --git a/integration/plugin/testdata/example-plugin/go.mod b/integration/plugin/testdata/example-plugin/go.mod index 1cbc0ada56..88599bc757 100644 --- a/integration/plugin/testdata/example-plugin/go.mod +++ b/integration/plugin/testdata/example-plugin/go.mod @@ -79,18 +79,18 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.etcd.io/bbolt v1.3.9 // indirect - golang.org/x/crypto v0.23.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.21.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect - google.golang.org/grpc v1.64.0 // indirect + google.golang.org/grpc v1.64.1 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/proto/ignite/services/plugin/grpc/v1/service.proto b/proto/ignite/services/plugin/grpc/v1/service.proto index cec4fbe85a..9e9e58a186 100644 --- a/proto/ignite/services/plugin/grpc/v1/service.proto +++ b/proto/ignite/services/plugin/grpc/v1/service.proto @@ -75,6 +75,8 @@ message ExecuteHookCleanUpResponse {} service ClientAPIService { // GetChainInfo returns basic chain info for the configured app rpc GetChainInfo(GetChainInfoRequest) returns (GetChainInfoResponse); + // RunCommand runs a ignite cobra command + rpc RunCommand(RunCommandRequest) returns (RunCommandResponse); } message GetChainInfoRequest {} @@ -82,3 +84,9 @@ message GetChainInfoRequest {} message GetChainInfoResponse { ChainInfo chain_info = 1; } + +message RunCommandRequest { + repeated string command = 1; +} + +message RunCommandResponse {}