Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c375e9980 | ||
|
|
8785c49d0a | ||
|
|
2af5e5f466 | ||
|
|
12ed2d435a | ||
|
|
259b46f384 |
20
Makefile
Normal file
20
Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# calculate current dir
|
||||
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
docker_gen:
|
||||
docker run --rm -v ${PWD}/proto/v1:/defs namely/protoc-all:1.51_2 -l go -d . -o .
|
||||
|
||||
# generate connectors for go and ts, docs, lint, validate from proto files
|
||||
# build and push new version:
|
||||
# make bp name=pb_builder version=pb_builder-0.0.1
|
||||
regen:
|
||||
cd ./v1 && \
|
||||
protoc --go_out=./ --go_opt=paths=source_relative --go-grpc_out=./ --go-grpc_opt=paths=source_relative ./plugin.proto
|
||||
|
||||
#docker build \
|
||||
# --file $(ROOT_DIR)/build/sdk.dockerfile \
|
||||
# --tag sdk:latest $(ROOT_DIR) && \
|
||||
# docker run \
|
||||
# --rm \
|
||||
# --volume $(ROOT_DIR)/sdk:/root/sdk \
|
||||
# --name sdk_1 sdk:latest
|
||||
13
README.md
Normal file → Executable file
13
README.md
Normal file → Executable file
@@ -1,2 +1,13 @@
|
||||
# proto
|
||||
# SDK + Simple Service
|
||||
|
||||
## Описание
|
||||
|
||||
Предназначен для взаимодействия с внешними сервисами расширения.
|
||||
|
||||
## Генерация протофайла
|
||||
Выполняем в терминале:
|
||||
```shell
|
||||
make regen
|
||||
```
|
||||
|
||||
Cгенерированные файлы находятся в директории `v1`.
|
||||
|
||||
255
v1/plugin.pb.go
255
v1/plugin.pb.go
@@ -25,9 +25,8 @@ type ExecIn struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
|
||||
Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
|
||||
Params string `protobuf:"bytes,3,opt,name=params,proto3" json:"params,omitempty"`
|
||||
Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
|
||||
Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ExecIn) Reset() {
|
||||
@@ -62,13 +61,6 @@ func (*ExecIn) Descriptor() ([]byte, []int) {
|
||||
return file_plugin_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ExecIn) GetService() string {
|
||||
if x != nil {
|
||||
return x.Service
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExecIn) GetMethod() string {
|
||||
if x != nil {
|
||||
return x.Method
|
||||
@@ -138,14 +130,14 @@ func (x *ExecOut) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type ServicesIn struct {
|
||||
type ListIn struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ServicesIn) Reset() {
|
||||
*x = ServicesIn{}
|
||||
func (x *ListIn) Reset() {
|
||||
*x = ListIn{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_plugin_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -153,13 +145,13 @@ func (x *ServicesIn) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ServicesIn) String() string {
|
||||
func (x *ListIn) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServicesIn) ProtoMessage() {}
|
||||
func (*ListIn) ProtoMessage() {}
|
||||
|
||||
func (x *ServicesIn) ProtoReflect() protoreflect.Message {
|
||||
func (x *ListIn) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_plugin_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -171,21 +163,21 @@ func (x *ServicesIn) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServicesIn.ProtoReflect.Descriptor instead.
|
||||
func (*ServicesIn) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ListIn.ProtoReflect.Descriptor instead.
|
||||
func (*ListIn) Descriptor() ([]byte, []int) {
|
||||
return file_plugin_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type ServicesOut struct {
|
||||
type ListOut struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
List []string `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
|
||||
List map[string]string `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (x *ServicesOut) Reset() {
|
||||
*x = ServicesOut{}
|
||||
func (x *ListOut) Reset() {
|
||||
*x = ListOut{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_plugin_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -193,13 +185,13 @@ func (x *ServicesOut) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ServicesOut) String() string {
|
||||
func (x *ListOut) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServicesOut) ProtoMessage() {}
|
||||
func (*ListOut) ProtoMessage() {}
|
||||
|
||||
func (x *ServicesOut) ProtoReflect() protoreflect.Message {
|
||||
func (x *ListOut) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_plugin_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -211,43 +203,140 @@ func (x *ServicesOut) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServicesOut.ProtoReflect.Descriptor instead.
|
||||
func (*ServicesOut) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ListOut.ProtoReflect.Descriptor instead.
|
||||
func (*ListOut) Descriptor() ([]byte, []int) {
|
||||
return file_plugin_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ServicesOut) GetList() []string {
|
||||
func (x *ListOut) GetList() map[string]string {
|
||||
if x != nil {
|
||||
return x.List
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AliveIn struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *AliveIn) Reset() {
|
||||
*x = AliveIn{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_plugin_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AliveIn) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AliveIn) ProtoMessage() {}
|
||||
|
||||
func (x *AliveIn) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_plugin_proto_msgTypes[4]
|
||||
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 AliveIn.ProtoReflect.Descriptor instead.
|
||||
func (*AliveIn) Descriptor() ([]byte, []int) {
|
||||
return file_plugin_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type AliveOut struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
State map[string]string `protobuf:"bytes,1,rep,name=state,proto3" json:"state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (x *AliveOut) Reset() {
|
||||
*x = AliveOut{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_plugin_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AliveOut) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AliveOut) ProtoMessage() {}
|
||||
|
||||
func (x *AliveOut) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_plugin_proto_msgTypes[5]
|
||||
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 AliveOut.ProtoReflect.Descriptor instead.
|
||||
func (*AliveOut) Descriptor() ([]byte, []int) {
|
||||
return file_plugin_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *AliveOut) GetState() map[string]string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_plugin_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_plugin_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09,
|
||||
0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x52, 0x0a, 0x06, 0x45, 0x78, 0x65,
|
||||
0x63, 0x49, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d,
|
||||
0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x31, 0x0a,
|
||||
0x07, 0x45, 0x78, 0x65, 0x63, 0x4f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75,
|
||||
0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||
0x22, 0x0c, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x49, 0x6e, 0x22, 0x21,
|
||||
0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x73,
|
||||
0x74, 0x32, 0x75, 0x0a, 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x2d,
|
||||
0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x11, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
|
||||
0x6f, 0x72, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x49, 0x6e, 0x1a, 0x12, 0x2e, 0x63, 0x6f, 0x6c, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x4f, 0x75, 0x74, 0x12, 0x39, 0x0a,
|
||||
0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x15, 0x2e, 0x63, 0x6f, 0x6c, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x49, 0x6e,
|
||||
0x1a, 0x16, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x73, 0x4f, 0x75, 0x74, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
|
||||
0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x22, 0x38, 0x0a, 0x06, 0x45, 0x78, 0x65, 0x63, 0x49, 0x6e,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61,
|
||||
0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73,
|
||||
0x22, 0x31, 0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, 0x4f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72,
|
||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73,
|
||||
0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x69, 0x64, 0x22, 0x08, 0x0a, 0x06, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x22, 0x71, 0x0a,
|
||||
0x07, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e,
|
||||
0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x1a, 0x37, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x45,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
||||
0x22, 0x09, 0x0a, 0x07, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x22, 0x77, 0x0a, 0x08, 0x41,
|
||||
0x6c, 0x69, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e,
|
||||
0x41, 0x6c, 0x69, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x38, 0x0a, 0x0a, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x3a, 0x02, 0x38, 0x01, 0x32, 0x86, 0x01, 0x0a, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12,
|
||||
0x2a, 0x0a, 0x05, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69,
|
||||
0x6e, 0x2e, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x1a, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67,
|
||||
0x69, 0x6e, 0x2e, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x45,
|
||||
0x78, 0x65, 0x63, 0x12, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65,
|
||||
0x63, 0x49, 0x6e, 0x1a, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65,
|
||||
0x63, 0x4f, 0x75, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x2e, 0x70,
|
||||
0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x1a, 0x0f, 0x2e, 0x70,
|
||||
0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x42, 0x03, 0x5a,
|
||||
0x01, 0x2e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -262,23 +351,31 @@ func file_plugin_proto_rawDescGZIP() []byte {
|
||||
return file_plugin_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_plugin_proto_goTypes = []interface{}{
|
||||
(*ExecIn)(nil), // 0: simple_plugin.ExecIn
|
||||
(*ExecOut)(nil), // 1: simple_plugin.ExecOut
|
||||
(*ServicesIn)(nil), // 2: simple_plugin.ServicesIn
|
||||
(*ServicesOut)(nil), // 3: simple_plugin.ServicesOut
|
||||
(*ExecIn)(nil), // 0: plugin.ExecIn
|
||||
(*ExecOut)(nil), // 1: plugin.ExecOut
|
||||
(*ListIn)(nil), // 2: plugin.ListIn
|
||||
(*ListOut)(nil), // 3: plugin.ListOut
|
||||
(*AliveIn)(nil), // 4: plugin.AliveIn
|
||||
(*AliveOut)(nil), // 5: plugin.AliveOut
|
||||
nil, // 6: plugin.ListOut.ListEntry
|
||||
nil, // 7: plugin.AliveOut.StateEntry
|
||||
}
|
||||
var file_plugin_proto_depIdxs = []int32{
|
||||
0, // 0: simple_plugin.Collector.Exec:input_type -> simple_plugin.ExecIn
|
||||
2, // 1: simple_plugin.Collector.Services:input_type -> simple_plugin.ServicesIn
|
||||
1, // 2: simple_plugin.Collector.Exec:output_type -> simple_plugin.ExecOut
|
||||
3, // 3: simple_plugin.Collector.Services:output_type -> simple_plugin.ServicesOut
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
6, // 0: plugin.ListOut.list:type_name -> plugin.ListOut.ListEntry
|
||||
7, // 1: plugin.AliveOut.state:type_name -> plugin.AliveOut.StateEntry
|
||||
4, // 2: plugin.Plugin.Alive:input_type -> plugin.AliveIn
|
||||
0, // 3: plugin.Plugin.Exec:input_type -> plugin.ExecIn
|
||||
2, // 4: plugin.Plugin.List:input_type -> plugin.ListIn
|
||||
5, // 5: plugin.Plugin.Alive:output_type -> plugin.AliveOut
|
||||
1, // 6: plugin.Plugin.Exec:output_type -> plugin.ExecOut
|
||||
3, // 7: plugin.Plugin.List:output_type -> plugin.ListOut
|
||||
5, // [5:8] is the sub-list for method output_type
|
||||
2, // [2:5] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_plugin_proto_init() }
|
||||
@@ -312,7 +409,7 @@ func file_plugin_proto_init() {
|
||||
}
|
||||
}
|
||||
file_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ServicesIn); i {
|
||||
switch v := v.(*ListIn); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -324,7 +421,31 @@ func file_plugin_proto_init() {
|
||||
}
|
||||
}
|
||||
file_plugin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ServicesOut); i {
|
||||
switch v := v.(*ListOut); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_plugin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AliveIn); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_plugin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AliveOut); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -342,7 +463,7 @@ func file_plugin_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_plugin_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package collector;
|
||||
package plugin;
|
||||
|
||||
option go_package = ".";
|
||||
|
||||
message ExecIn {
|
||||
string service = 1;
|
||||
string method = 2;
|
||||
string params = 3;
|
||||
string method = 1;
|
||||
string params = 2;
|
||||
}
|
||||
|
||||
message ExecOut {
|
||||
@@ -15,14 +14,22 @@ message ExecOut {
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ServicesIn {
|
||||
message ListIn {
|
||||
}
|
||||
|
||||
message ServicesOut {
|
||||
repeated string list = 1;
|
||||
message ListOut {
|
||||
map<string, string> list = 1;
|
||||
}
|
||||
|
||||
service Collector {
|
||||
message AliveIn {
|
||||
}
|
||||
|
||||
message AliveOut {
|
||||
map<string, string> state = 1;
|
||||
}
|
||||
|
||||
service Plugin {
|
||||
rpc Alive(AliveIn) returns (AliveOut);
|
||||
rpc Exec(ExecIn) returns (ExecOut);
|
||||
rpc Services(ServicesIn) returns (ServicesOut);
|
||||
rpc List(ListIn) returns (ListOut);
|
||||
}
|
||||
|
||||
@@ -18,122 +18,158 @@ import (
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// CollectorClient is the client API for Collector service.
|
||||
// PluginClient is the client API for Plugin service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type CollectorClient interface {
|
||||
type PluginClient interface {
|
||||
Alive(ctx context.Context, in *AliveIn, opts ...grpc.CallOption) (*AliveOut, error)
|
||||
Exec(ctx context.Context, in *ExecIn, opts ...grpc.CallOption) (*ExecOut, error)
|
||||
Services(ctx context.Context, in *ServicesIn, opts ...grpc.CallOption) (*ServicesOut, error)
|
||||
List(ctx context.Context, in *ListIn, opts ...grpc.CallOption) (*ListOut, error)
|
||||
}
|
||||
|
||||
type collectorClient struct {
|
||||
type pluginClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewCollectorClient(cc grpc.ClientConnInterface) CollectorClient {
|
||||
return &collectorClient{cc}
|
||||
func NewPluginClient(cc grpc.ClientConnInterface) PluginClient {
|
||||
return &pluginClient{cc}
|
||||
}
|
||||
|
||||
func (c *collectorClient) Exec(ctx context.Context, in *ExecIn, opts ...grpc.CallOption) (*ExecOut, error) {
|
||||
func (c *pluginClient) Alive(ctx context.Context, in *AliveIn, opts ...grpc.CallOption) (*AliveOut, error) {
|
||||
out := new(AliveOut)
|
||||
err := c.cc.Invoke(ctx, "/plugin.Plugin/Alive", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *pluginClient) Exec(ctx context.Context, in *ExecIn, opts ...grpc.CallOption) (*ExecOut, error) {
|
||||
out := new(ExecOut)
|
||||
err := c.cc.Invoke(ctx, "/simple_plugin.Collector/Exec", in, out, opts...)
|
||||
err := c.cc.Invoke(ctx, "/plugin.Plugin/Exec", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *collectorClient) Services(ctx context.Context, in *ServicesIn, opts ...grpc.CallOption) (*ServicesOut, error) {
|
||||
out := new(ServicesOut)
|
||||
err := c.cc.Invoke(ctx, "/simple_plugin.Collector/Services", in, out, opts...)
|
||||
func (c *pluginClient) List(ctx context.Context, in *ListIn, opts ...grpc.CallOption) (*ListOut, error) {
|
||||
out := new(ListOut)
|
||||
err := c.cc.Invoke(ctx, "/plugin.Plugin/List", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CollectorServer is the server API for Collector service.
|
||||
// All implementations must embed UnimplementedCollectorServer
|
||||
// PluginServer is the server API for Plugin service.
|
||||
// All implementations must embed UnimplementedPluginServer
|
||||
// for forward compatibility
|
||||
type CollectorServer interface {
|
||||
type PluginServer interface {
|
||||
Alive(context.Context, *AliveIn) (*AliveOut, error)
|
||||
Exec(context.Context, *ExecIn) (*ExecOut, error)
|
||||
Services(context.Context, *ServicesIn) (*ServicesOut, error)
|
||||
mustEmbedUnimplementedCollectorServer()
|
||||
List(context.Context, *ListIn) (*ListOut, error)
|
||||
mustEmbedUnimplementedPluginServer()
|
||||
}
|
||||
|
||||
// UnimplementedCollectorServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedCollectorServer struct {
|
||||
// UnimplementedPluginServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedPluginServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedCollectorServer) Exec(context.Context, *ExecIn) (*ExecOut, error) {
|
||||
func (UnimplementedPluginServer) Alive(context.Context, *AliveIn) (*AliveOut, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Alive not implemented")
|
||||
}
|
||||
func (UnimplementedPluginServer) Exec(context.Context, *ExecIn) (*ExecOut, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Exec not implemented")
|
||||
}
|
||||
func (UnimplementedCollectorServer) Services(context.Context, *ServicesIn) (*ServicesOut, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Services not implemented")
|
||||
func (UnimplementedPluginServer) List(context.Context, *ListIn) (*ListOut, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
||||
}
|
||||
func (UnimplementedCollectorServer) mustEmbedUnimplementedCollectorServer() {}
|
||||
func (UnimplementedPluginServer) mustEmbedUnimplementedPluginServer() {}
|
||||
|
||||
// UnsafeCollectorServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to CollectorServer will
|
||||
// UnsafePluginServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PluginServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeCollectorServer interface {
|
||||
mustEmbedUnimplementedCollectorServer()
|
||||
type UnsafePluginServer interface {
|
||||
mustEmbedUnimplementedPluginServer()
|
||||
}
|
||||
|
||||
func RegisterCollectorServer(s grpc.ServiceRegistrar, srv CollectorServer) {
|
||||
s.RegisterService(&Collector_ServiceDesc, srv)
|
||||
func RegisterPluginServer(s grpc.ServiceRegistrar, srv PluginServer) {
|
||||
s.RegisterService(&Plugin_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Collector_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _Plugin_Alive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AliveIn)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PluginServer).Alive(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/plugin.Plugin/Alive",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PluginServer).Alive(ctx, req.(*AliveIn))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Plugin_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExecIn)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CollectorServer).Exec(ctx, in)
|
||||
return srv.(PluginServer).Exec(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/simple_plugin.Collector/Exec",
|
||||
FullMethod: "/plugin.Plugin/Exec",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CollectorServer).Exec(ctx, req.(*ExecIn))
|
||||
return srv.(PluginServer).Exec(ctx, req.(*ExecIn))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Collector_Services_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ServicesIn)
|
||||
func _Plugin_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListIn)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CollectorServer).Services(ctx, in)
|
||||
return srv.(PluginServer).List(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/simple_plugin.Collector/Services",
|
||||
FullMethod: "/plugin.Plugin/List",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CollectorServer).Services(ctx, req.(*ServicesIn))
|
||||
return srv.(PluginServer).List(ctx, req.(*ListIn))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Collector_ServiceDesc is the grpc.ServiceDesc for Collector service.
|
||||
// Plugin_ServiceDesc is the grpc.ServiceDesc for Plugin service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Collector_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "simple_plugin.Collector",
|
||||
HandlerType: (*CollectorServer)(nil),
|
||||
var Plugin_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "plugin.Plugin",
|
||||
HandlerType: (*PluginServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Exec",
|
||||
Handler: _Collector_Exec_Handler,
|
||||
MethodName: "Alive",
|
||||
Handler: _Plugin_Alive_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Services",
|
||||
Handler: _Collector_Services_Handler,
|
||||
MethodName: "Exec",
|
||||
Handler: _Plugin_Exec_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "List",
|
||||
Handler: _Plugin_List_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
|
||||
Reference in New Issue
Block a user