From 00fb793d9a220cbeaa90272873f621a63d6123dd Mon Sep 17 00:00:00 2001 From: algotao Date: Mon, 10 Nov 2025 15:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=AD=96=E7=95=A5=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E3=80=81=E5=88=A0=E9=99=A4=EF=BC=8C=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=81=E5=88=9B=E5=BB=BA=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E3=80=81=E8=8E=B7=E5=8F=96=E3=80=81=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- .vscode/settings.json | 12 + cmd.pb.go | 1382 +++++++++++++++++++++++++++------ cmd.proto | 101 ++- cmd/saastool/params.go | 4 + cmd/saastool/script.go | 17 +- cmd/saastool/script_create.go | 94 +++ cmd/saastool/script_delete.go | 76 ++ cmd/saastool/script_get.go | 76 ++ cmd/saastool/script_list.go | 71 ++ cmd/saastool/script_use.go | 76 ++ cmd/saastool/target.go | 6 + cmd/saastool/target_create.go | 81 ++ cmd/saastool/target_delete.go | 76 ++ cmd/saastool/term.go | 25 - pkg/saashttp/cfg.go | 77 +- pkg/saashttp/httpcli.go | 35 + 17 files changed, 1939 insertions(+), 273 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 cmd/saastool/script_create.go create mode 100644 cmd/saastool/script_delete.go create mode 100644 cmd/saastool/script_get.go create mode 100644 cmd/saastool/script_list.go create mode 100644 cmd/saastool/script_use.go create mode 100644 cmd/saastool/target_create.go create mode 100644 cmd/saastool/target_delete.go delete mode 100644 cmd/saastool/term.go diff --git a/.gitignore b/.gitignore index 6a0abfe..47ea7a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ vendor/ *.out build/ -*.lua \ No newline at end of file +*.lua +*.bak diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..113df86 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "go.useLanguageServer": true, + "[go]": { + "editor.insertSpaces": true, + "editor.tabSize": 4, + "editor.indentSize": 4 + }, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + } +} diff --git a/cmd.pb.go b/cmd.pb.go index a81d2c1..182669d 100644 --- a/cmd.pb.go +++ b/cmd.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.9 -// protoc v5.29.4 +// protoc-gen-go v1.36.10 +// protoc v6.33.0 // source: cmd.proto package saasapi @@ -135,7 +135,7 @@ const ( ErrorCode_INVALID_ACCOUNT ErrorCode = 101 // Account不合法 ErrorCode_INVALID_TIMESTAMP ErrorCode = 102 // 头信息缺少时间戳或不正确 ErrorCode_INVALID_SIGNATURE ErrorCode = 103 // 头信息缺少签名 - ErrorCode_AUTH_FAIL ErrorCode = 104 // 签名较验失败 + ErrorCode_AUTH_FAIL ErrorCode = 104 // 签名校验失败 ErrorCode_DISABLED_ACCOUNT ErrorCode = 105 // 账号已禁用 ErrorCode_INVALID_CONTENT_TYPE ErrorCode = 110 // 非法的Content-Type ErrorCode_READ_BODY ErrorCode = 111 // 读取 http body 失败 @@ -474,10 +474,16 @@ type SaasReq struct { // *SaasReq_TaskDelete // *SaasReq_TaskInfo // *SaasReq_TargetList + // *SaasReq_TargetCreate + // *SaasReq_TargetDelete // *SaasReq_BindSet // *SaasReq_BindDelete // *SaasReq_ScriptRun - // *SaasReq_ScriptUpdate + // *SaasReq_ScriptCreate + // *SaasReq_ScriptList + // *SaasReq_ScriptDelete + // *SaasReq_ScriptGet + // *SaasReq_ScriptUse // *SaasReq_ExpList // *SaasReq_ExpGet Cmd isSaasReq_Cmd `protobuf_oneof:"cmd"` @@ -612,6 +618,24 @@ func (x *SaasReq) GetTargetList() *TargetList { return nil } +func (x *SaasReq) GetTargetCreate() *TargetCreate { + if x != nil { + if x, ok := x.Cmd.(*SaasReq_TargetCreate); ok { + return x.TargetCreate + } + } + return nil +} + +func (x *SaasReq) GetTargetDelete() *TargetDelete { + if x != nil { + if x, ok := x.Cmd.(*SaasReq_TargetDelete); ok { + return x.TargetDelete + } + } + return nil +} + func (x *SaasReq) GetBindSet() *BindSet { if x != nil { if x, ok := x.Cmd.(*SaasReq_BindSet); ok { @@ -639,10 +663,46 @@ func (x *SaasReq) GetScriptRun() *ScriptRun { return nil } -func (x *SaasReq) GetScriptUpdate() *ScriptUpdate { +func (x *SaasReq) GetScriptCreate() *ScriptCreate { if x != nil { - if x, ok := x.Cmd.(*SaasReq_ScriptUpdate); ok { - return x.ScriptUpdate + if x, ok := x.Cmd.(*SaasReq_ScriptCreate); ok { + return x.ScriptCreate + } + } + return nil +} + +func (x *SaasReq) GetScriptList() *ScriptList { + if x != nil { + if x, ok := x.Cmd.(*SaasReq_ScriptList); ok { + return x.ScriptList + } + } + return nil +} + +func (x *SaasReq) GetScriptDelete() *ScriptDelete { + if x != nil { + if x, ok := x.Cmd.(*SaasReq_ScriptDelete); ok { + return x.ScriptDelete + } + } + return nil +} + +func (x *SaasReq) GetScriptGet() *ScriptGet { + if x != nil { + if x, ok := x.Cmd.(*SaasReq_ScriptGet); ok { + return x.ScriptGet + } + } + return nil +} + +func (x *SaasReq) GetScriptUse() *ScriptUse { + if x != nil { + if x, ok := x.Cmd.(*SaasReq_ScriptUse); ok { + return x.ScriptUse } } return nil @@ -710,6 +770,14 @@ type SaasReq_TargetList struct { TargetList *TargetList `protobuf:"bytes,50,opt,name=target_list,json=targetList,proto3,oneof"` // 列出策略及绑定 } +type SaasReq_TargetCreate struct { + TargetCreate *TargetCreate `protobuf:"bytes,51,opt,name=target_create,json=targetCreate,proto3,oneof"` // 创建策略 +} + +type SaasReq_TargetDelete struct { + TargetDelete *TargetDelete `protobuf:"bytes,52,opt,name=target_delete,json=targetDelete,proto3,oneof"` // 删除策略 +} + type SaasReq_BindSet struct { BindSet *BindSet `protobuf:"bytes,61,opt,name=bind_set,json=bindSet,proto3,oneof"` // 设置绑定 } @@ -722,8 +790,24 @@ type SaasReq_ScriptRun struct { ScriptRun *ScriptRun `protobuf:"bytes,90,opt,name=script_run,json=scriptRun,proto3,oneof"` // 运行脚本 } -type SaasReq_ScriptUpdate struct { - ScriptUpdate *ScriptUpdate `protobuf:"bytes,91,opt,name=script_update,json=scriptUpdate,proto3,oneof"` // 脚本升级 +type SaasReq_ScriptCreate struct { + ScriptCreate *ScriptCreate `protobuf:"bytes,91,opt,name=script_create,json=scriptCreate,proto3,oneof"` // 脚本创建 +} + +type SaasReq_ScriptList struct { + ScriptList *ScriptList `protobuf:"bytes,92,opt,name=script_list,json=scriptList,proto3,oneof"` // 列出脚本 +} + +type SaasReq_ScriptDelete struct { + ScriptDelete *ScriptDelete `protobuf:"bytes,93,opt,name=script_delete,json=scriptDelete,proto3,oneof"` // 删除脚本 +} + +type SaasReq_ScriptGet struct { + ScriptGet *ScriptGet `protobuf:"bytes,94,opt,name=script_get,json=scriptGet,proto3,oneof"` // 获取脚本内容 +} + +type SaasReq_ScriptUse struct { + ScriptUse *ScriptUse `protobuf:"bytes,95,opt,name=script_use,json=scriptUse,proto3,oneof"` // 使用脚本 } type SaasReq_ExpList struct { @@ -754,13 +838,25 @@ func (*SaasReq_TaskInfo) isSaasReq_Cmd() {} func (*SaasReq_TargetList) isSaasReq_Cmd() {} +func (*SaasReq_TargetCreate) isSaasReq_Cmd() {} + +func (*SaasReq_TargetDelete) isSaasReq_Cmd() {} + func (*SaasReq_BindSet) isSaasReq_Cmd() {} func (*SaasReq_BindDelete) isSaasReq_Cmd() {} func (*SaasReq_ScriptRun) isSaasReq_Cmd() {} -func (*SaasReq_ScriptUpdate) isSaasReq_Cmd() {} +func (*SaasReq_ScriptCreate) isSaasReq_Cmd() {} + +func (*SaasReq_ScriptList) isSaasReq_Cmd() {} + +func (*SaasReq_ScriptDelete) isSaasReq_Cmd() {} + +func (*SaasReq_ScriptGet) isSaasReq_Cmd() {} + +func (*SaasReq_ScriptUse) isSaasReq_Cmd() {} func (*SaasReq_ExpList) isSaasReq_Cmd() {} @@ -1848,6 +1944,104 @@ func (x *TargetList) GetListBind() bool { return false } +// TargetCreate 创建策略 +type TargetCreate struct { + state protoimpl.MessageState `protogen:"open.v1"` + TargetId string `protobuf:"bytes,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` // 策略ID + TargetDescription string `protobuf:"bytes,2,opt,name=target_description,json=targetDescription,proto3" json:"target_description,omitempty"` // 策略描述 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TargetCreate) Reset() { + *x = TargetCreate{} + mi := &file_cmd_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TargetCreate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TargetCreate) ProtoMessage() {} + +func (x *TargetCreate) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TargetCreate.ProtoReflect.Descriptor instead. +func (*TargetCreate) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{19} +} + +func (x *TargetCreate) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + +func (x *TargetCreate) GetTargetDescription() string { + if x != nil { + return x.TargetDescription + } + return "" +} + +// TargetDelete 删除策略 +type TargetDelete struct { + state protoimpl.MessageState `protogen:"open.v1"` + TargetId string `protobuf:"bytes,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` // 策略ID + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TargetDelete) Reset() { + *x = TargetDelete{} + mi := &file_cmd_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TargetDelete) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TargetDelete) ProtoMessage() {} + +func (x *TargetDelete) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TargetDelete.ProtoReflect.Descriptor instead. +func (*TargetDelete) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{20} +} + +func (x *TargetDelete) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + // BindSet 设置绑定 type BindSet struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -1858,7 +2052,7 @@ type BindSet struct { func (x *BindSet) Reset() { *x = BindSet{} - mi := &file_cmd_proto_msgTypes[19] + mi := &file_cmd_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1870,7 +2064,7 @@ func (x *BindSet) String() string { func (*BindSet) ProtoMessage() {} func (x *BindSet) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[19] + mi := &file_cmd_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1883,7 +2077,7 @@ func (x *BindSet) ProtoReflect() protoreflect.Message { // Deprecated: Use BindSet.ProtoReflect.Descriptor instead. func (*BindSet) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{19} + return file_cmd_proto_rawDescGZIP(), []int{21} } func (x *BindSet) GetBinds() []*Bind { @@ -1903,7 +2097,7 @@ type BindDelete struct { func (x *BindDelete) Reset() { *x = BindDelete{} - mi := &file_cmd_proto_msgTypes[20] + mi := &file_cmd_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1915,7 +2109,7 @@ func (x *BindDelete) String() string { func (*BindDelete) ProtoMessage() {} func (x *BindDelete) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[20] + mi := &file_cmd_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1928,7 +2122,7 @@ func (x *BindDelete) ProtoReflect() protoreflect.Message { // Deprecated: Use BindDelete.ProtoReflect.Descriptor instead. func (*BindDelete) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{20} + return file_cmd_proto_rawDescGZIP(), []int{22} } func (x *BindDelete) GetBinds() []*Bind { @@ -1952,7 +2146,7 @@ type ScriptRun struct { func (x *ScriptRun) Reset() { *x = ScriptRun{} - mi := &file_cmd_proto_msgTypes[21] + mi := &file_cmd_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1964,7 +2158,7 @@ func (x *ScriptRun) String() string { func (*ScriptRun) ProtoMessage() {} func (x *ScriptRun) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[21] + mi := &file_cmd_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1977,7 +2171,7 @@ func (x *ScriptRun) ProtoReflect() protoreflect.Message { // Deprecated: Use ScriptRun.ProtoReflect.Descriptor instead. func (*ScriptRun) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{21} + return file_cmd_proto_rawDescGZIP(), []int{23} } func (x *ScriptRun) GetLuaScript() string { @@ -2015,28 +2209,30 @@ func (x *ScriptRun) GetOs() OS { return OS_OS_UNKNOWN } -// ScriptUpdate 升级脚本 -type ScriptUpdate struct { +// ScriptCreate 创建脚本 +type ScriptCreate struct { state protoimpl.MessageState `protogen:"open.v1"` + LuaName string `protobuf:"bytes,2,opt,name=lua_name,json=luaName,proto3" json:"lua_name,omitempty"` // 要上传的脚本名称 + LuaScript string `protobuf:"bytes,1,opt,name=lua_script,json=luaScript,proto3" json:"lua_script,omitempty"` // 要调试的lua脚本 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ScriptUpdate) Reset() { - *x = ScriptUpdate{} - mi := &file_cmd_proto_msgTypes[22] +func (x *ScriptCreate) Reset() { + *x = ScriptCreate{} + mi := &file_cmd_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ScriptUpdate) String() string { +func (x *ScriptCreate) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ScriptUpdate) ProtoMessage() {} +func (*ScriptCreate) ProtoMessage() {} -func (x *ScriptUpdate) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[22] +func (x *ScriptCreate) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2047,9 +2243,195 @@ func (x *ScriptUpdate) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ScriptUpdate.ProtoReflect.Descriptor instead. -func (*ScriptUpdate) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{22} +// Deprecated: Use ScriptCreate.ProtoReflect.Descriptor instead. +func (*ScriptCreate) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{24} +} + +func (x *ScriptCreate) GetLuaName() string { + if x != nil { + return x.LuaName + } + return "" +} + +func (x *ScriptCreate) GetLuaScript() string { + if x != nil { + return x.LuaScript + } + return "" +} + +// ScriptList 列出脚本 +type ScriptList struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptList) Reset() { + *x = ScriptList{} + mi := &file_cmd_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptList) ProtoMessage() {} + +func (x *ScriptList) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptList.ProtoReflect.Descriptor instead. +func (*ScriptList) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{25} +} + +// ScriptDelete 删除脚本 +type ScriptDelete struct { + state protoimpl.MessageState `protogen:"open.v1"` + LuaName string `protobuf:"bytes,1,opt,name=lua_name,json=luaName,proto3" json:"lua_name,omitempty"` // 要删除的脚本名称 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptDelete) Reset() { + *x = ScriptDelete{} + mi := &file_cmd_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptDelete) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptDelete) ProtoMessage() {} + +func (x *ScriptDelete) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptDelete.ProtoReflect.Descriptor instead. +func (*ScriptDelete) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{26} +} + +func (x *ScriptDelete) GetLuaName() string { + if x != nil { + return x.LuaName + } + return "" +} + +// ScriptGet 获取脚本 +type ScriptGet struct { + state protoimpl.MessageState `protogen:"open.v1"` + LuaName string `protobuf:"bytes,1,opt,name=lua_name,json=luaName,proto3" json:"lua_name,omitempty"` // 要获取的脚本名称 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptGet) Reset() { + *x = ScriptGet{} + mi := &file_cmd_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptGet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptGet) ProtoMessage() {} + +func (x *ScriptGet) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptGet.ProtoReflect.Descriptor instead. +func (*ScriptGet) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{27} +} + +func (x *ScriptGet) GetLuaName() string { + if x != nil { + return x.LuaName + } + return "" +} + +// ScriptUse 使用脚本 +type ScriptUse struct { + state protoimpl.MessageState `protogen:"open.v1"` + LuaName string `protobuf:"bytes,1,opt,name=lua_name,json=luaName,proto3" json:"lua_name,omitempty"` // 要使用的脚本名称 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptUse) Reset() { + *x = ScriptUse{} + mi := &file_cmd_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptUse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptUse) ProtoMessage() {} + +func (x *ScriptUse) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptUse.ProtoReflect.Descriptor instead. +func (*ScriptUse) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{28} +} + +func (x *ScriptUse) GetLuaName() string { + if x != nil { + return x.LuaName + } + return "" } // ExpList 列出实验 @@ -2061,7 +2443,7 @@ type ExpList struct { func (x *ExpList) Reset() { *x = ExpList{} - mi := &file_cmd_proto_msgTypes[23] + mi := &file_cmd_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2073,7 +2455,7 @@ func (x *ExpList) String() string { func (*ExpList) ProtoMessage() {} func (x *ExpList) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[23] + mi := &file_cmd_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2086,7 +2468,7 @@ func (x *ExpList) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpList.ProtoReflect.Descriptor instead. func (*ExpList) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{23} + return file_cmd_proto_rawDescGZIP(), []int{29} } // ExpGet 获取实验报表 @@ -2114,7 +2496,7 @@ type ExpGet struct { func (x *ExpGet) Reset() { *x = ExpGet{} - mi := &file_cmd_proto_msgTypes[24] + mi := &file_cmd_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2126,7 +2508,7 @@ func (x *ExpGet) String() string { func (*ExpGet) ProtoMessage() {} func (x *ExpGet) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[24] + mi := &file_cmd_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2139,7 +2521,7 @@ func (x *ExpGet) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpGet.ProtoReflect.Descriptor instead. func (*ExpGet) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{24} + return file_cmd_proto_rawDescGZIP(), []int{30} } func (x *ExpGet) GetExtFields() []string { @@ -2214,10 +2596,16 @@ type SaasRes struct { // *SaasRes_TaskDeleteRes // *SaasRes_TaskInfoRes // *SaasRes_TargetListRes + // *SaasRes_TargetCreateRes + // *SaasRes_TargetDeleteRes // *SaasRes_BindSetRes // *SaasRes_BindDeleteRes // *SaasRes_ScriptRunRes - // *SaasRes_ScriptUpdateRes + // *SaasRes_ScriptCreateRes + // *SaasRes_ScriptListRes + // *SaasRes_ScriptDeleteRes + // *SaasRes_ScriptGetRes + // *SaasRes_ScriptUseRes // *SaasRes_ExpListRes // *SaasRes_ExpGetRes Res isSaasRes_Res `protobuf_oneof:"res"` @@ -2227,7 +2615,7 @@ type SaasRes struct { func (x *SaasRes) Reset() { *x = SaasRes{} - mi := &file_cmd_proto_msgTypes[25] + mi := &file_cmd_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2239,7 +2627,7 @@ func (x *SaasRes) String() string { func (*SaasRes) ProtoMessage() {} func (x *SaasRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[25] + mi := &file_cmd_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2252,7 +2640,7 @@ func (x *SaasRes) ProtoReflect() protoreflect.Message { // Deprecated: Use SaasRes.ProtoReflect.Descriptor instead. func (*SaasRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{25} + return file_cmd_proto_rawDescGZIP(), []int{31} } func (x *SaasRes) GetCode() ErrorCode { @@ -2357,6 +2745,24 @@ func (x *SaasRes) GetTargetListRes() *TargetListRes { return nil } +func (x *SaasRes) GetTargetCreateRes() *TargetCreateRes { + if x != nil { + if x, ok := x.Res.(*SaasRes_TargetCreateRes); ok { + return x.TargetCreateRes + } + } + return nil +} + +func (x *SaasRes) GetTargetDeleteRes() *TargetDeleteRes { + if x != nil { + if x, ok := x.Res.(*SaasRes_TargetDeleteRes); ok { + return x.TargetDeleteRes + } + } + return nil +} + func (x *SaasRes) GetBindSetRes() *BindSetRes { if x != nil { if x, ok := x.Res.(*SaasRes_BindSetRes); ok { @@ -2384,10 +2790,46 @@ func (x *SaasRes) GetScriptRunRes() *ScriptRunRes { return nil } -func (x *SaasRes) GetScriptUpdateRes() *ScriptUpdateRes { +func (x *SaasRes) GetScriptCreateRes() *ScriptCreateRes { if x != nil { - if x, ok := x.Res.(*SaasRes_ScriptUpdateRes); ok { - return x.ScriptUpdateRes + if x, ok := x.Res.(*SaasRes_ScriptCreateRes); ok { + return x.ScriptCreateRes + } + } + return nil +} + +func (x *SaasRes) GetScriptListRes() *ScriptListRes { + if x != nil { + if x, ok := x.Res.(*SaasRes_ScriptListRes); ok { + return x.ScriptListRes + } + } + return nil +} + +func (x *SaasRes) GetScriptDeleteRes() *ScriptDeleteRes { + if x != nil { + if x, ok := x.Res.(*SaasRes_ScriptDeleteRes); ok { + return x.ScriptDeleteRes + } + } + return nil +} + +func (x *SaasRes) GetScriptGetRes() *ScriptGetRes { + if x != nil { + if x, ok := x.Res.(*SaasRes_ScriptGetRes); ok { + return x.ScriptGetRes + } + } + return nil +} + +func (x *SaasRes) GetScriptUseRes() *ScriptUseRes { + if x != nil { + if x, ok := x.Res.(*SaasRes_ScriptUseRes); ok { + return x.ScriptUseRes } } return nil @@ -2451,6 +2893,14 @@ type SaasRes_TargetListRes struct { TargetListRes *TargetListRes `protobuf:"bytes,50,opt,name=target_list_res,json=targetListRes,proto3,oneof"` // 列出策略及绑定返回状态 } +type SaasRes_TargetCreateRes struct { + TargetCreateRes *TargetCreateRes `protobuf:"bytes,51,opt,name=target_create_res,json=targetCreateRes,proto3,oneof"` // 创建策略返回状态 +} + +type SaasRes_TargetDeleteRes struct { + TargetDeleteRes *TargetDeleteRes `protobuf:"bytes,52,opt,name=target_delete_res,json=targetDeleteRes,proto3,oneof"` // 删除策略返回状态 +} + type SaasRes_BindSetRes struct { BindSetRes *BindSetRes `protobuf:"bytes,61,opt,name=bind_set_res,json=bindSetRes,proto3,oneof"` // 设置绑定返回状态 } @@ -2463,8 +2913,24 @@ type SaasRes_ScriptRunRes struct { ScriptRunRes *ScriptRunRes `protobuf:"bytes,90,opt,name=script_run_res,json=scriptRunRes,proto3,oneof"` // 运行脚本返回 } -type SaasRes_ScriptUpdateRes struct { - ScriptUpdateRes *ScriptUpdateRes `protobuf:"bytes,91,opt,name=script_update_res,json=scriptUpdateRes,proto3,oneof"` // 升级脚本返回 +type SaasRes_ScriptCreateRes struct { + ScriptCreateRes *ScriptCreateRes `protobuf:"bytes,91,opt,name=script_create_res,json=scriptCreateRes,proto3,oneof"` // 创建脚本返回 +} + +type SaasRes_ScriptListRes struct { + ScriptListRes *ScriptListRes `protobuf:"bytes,92,opt,name=script_list_res,json=scriptListRes,proto3,oneof"` // 列出脚本返回 +} + +type SaasRes_ScriptDeleteRes struct { + ScriptDeleteRes *ScriptDeleteRes `protobuf:"bytes,93,opt,name=script_delete_res,json=scriptDeleteRes,proto3,oneof"` // 删除脚本返回 +} + +type SaasRes_ScriptGetRes struct { + ScriptGetRes *ScriptGetRes `protobuf:"bytes,94,opt,name=script_get_res,json=scriptGetRes,proto3,oneof"` // 获取脚本返回 +} + +type SaasRes_ScriptUseRes struct { + ScriptUseRes *ScriptUseRes `protobuf:"bytes,95,opt,name=script_use_res,json=scriptUseRes,proto3,oneof"` // 使用脚本返回 } type SaasRes_ExpListRes struct { @@ -2493,13 +2959,25 @@ func (*SaasRes_TaskInfoRes) isSaasRes_Res() {} func (*SaasRes_TargetListRes) isSaasRes_Res() {} +func (*SaasRes_TargetCreateRes) isSaasRes_Res() {} + +func (*SaasRes_TargetDeleteRes) isSaasRes_Res() {} + func (*SaasRes_BindSetRes) isSaasRes_Res() {} func (*SaasRes_BindDeleteRes) isSaasRes_Res() {} func (*SaasRes_ScriptRunRes) isSaasRes_Res() {} -func (*SaasRes_ScriptUpdateRes) isSaasRes_Res() {} +func (*SaasRes_ScriptCreateRes) isSaasRes_Res() {} + +func (*SaasRes_ScriptListRes) isSaasRes_Res() {} + +func (*SaasRes_ScriptDeleteRes) isSaasRes_Res() {} + +func (*SaasRes_ScriptGetRes) isSaasRes_Res() {} + +func (*SaasRes_ScriptUseRes) isSaasRes_Res() {} func (*SaasRes_ExpListRes) isSaasRes_Res() {} @@ -2515,7 +2993,7 @@ type DataSpace struct { func (x *DataSpace) Reset() { *x = DataSpace{} - mi := &file_cmd_proto_msgTypes[26] + mi := &file_cmd_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2527,7 +3005,7 @@ func (x *DataSpace) String() string { func (*DataSpace) ProtoMessage() {} func (x *DataSpace) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[26] + mi := &file_cmd_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2540,7 +3018,7 @@ func (x *DataSpace) ProtoReflect() protoreflect.Message { // Deprecated: Use DataSpace.ProtoReflect.Descriptor instead. func (*DataSpace) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{26} + return file_cmd_proto_rawDescGZIP(), []int{32} } func (x *DataSpace) GetDid() []string { @@ -2568,7 +3046,7 @@ type InfoRes struct { func (x *InfoRes) Reset() { *x = InfoRes{} - mi := &file_cmd_proto_msgTypes[27] + mi := &file_cmd_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2580,7 +3058,7 @@ func (x *InfoRes) String() string { func (*InfoRes) ProtoMessage() {} func (x *InfoRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[27] + mi := &file_cmd_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2593,7 +3071,7 @@ func (x *InfoRes) ProtoReflect() protoreflect.Message { // Deprecated: Use InfoRes.ProtoReflect.Descriptor instead. func (*InfoRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{27} + return file_cmd_proto_rawDescGZIP(), []int{33} } func (x *InfoRes) GetDataspace() *DataSpace { @@ -2622,7 +3100,7 @@ type ReadRes struct { func (x *ReadRes) Reset() { *x = ReadRes{} - mi := &file_cmd_proto_msgTypes[28] + mi := &file_cmd_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2634,7 +3112,7 @@ func (x *ReadRes) String() string { func (*ReadRes) ProtoMessage() {} func (x *ReadRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[28] + mi := &file_cmd_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2647,7 +3125,7 @@ func (x *ReadRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadRes.ProtoReflect.Descriptor instead. func (*ReadRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{28} + return file_cmd_proto_rawDescGZIP(), []int{34} } func (x *ReadRes) GetSuccCmdCount() uint32 { @@ -2683,7 +3161,7 @@ type WriteRes struct { func (x *WriteRes) Reset() { *x = WriteRes{} - mi := &file_cmd_proto_msgTypes[29] + mi := &file_cmd_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2695,7 +3173,7 @@ func (x *WriteRes) String() string { func (*WriteRes) ProtoMessage() {} func (x *WriteRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[29] + mi := &file_cmd_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2708,7 +3186,7 @@ func (x *WriteRes) ProtoReflect() protoreflect.Message { // Deprecated: Use WriteRes.ProtoReflect.Descriptor instead. func (*WriteRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{29} + return file_cmd_proto_rawDescGZIP(), []int{35} } func (x *WriteRes) GetFailedUserid() []string { @@ -2734,7 +3212,7 @@ type ValueItem struct { func (x *ValueItem) Reset() { *x = ValueItem{} - mi := &file_cmd_proto_msgTypes[30] + mi := &file_cmd_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2746,7 +3224,7 @@ func (x *ValueItem) String() string { func (*ValueItem) ProtoMessage() {} func (x *ValueItem) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[30] + mi := &file_cmd_proto_msgTypes[36] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2759,7 +3237,7 @@ func (x *ValueItem) ProtoReflect() protoreflect.Message { // Deprecated: Use ValueItem.ProtoReflect.Descriptor instead. func (*ValueItem) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{30} + return file_cmd_proto_rawDescGZIP(), []int{36} } func (x *ValueItem) GetCmdIndex() uint32 { @@ -2821,7 +3299,7 @@ type TaskListRes struct { func (x *TaskListRes) Reset() { *x = TaskListRes{} - mi := &file_cmd_proto_msgTypes[31] + mi := &file_cmd_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2833,7 +3311,7 @@ func (x *TaskListRes) String() string { func (*TaskListRes) ProtoMessage() {} func (x *TaskListRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[31] + mi := &file_cmd_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2846,7 +3324,7 @@ func (x *TaskListRes) ProtoReflect() protoreflect.Message { // Deprecated: Use TaskListRes.ProtoReflect.Descriptor instead. func (*TaskListRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{31} + return file_cmd_proto_rawDescGZIP(), []int{37} } func (x *TaskListRes) GetTasks() []*Task { @@ -2866,7 +3344,7 @@ type TargetListRes struct { func (x *TargetListRes) Reset() { *x = TargetListRes{} - mi := &file_cmd_proto_msgTypes[32] + mi := &file_cmd_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2878,7 +3356,7 @@ func (x *TargetListRes) String() string { func (*TargetListRes) ProtoMessage() {} func (x *TargetListRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[32] + mi := &file_cmd_proto_msgTypes[38] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2891,7 +3369,7 @@ func (x *TargetListRes) ProtoReflect() protoreflect.Message { // Deprecated: Use TargetListRes.ProtoReflect.Descriptor instead. func (*TargetListRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{32} + return file_cmd_proto_rawDescGZIP(), []int{38} } func (x *TargetListRes) GetTargetList() map[string]*Binds { @@ -2901,16 +3379,122 @@ func (x *TargetListRes) GetTargetList() map[string]*Binds { return nil } +// TargetCreateRes 策略创建返回 +type TargetCreateRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + TargetId string `protobuf:"bytes,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` // 策略ID + TargetDescription string `protobuf:"bytes,2,opt,name=target_description,json=targetDescription,proto3" json:"target_description,omitempty"` // 策略描述 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TargetCreateRes) Reset() { + *x = TargetCreateRes{} + mi := &file_cmd_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TargetCreateRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TargetCreateRes) ProtoMessage() {} + +func (x *TargetCreateRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TargetCreateRes.ProtoReflect.Descriptor instead. +func (*TargetCreateRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{39} +} + +func (x *TargetCreateRes) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + +func (x *TargetCreateRes) GetTargetDescription() string { + if x != nil { + return x.TargetDescription + } + return "" +} + +// TargetDeleteRes 策略创建返回 +type TargetDeleteRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + TargetId string `protobuf:"bytes,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` // 策略ID + TargetDescription string `protobuf:"bytes,2,opt,name=target_description,json=targetDescription,proto3" json:"target_description,omitempty"` // 策略描述 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TargetDeleteRes) Reset() { + *x = TargetDeleteRes{} + mi := &file_cmd_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TargetDeleteRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TargetDeleteRes) ProtoMessage() {} + +func (x *TargetDeleteRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TargetDeleteRes.ProtoReflect.Descriptor instead. +func (*TargetDeleteRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{40} +} + +func (x *TargetDeleteRes) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + +func (x *TargetDeleteRes) GetTargetDescription() string { + if x != nil { + return x.TargetDescription + } + return "" +} + type Binds struct { state protoimpl.MessageState `protogen:"open.v1"` - Binds []*Bind `protobuf:"bytes,1,rep,name=binds,proto3" json:"binds,omitempty"` + Binds []*Bind `protobuf:"bytes,1,rep,name=binds,proto3" json:"binds,omitempty"` // 绑定列表 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *Binds) Reset() { *x = Binds{} - mi := &file_cmd_proto_msgTypes[33] + mi := &file_cmd_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2922,7 +3506,7 @@ func (x *Binds) String() string { func (*Binds) ProtoMessage() {} func (x *Binds) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[33] + mi := &file_cmd_proto_msgTypes[41] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2935,7 +3519,7 @@ func (x *Binds) ProtoReflect() protoreflect.Message { // Deprecated: Use Binds.ProtoReflect.Descriptor instead. func (*Binds) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{33} + return file_cmd_proto_rawDescGZIP(), []int{41} } func (x *Binds) GetBinds() []*Bind { @@ -2959,7 +3543,7 @@ type Bind struct { func (x *Bind) Reset() { *x = Bind{} - mi := &file_cmd_proto_msgTypes[34] + mi := &file_cmd_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2971,7 +3555,7 @@ func (x *Bind) String() string { func (*Bind) ProtoMessage() {} func (x *Bind) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[34] + mi := &file_cmd_proto_msgTypes[42] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2984,7 +3568,7 @@ func (x *Bind) ProtoReflect() protoreflect.Message { // Deprecated: Use Bind.ProtoReflect.Descriptor instead. func (*Bind) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{34} + return file_cmd_proto_rawDescGZIP(), []int{42} } func (x *Bind) GetBindId() int64 { @@ -3034,7 +3618,7 @@ type BindSetRes struct { func (x *BindSetRes) Reset() { *x = BindSetRes{} - mi := &file_cmd_proto_msgTypes[35] + mi := &file_cmd_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3046,7 +3630,7 @@ func (x *BindSetRes) String() string { func (*BindSetRes) ProtoMessage() {} func (x *BindSetRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[35] + mi := &file_cmd_proto_msgTypes[43] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3059,7 +3643,7 @@ func (x *BindSetRes) ProtoReflect() protoreflect.Message { // Deprecated: Use BindSetRes.ProtoReflect.Descriptor instead. func (*BindSetRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{35} + return file_cmd_proto_rawDescGZIP(), []int{43} } func (x *BindSetRes) GetSuccessNum() int32 { @@ -3095,7 +3679,7 @@ type BindDeleteRes struct { func (x *BindDeleteRes) Reset() { *x = BindDeleteRes{} - mi := &file_cmd_proto_msgTypes[36] + mi := &file_cmd_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3107,7 +3691,7 @@ func (x *BindDeleteRes) String() string { func (*BindDeleteRes) ProtoMessage() {} func (x *BindDeleteRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[36] + mi := &file_cmd_proto_msgTypes[44] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3120,7 +3704,7 @@ func (x *BindDeleteRes) ProtoReflect() protoreflect.Message { // Deprecated: Use BindDeleteRes.ProtoReflect.Descriptor instead. func (*BindDeleteRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{36} + return file_cmd_proto_rawDescGZIP(), []int{44} } func (x *BindDeleteRes) GetSuccessNum() int32 { @@ -3156,7 +3740,7 @@ type BindError struct { func (x *BindError) Reset() { *x = BindError{} - mi := &file_cmd_proto_msgTypes[37] + mi := &file_cmd_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3168,7 +3752,7 @@ func (x *BindError) String() string { func (*BindError) ProtoMessage() {} func (x *BindError) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[37] + mi := &file_cmd_proto_msgTypes[45] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3181,7 +3765,7 @@ func (x *BindError) ProtoReflect() protoreflect.Message { // Deprecated: Use BindError.ProtoReflect.Descriptor instead. func (*BindError) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{37} + return file_cmd_proto_rawDescGZIP(), []int{45} } func (x *BindError) GetBindId() int64 { @@ -3218,7 +3802,7 @@ type ScriptRunRes struct { func (x *ScriptRunRes) Reset() { *x = ScriptRunRes{} - mi := &file_cmd_proto_msgTypes[38] + mi := &file_cmd_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3230,7 +3814,7 @@ func (x *ScriptRunRes) String() string { func (*ScriptRunRes) ProtoMessage() {} func (x *ScriptRunRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[38] + mi := &file_cmd_proto_msgTypes[46] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3243,7 +3827,7 @@ func (x *ScriptRunRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ScriptRunRes.ProtoReflect.Descriptor instead. func (*ScriptRunRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{38} + return file_cmd_proto_rawDescGZIP(), []int{46} } func (x *ScriptRunRes) GetPrintOutput() string { @@ -3274,28 +3858,31 @@ func (x *ScriptRunRes) GetDataspaceOut() string { return "" } -// ScriptUpdateRes 升级脚本返回 -type ScriptUpdateRes struct { +type ScriptInfo struct { state protoimpl.MessageState `protogen:"open.v1"` + LuaName string `protobuf:"bytes,1,opt,name=lua_name,json=luaName,proto3" json:"lua_name,omitempty"` // 脚本名称 + LuaScript string `protobuf:"bytes,2,opt,name=lua_script,json=luaScript,proto3" json:"lua_script,omitempty"` // 脚本内容 + LuaChecked bool `protobuf:"varint,3,opt,name=lua_checked,json=luaChecked,proto3" json:"lua_checked,omitempty"` // 脚本校验结果 + LuaUsed bool `protobuf:"varint,4,opt,name=lua_used,json=luaUsed,proto3" json:"lua_used,omitempty"` // 脚本是否被使用 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ScriptUpdateRes) Reset() { - *x = ScriptUpdateRes{} - mi := &file_cmd_proto_msgTypes[39] +func (x *ScriptInfo) Reset() { + *x = ScriptInfo{} + mi := &file_cmd_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ScriptUpdateRes) String() string { +func (x *ScriptInfo) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ScriptUpdateRes) ProtoMessage() {} +func (*ScriptInfo) ProtoMessage() {} -func (x *ScriptUpdateRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[39] +func (x *ScriptInfo) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3306,9 +3893,262 @@ func (x *ScriptUpdateRes) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ScriptUpdateRes.ProtoReflect.Descriptor instead. -func (*ScriptUpdateRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{39} +// Deprecated: Use ScriptInfo.ProtoReflect.Descriptor instead. +func (*ScriptInfo) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{47} +} + +func (x *ScriptInfo) GetLuaName() string { + if x != nil { + return x.LuaName + } + return "" +} + +func (x *ScriptInfo) GetLuaScript() string { + if x != nil { + return x.LuaScript + } + return "" +} + +func (x *ScriptInfo) GetLuaChecked() bool { + if x != nil { + return x.LuaChecked + } + return false +} + +func (x *ScriptInfo) GetLuaUsed() bool { + if x != nil { + return x.LuaUsed + } + return false +} + +// ScriptCreateRes 创建脚本返回 +type ScriptCreateRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScriptInfo *ScriptInfo `protobuf:"bytes,1,opt,name=script_info,json=scriptInfo,proto3" json:"script_info,omitempty"` // 脚本信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptCreateRes) Reset() { + *x = ScriptCreateRes{} + mi := &file_cmd_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptCreateRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptCreateRes) ProtoMessage() {} + +func (x *ScriptCreateRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptCreateRes.ProtoReflect.Descriptor instead. +func (*ScriptCreateRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{48} +} + +func (x *ScriptCreateRes) GetScriptInfo() *ScriptInfo { + if x != nil { + return x.ScriptInfo + } + return nil +} + +// ScriptListRes 脚本列表返回 +type ScriptListRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScriptInfo []*ScriptInfo `protobuf:"bytes,1,rep,name=script_info,json=scriptInfo,proto3" json:"script_info,omitempty"` // 脚本信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptListRes) Reset() { + *x = ScriptListRes{} + mi := &file_cmd_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptListRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptListRes) ProtoMessage() {} + +func (x *ScriptListRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptListRes.ProtoReflect.Descriptor instead. +func (*ScriptListRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{49} +} + +func (x *ScriptListRes) GetScriptInfo() []*ScriptInfo { + if x != nil { + return x.ScriptInfo + } + return nil +} + +// ScriptGetRes 获取脚本返回 +type ScriptGetRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScriptInfo *ScriptInfo `protobuf:"bytes,1,opt,name=script_info,json=scriptInfo,proto3" json:"script_info,omitempty"` // 脚本信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptGetRes) Reset() { + *x = ScriptGetRes{} + mi := &file_cmd_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptGetRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptGetRes) ProtoMessage() {} + +func (x *ScriptGetRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptGetRes.ProtoReflect.Descriptor instead. +func (*ScriptGetRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{50} +} + +func (x *ScriptGetRes) GetScriptInfo() *ScriptInfo { + if x != nil { + return x.ScriptInfo + } + return nil +} + +// ScriptDeleteRes 删除脚本返回 +type ScriptDeleteRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScriptInfo *ScriptInfo `protobuf:"bytes,1,opt,name=script_info,json=scriptInfo,proto3" json:"script_info,omitempty"` // 脚本信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptDeleteRes) Reset() { + *x = ScriptDeleteRes{} + mi := &file_cmd_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptDeleteRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptDeleteRes) ProtoMessage() {} + +func (x *ScriptDeleteRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptDeleteRes.ProtoReflect.Descriptor instead. +func (*ScriptDeleteRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{51} +} + +func (x *ScriptDeleteRes) GetScriptInfo() *ScriptInfo { + if x != nil { + return x.ScriptInfo + } + return nil +} + +// ScriptUseRes 使用脚本返回 +type ScriptUseRes struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScriptInfo *ScriptInfo `protobuf:"bytes,1,opt,name=script_info,json=scriptInfo,proto3" json:"script_info,omitempty"` // 脚本信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScriptUseRes) Reset() { + *x = ScriptUseRes{} + mi := &file_cmd_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScriptUseRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScriptUseRes) ProtoMessage() {} + +func (x *ScriptUseRes) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScriptUseRes.ProtoReflect.Descriptor instead. +func (*ScriptUseRes) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{52} +} + +func (x *ScriptUseRes) GetScriptInfo() *ScriptInfo { + if x != nil { + return x.ScriptInfo + } + return nil } // ExpListRes 实验列表返回 @@ -3321,7 +4161,7 @@ type ExpListRes struct { func (x *ExpListRes) Reset() { *x = ExpListRes{} - mi := &file_cmd_proto_msgTypes[40] + mi := &file_cmd_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3333,7 +4173,7 @@ func (x *ExpListRes) String() string { func (*ExpListRes) ProtoMessage() {} func (x *ExpListRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[40] + mi := &file_cmd_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3346,7 +4186,7 @@ func (x *ExpListRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpListRes.ProtoReflect.Descriptor instead. func (*ExpListRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{40} + return file_cmd_proto_rawDescGZIP(), []int{53} } func (x *ExpListRes) GetBuckets() []*ExpBucket { @@ -3367,7 +4207,7 @@ type ExpBucket struct { func (x *ExpBucket) Reset() { *x = ExpBucket{} - mi := &file_cmd_proto_msgTypes[41] + mi := &file_cmd_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3379,7 +4219,7 @@ func (x *ExpBucket) String() string { func (*ExpBucket) ProtoMessage() {} func (x *ExpBucket) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[41] + mi := &file_cmd_proto_msgTypes[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3392,7 +4232,7 @@ func (x *ExpBucket) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpBucket.ProtoReflect.Descriptor instead. func (*ExpBucket) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{41} + return file_cmd_proto_rawDescGZIP(), []int{54} } func (x *ExpBucket) GetBucketId() uint32 { @@ -3426,7 +4266,7 @@ type ExpGetRes struct { func (x *ExpGetRes) Reset() { *x = ExpGetRes{} - mi := &file_cmd_proto_msgTypes[42] + mi := &file_cmd_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3438,7 +4278,7 @@ func (x *ExpGetRes) String() string { func (*ExpGetRes) ProtoMessage() {} func (x *ExpGetRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[42] + mi := &file_cmd_proto_msgTypes[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3451,7 +4291,7 @@ func (x *ExpGetRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpGetRes.ProtoReflect.Descriptor instead. func (*ExpGetRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{42} + return file_cmd_proto_rawDescGZIP(), []int{55} } func (x *ExpGetRes) GetExpData() []*ExpData { @@ -3474,7 +4314,7 @@ type ExpData struct { func (x *ExpData) Reset() { *x = ExpData{} - mi := &file_cmd_proto_msgTypes[43] + mi := &file_cmd_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3486,7 +4326,7 @@ func (x *ExpData) String() string { func (*ExpData) ProtoMessage() {} func (x *ExpData) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[43] + mi := &file_cmd_proto_msgTypes[56] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3499,7 +4339,7 @@ func (x *ExpData) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpData.ProtoReflect.Descriptor instead. func (*ExpData) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{43} + return file_cmd_proto_rawDescGZIP(), []int{56} } func (x *ExpData) GetTime() uint64 { @@ -3556,7 +4396,7 @@ type ExpBaseFields struct { func (x *ExpBaseFields) Reset() { *x = ExpBaseFields{} - mi := &file_cmd_proto_msgTypes[44] + mi := &file_cmd_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3568,7 +4408,7 @@ func (x *ExpBaseFields) String() string { func (*ExpBaseFields) ProtoMessage() {} func (x *ExpBaseFields) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[44] + mi := &file_cmd_proto_msgTypes[57] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3581,7 +4421,7 @@ func (x *ExpBaseFields) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpBaseFields.ProtoReflect.Descriptor instead. func (*ExpBaseFields) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{44} + return file_cmd_proto_rawDescGZIP(), []int{57} } func (x *ExpBaseFields) GetCost() float64 { @@ -3665,7 +4505,7 @@ var File_cmd_proto protoreflect.FileDescriptor const file_cmd_proto_rawDesc = "" + "\n" + - "\tcmd.proto\x12\asaasapi\"\xa7\x06\n" + + "\tcmd.proto\x12\asaasapi\"\x83\t\n" + "\aSaasReq\x12#\n" + "\x04info\x18\x05 \x01(\v2\r.saasapi.InfoH\x00R\x04info\x12#\n" + "\x04read\x18\n" + @@ -3680,13 +4520,22 @@ const file_cmd_proto_rawDesc = "" + "taskDelete\x120\n" + "\ttask_info\x18\x18 \x01(\v2\x11.saasapi.TaskInfoH\x00R\btaskInfo\x126\n" + "\vtarget_list\x182 \x01(\v2\x13.saasapi.TargetListH\x00R\n" + - "targetList\x12-\n" + + "targetList\x12<\n" + + "\rtarget_create\x183 \x01(\v2\x15.saasapi.TargetCreateH\x00R\ftargetCreate\x12<\n" + + "\rtarget_delete\x184 \x01(\v2\x15.saasapi.TargetDeleteH\x00R\ftargetDelete\x12-\n" + "\bbind_set\x18= \x01(\v2\x10.saasapi.BindSetH\x00R\abindSet\x126\n" + "\vbind_delete\x18> \x01(\v2\x13.saasapi.BindDeleteH\x00R\n" + "bindDelete\x123\n" + "\n" + "script_run\x18Z \x01(\v2\x12.saasapi.ScriptRunH\x00R\tscriptRun\x12<\n" + - "\rscript_update\x18[ \x01(\v2\x15.saasapi.ScriptUpdateH\x00R\fscriptUpdate\x12-\n" + + "\rscript_create\x18[ \x01(\v2\x15.saasapi.ScriptCreateH\x00R\fscriptCreate\x126\n" + + "\vscript_list\x18\\ \x01(\v2\x13.saasapi.ScriptListH\x00R\n" + + "scriptList\x12<\n" + + "\rscript_delete\x18] \x01(\v2\x15.saasapi.ScriptDeleteH\x00R\fscriptDelete\x123\n" + + "\n" + + "script_get\x18^ \x01(\v2\x12.saasapi.ScriptGetH\x00R\tscriptGet\x123\n" + + "\n" + + "script_use\x18_ \x01(\v2\x12.saasapi.ScriptUseH\x00R\tscriptUse\x12-\n" + "\bexp_list\x18d \x01(\v2\x10.saasapi.ExpListH\x00R\aexpList\x12*\n" + "\aexp_get\x18e \x01(\v2\x0f.saasapi.ExpGetH\x00R\x06expGetB\x05\n" + "\x03cmd\"\x06\n" + @@ -3775,7 +4624,12 @@ const file_cmd_proto_rawDesc = "" + "\n" + "TargetList\x12\x18\n" + "\atargets\x18\x01 \x03(\tR\atargets\x12\x1b\n" + - "\tlist_bind\x18\x02 \x01(\bR\blistBind\".\n" + + "\tlist_bind\x18\x02 \x01(\bR\blistBind\"Z\n" + + "\fTargetCreate\x12\x1b\n" + + "\ttarget_id\x18\x01 \x01(\tR\btargetId\x12-\n" + + "\x12target_description\x18\x02 \x01(\tR\x11targetDescription\"+\n" + + "\fTargetDelete\x12\x1b\n" + + "\ttarget_id\x18\x01 \x01(\tR\btargetId\".\n" + "\aBindSet\x12#\n" + "\x05binds\x18\x02 \x03(\v2\r.saasapi.BindR\x05binds\"1\n" + "\n" + @@ -3788,8 +4642,19 @@ const file_cmd_proto_rawDesc = "" + "server_did\x18\x02 \x01(\tR\tserverDid\x12\x14\n" + "\x05appid\x18\x03 \x01(\tR\x05appid\x12#\n" + "\rserver_openid\x18\x04 \x01(\tR\fserverOpenid\x12\x1b\n" + - "\x02os\x18\x05 \x01(\x0e2\v.saasapi.OSR\x02os\"\x0e\n" + - "\fScriptUpdate\"\t\n" + + "\x02os\x18\x05 \x01(\x0e2\v.saasapi.OSR\x02os\"H\n" + + "\fScriptCreate\x12\x19\n" + + "\blua_name\x18\x02 \x01(\tR\aluaName\x12\x1d\n" + + "\n" + + "lua_script\x18\x01 \x01(\tR\tluaScript\"\f\n" + + "\n" + + "ScriptList\")\n" + + "\fScriptDelete\x12\x19\n" + + "\blua_name\x18\x01 \x01(\tR\aluaName\"&\n" + + "\tScriptGet\x12\x19\n" + + "\blua_name\x18\x01 \x01(\tR\aluaName\"&\n" + + "\tScriptUse\x12\x19\n" + + "\blua_name\x18\x01 \x01(\tR\aluaName\"\t\n" + "\aExpList\"\xa8\x02\n" + "\x06ExpGet\x12\x1d\n" + "\n" + @@ -3802,7 +4667,8 @@ const file_cmd_proto_rawDesc = "" + "\x13where_advertiser_id\x18\x0e \x03(\x04R\x11whereAdvertiserId\x12\x19\n" + "\bgroup_by\x18\x14 \x03(\tR\agroupBy\x12\x1d\n" + "\n" + - "total_flag\x18\x1e \x01(\rR\ttotalFlag\"\xa9\a\n" + + "total_flag\x18\x1e \x01(\rR\ttotalFlag\"\xc1\n" + + "\n" + "\aSaasRes\x12&\n" + "\x04code\x18\x01 \x01(\x0e2\x12.saasapi.ErrorCodeR\x04code\x12\x16\n" + "\x06status\x18\x02 \x01(\tR\x06status\x12-\n" + @@ -3816,12 +4682,18 @@ const file_cmd_proto_rawDesc = "" + "taskRunRes\x127\n" + "\x0ftask_delete_res\x18\x17 \x01(\v2\r.saasapi.TaskH\x00R\rtaskDeleteRes\x123\n" + "\rtask_info_res\x18\x18 \x01(\v2\r.saasapi.TaskH\x00R\vtaskInfoRes\x12@\n" + - "\x0ftarget_list_res\x182 \x01(\v2\x16.saasapi.TargetListResH\x00R\rtargetListRes\x127\n" + + "\x0ftarget_list_res\x182 \x01(\v2\x16.saasapi.TargetListResH\x00R\rtargetListRes\x12F\n" + + "\x11target_create_res\x183 \x01(\v2\x18.saasapi.TargetCreateResH\x00R\x0ftargetCreateRes\x12F\n" + + "\x11target_delete_res\x184 \x01(\v2\x18.saasapi.TargetDeleteResH\x00R\x0ftargetDeleteRes\x127\n" + "\fbind_set_res\x18= \x01(\v2\x13.saasapi.BindSetResH\x00R\n" + "bindSetRes\x12@\n" + "\x0fbind_delete_res\x18> \x01(\v2\x16.saasapi.BindDeleteResH\x00R\rbindDeleteRes\x12=\n" + "\x0escript_run_res\x18Z \x01(\v2\x15.saasapi.ScriptRunResH\x00R\fscriptRunRes\x12F\n" + - "\x11script_update_res\x18[ \x01(\v2\x18.saasapi.ScriptUpdateResH\x00R\x0fscriptUpdateRes\x127\n" + + "\x11script_create_res\x18[ \x01(\v2\x18.saasapi.ScriptCreateResH\x00R\x0fscriptCreateRes\x12@\n" + + "\x0fscript_list_res\x18\\ \x01(\v2\x16.saasapi.ScriptListResH\x00R\rscriptListRes\x12F\n" + + "\x11script_delete_res\x18] \x01(\v2\x18.saasapi.ScriptDeleteResH\x00R\x0fscriptDeleteRes\x12=\n" + + "\x0escript_get_res\x18^ \x01(\v2\x15.saasapi.ScriptGetResH\x00R\fscriptGetRes\x12=\n" + + "\x0escript_use_res\x18_ \x01(\v2\x15.saasapi.ScriptUseResH\x00R\fscriptUseRes\x127\n" + "\fexp_list_res\x18d \x01(\v2\x13.saasapi.ExpListResH\x00R\n" + "expListRes\x124\n" + "\vexp_get_res\x18e \x01(\v2\x12.saasapi.ExpGetResH\x00R\texpGetResB\x05\n" + @@ -3853,7 +4725,13 @@ const file_cmd_proto_rawDesc = "" + "targetList\x1aM\n" + "\x0fTargetListEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12$\n" + - "\x05value\x18\x02 \x01(\v2\x0e.saasapi.BindsR\x05value:\x028\x01\",\n" + + "\x05value\x18\x02 \x01(\v2\x0e.saasapi.BindsR\x05value:\x028\x01\"]\n" + + "\x0fTargetCreateRes\x12\x1b\n" + + "\ttarget_id\x18\x01 \x01(\tR\btargetId\x12-\n" + + "\x12target_description\x18\x02 \x01(\tR\x11targetDescription\"]\n" + + "\x0fTargetDeleteRes\x12\x1b\n" + + "\ttarget_id\x18\x01 \x01(\tR\btargetId\x12-\n" + + "\x12target_description\x18\x02 \x01(\tR\x11targetDescription\",\n" + "\x05Binds\x12#\n" + "\x05binds\x18\x01 \x03(\v2\r.saasapi.BindR\x05binds\"\xc5\x01\n" + "\x04Bind\x12\x17\n" + @@ -3883,8 +4761,30 @@ const file_cmd_proto_rawDesc = "" + "\fprint_output\x18\x01 \x01(\tR\vprintOutput\x12!\n" + "\ferror_output\x18\x02 \x01(\tR\verrorOutput\x12%\n" + "\x0etargets_output\x18\x03 \x01(\tR\rtargetsOutput\x12#\n" + - "\rdataspace_out\x18\x04 \x01(\tR\fdataspaceOut\"\x11\n" + - "\x0fScriptUpdateRes\":\n" + + "\rdataspace_out\x18\x04 \x01(\tR\fdataspaceOut\"\x82\x01\n" + + "\n" + + "ScriptInfo\x12\x19\n" + + "\blua_name\x18\x01 \x01(\tR\aluaName\x12\x1d\n" + + "\n" + + "lua_script\x18\x02 \x01(\tR\tluaScript\x12\x1f\n" + + "\vlua_checked\x18\x03 \x01(\bR\n" + + "luaChecked\x12\x19\n" + + "\blua_used\x18\x04 \x01(\bR\aluaUsed\"G\n" + + "\x0fScriptCreateRes\x124\n" + + "\vscript_info\x18\x01 \x01(\v2\x13.saasapi.ScriptInfoR\n" + + "scriptInfo\"E\n" + + "\rScriptListRes\x124\n" + + "\vscript_info\x18\x01 \x03(\v2\x13.saasapi.ScriptInfoR\n" + + "scriptInfo\"D\n" + + "\fScriptGetRes\x124\n" + + "\vscript_info\x18\x01 \x01(\v2\x13.saasapi.ScriptInfoR\n" + + "scriptInfo\"G\n" + + "\x0fScriptDeleteRes\x124\n" + + "\vscript_info\x18\x01 \x01(\v2\x13.saasapi.ScriptInfoR\n" + + "scriptInfo\"D\n" + + "\fScriptUseRes\x124\n" + + "\vscript_info\x18\x01 \x01(\v2\x13.saasapi.ScriptInfoR\n" + + "scriptInfo\":\n" + "\n" + "ExpListRes\x12,\n" + "\abuckets\x18\x01 \x03(\v2\x12.saasapi.ExpBucketR\abuckets\"^\n" + @@ -4003,7 +4903,7 @@ func file_cmd_proto_rawDescGZIP() []byte { } var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 7) -var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 48) +var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 61) var file_cmd_proto_goTypes = []any{ (BindType)(0), // 0: saasapi.BindType (BindSourceType)(0), // 1: saasapi.BindSourceType @@ -4031,35 +4931,48 @@ var file_cmd_proto_goTypes = []any{ (*FileInfo)(nil), // 23: saasapi.FileInfo (*FileBlock)(nil), // 24: saasapi.FileBlock (*TargetList)(nil), // 25: saasapi.TargetList - (*BindSet)(nil), // 26: saasapi.BindSet - (*BindDelete)(nil), // 27: saasapi.BindDelete - (*ScriptRun)(nil), // 28: saasapi.ScriptRun - (*ScriptUpdate)(nil), // 29: saasapi.ScriptUpdate - (*ExpList)(nil), // 30: saasapi.ExpList - (*ExpGet)(nil), // 31: saasapi.ExpGet - (*SaasRes)(nil), // 32: saasapi.SaasRes - (*DataSpace)(nil), // 33: saasapi.DataSpace - (*InfoRes)(nil), // 34: saasapi.InfoRes - (*ReadRes)(nil), // 35: saasapi.ReadRes - (*WriteRes)(nil), // 36: saasapi.WriteRes - (*ValueItem)(nil), // 37: saasapi.ValueItem - (*TaskListRes)(nil), // 38: saasapi.TaskListRes - (*TargetListRes)(nil), // 39: saasapi.TargetListRes - (*Binds)(nil), // 40: saasapi.Binds - (*Bind)(nil), // 41: saasapi.Bind - (*BindSetRes)(nil), // 42: saasapi.BindSetRes - (*BindDeleteRes)(nil), // 43: saasapi.BindDeleteRes - (*BindError)(nil), // 44: saasapi.BindError - (*ScriptRunRes)(nil), // 45: saasapi.ScriptRunRes - (*ScriptUpdateRes)(nil), // 46: saasapi.ScriptUpdateRes - (*ExpListRes)(nil), // 47: saasapi.ExpListRes - (*ExpBucket)(nil), // 48: saasapi.ExpBucket - (*ExpGetRes)(nil), // 49: saasapi.ExpGetRes - (*ExpData)(nil), // 50: saasapi.ExpData - (*ExpBaseFields)(nil), // 51: saasapi.ExpBaseFields - nil, // 52: saasapi.TargetListRes.TargetListEntry - nil, // 53: saasapi.ExpData.ExtFieldsEntry - nil, // 54: saasapi.ExpData.GroupEntry + (*TargetCreate)(nil), // 26: saasapi.TargetCreate + (*TargetDelete)(nil), // 27: saasapi.TargetDelete + (*BindSet)(nil), // 28: saasapi.BindSet + (*BindDelete)(nil), // 29: saasapi.BindDelete + (*ScriptRun)(nil), // 30: saasapi.ScriptRun + (*ScriptCreate)(nil), // 31: saasapi.ScriptCreate + (*ScriptList)(nil), // 32: saasapi.ScriptList + (*ScriptDelete)(nil), // 33: saasapi.ScriptDelete + (*ScriptGet)(nil), // 34: saasapi.ScriptGet + (*ScriptUse)(nil), // 35: saasapi.ScriptUse + (*ExpList)(nil), // 36: saasapi.ExpList + (*ExpGet)(nil), // 37: saasapi.ExpGet + (*SaasRes)(nil), // 38: saasapi.SaasRes + (*DataSpace)(nil), // 39: saasapi.DataSpace + (*InfoRes)(nil), // 40: saasapi.InfoRes + (*ReadRes)(nil), // 41: saasapi.ReadRes + (*WriteRes)(nil), // 42: saasapi.WriteRes + (*ValueItem)(nil), // 43: saasapi.ValueItem + (*TaskListRes)(nil), // 44: saasapi.TaskListRes + (*TargetListRes)(nil), // 45: saasapi.TargetListRes + (*TargetCreateRes)(nil), // 46: saasapi.TargetCreateRes + (*TargetDeleteRes)(nil), // 47: saasapi.TargetDeleteRes + (*Binds)(nil), // 48: saasapi.Binds + (*Bind)(nil), // 49: saasapi.Bind + (*BindSetRes)(nil), // 50: saasapi.BindSetRes + (*BindDeleteRes)(nil), // 51: saasapi.BindDeleteRes + (*BindError)(nil), // 52: saasapi.BindError + (*ScriptRunRes)(nil), // 53: saasapi.ScriptRunRes + (*ScriptInfo)(nil), // 54: saasapi.ScriptInfo + (*ScriptCreateRes)(nil), // 55: saasapi.ScriptCreateRes + (*ScriptListRes)(nil), // 56: saasapi.ScriptListRes + (*ScriptGetRes)(nil), // 57: saasapi.ScriptGetRes + (*ScriptDeleteRes)(nil), // 58: saasapi.ScriptDeleteRes + (*ScriptUseRes)(nil), // 59: saasapi.ScriptUseRes + (*ExpListRes)(nil), // 60: saasapi.ExpListRes + (*ExpBucket)(nil), // 61: saasapi.ExpBucket + (*ExpGetRes)(nil), // 62: saasapi.ExpGetRes + (*ExpData)(nil), // 63: saasapi.ExpData + (*ExpBaseFields)(nil), // 64: saasapi.ExpBaseFields + nil, // 65: saasapi.TargetListRes.TargetListEntry + nil, // 66: saasapi.ExpData.ExtFieldsEntry + nil, // 67: saasapi.ExpData.GroupEntry } var file_cmd_proto_depIdxs = []int32{ 8, // 0: saasapi.SaasReq.info:type_name -> saasapi.Info @@ -4072,66 +4985,83 @@ var file_cmd_proto_depIdxs = []int32{ 21, // 7: saasapi.SaasReq.task_delete:type_name -> saasapi.TaskDelete 22, // 8: saasapi.SaasReq.task_info:type_name -> saasapi.TaskInfo 25, // 9: saasapi.SaasReq.target_list:type_name -> saasapi.TargetList - 26, // 10: saasapi.SaasReq.bind_set:type_name -> saasapi.BindSet - 27, // 11: saasapi.SaasReq.bind_delete:type_name -> saasapi.BindDelete - 28, // 12: saasapi.SaasReq.script_run:type_name -> saasapi.ScriptRun - 29, // 13: saasapi.SaasReq.script_update:type_name -> saasapi.ScriptUpdate - 30, // 14: saasapi.SaasReq.exp_list:type_name -> saasapi.ExpList - 31, // 15: saasapi.SaasReq.exp_get:type_name -> saasapi.ExpGet - 10, // 16: saasapi.Read.read_items:type_name -> saasapi.ReadItem - 12, // 17: saasapi.Write.write_items:type_name -> saasapi.WriteItem - 13, // 18: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes - 14, // 19: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s - 15, // 20: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire - 16, // 21: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire - 13, // 22: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes - 14, // 23: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s - 15, // 24: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire - 23, // 25: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo - 4, // 26: saasapi.Task.status:type_name -> saasapi.TaskStatus - 4, // 27: saasapi.TaskList.status_filter:type_name -> saasapi.TaskStatus - 24, // 28: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock - 41, // 29: saasapi.BindSet.binds:type_name -> saasapi.Bind - 41, // 30: saasapi.BindDelete.binds:type_name -> saasapi.Bind - 5, // 31: saasapi.ScriptRun.os:type_name -> saasapi.OS - 2, // 32: saasapi.SaasRes.code:type_name -> saasapi.ErrorCode - 34, // 33: saasapi.SaasRes.info_res:type_name -> saasapi.InfoRes - 35, // 34: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes - 36, // 35: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes - 18, // 36: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task - 38, // 37: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes - 18, // 38: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task - 18, // 39: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task - 18, // 40: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task - 39, // 41: saasapi.SaasRes.target_list_res:type_name -> saasapi.TargetListRes - 42, // 42: saasapi.SaasRes.bind_set_res:type_name -> saasapi.BindSetRes - 43, // 43: saasapi.SaasRes.bind_delete_res:type_name -> saasapi.BindDeleteRes - 45, // 44: saasapi.SaasRes.script_run_res:type_name -> saasapi.ScriptRunRes - 46, // 45: saasapi.SaasRes.script_update_res:type_name -> saasapi.ScriptUpdateRes - 47, // 46: saasapi.SaasRes.exp_list_res:type_name -> saasapi.ExpListRes - 49, // 47: saasapi.SaasRes.exp_get_res:type_name -> saasapi.ExpGetRes - 33, // 48: saasapi.InfoRes.dataspace:type_name -> saasapi.DataSpace - 37, // 49: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem - 3, // 50: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode - 16, // 51: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire - 18, // 52: saasapi.TaskListRes.tasks:type_name -> saasapi.Task - 52, // 53: saasapi.TargetListRes.target_list:type_name -> saasapi.TargetListRes.TargetListEntry - 41, // 54: saasapi.Binds.binds:type_name -> saasapi.Bind - 0, // 55: saasapi.Bind.bind_type:type_name -> saasapi.BindType - 1, // 56: saasapi.Bind.bind_source:type_name -> saasapi.BindSourceType - 44, // 57: saasapi.BindSetRes.errors:type_name -> saasapi.BindError - 44, // 58: saasapi.BindDeleteRes.errors:type_name -> saasapi.BindError - 48, // 59: saasapi.ExpListRes.buckets:type_name -> saasapi.ExpBucket - 50, // 60: saasapi.ExpGetRes.exp_data:type_name -> saasapi.ExpData - 51, // 61: saasapi.ExpData.base_fields:type_name -> saasapi.ExpBaseFields - 53, // 62: saasapi.ExpData.ext_fields:type_name -> saasapi.ExpData.ExtFieldsEntry - 54, // 63: saasapi.ExpData.group:type_name -> saasapi.ExpData.GroupEntry - 40, // 64: saasapi.TargetListRes.TargetListEntry.value:type_name -> saasapi.Binds - 65, // [65:65] is the sub-list for method output_type - 65, // [65:65] is the sub-list for method input_type - 65, // [65:65] is the sub-list for extension type_name - 65, // [65:65] is the sub-list for extension extendee - 0, // [0:65] is the sub-list for field type_name + 26, // 10: saasapi.SaasReq.target_create:type_name -> saasapi.TargetCreate + 27, // 11: saasapi.SaasReq.target_delete:type_name -> saasapi.TargetDelete + 28, // 12: saasapi.SaasReq.bind_set:type_name -> saasapi.BindSet + 29, // 13: saasapi.SaasReq.bind_delete:type_name -> saasapi.BindDelete + 30, // 14: saasapi.SaasReq.script_run:type_name -> saasapi.ScriptRun + 31, // 15: saasapi.SaasReq.script_create:type_name -> saasapi.ScriptCreate + 32, // 16: saasapi.SaasReq.script_list:type_name -> saasapi.ScriptList + 33, // 17: saasapi.SaasReq.script_delete:type_name -> saasapi.ScriptDelete + 34, // 18: saasapi.SaasReq.script_get:type_name -> saasapi.ScriptGet + 35, // 19: saasapi.SaasReq.script_use:type_name -> saasapi.ScriptUse + 36, // 20: saasapi.SaasReq.exp_list:type_name -> saasapi.ExpList + 37, // 21: saasapi.SaasReq.exp_get:type_name -> saasapi.ExpGet + 10, // 22: saasapi.Read.read_items:type_name -> saasapi.ReadItem + 12, // 23: saasapi.Write.write_items:type_name -> saasapi.WriteItem + 13, // 24: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes + 14, // 25: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s + 15, // 26: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire + 16, // 27: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire + 13, // 28: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes + 14, // 29: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s + 15, // 30: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire + 23, // 31: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo + 4, // 32: saasapi.Task.status:type_name -> saasapi.TaskStatus + 4, // 33: saasapi.TaskList.status_filter:type_name -> saasapi.TaskStatus + 24, // 34: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock + 49, // 35: saasapi.BindSet.binds:type_name -> saasapi.Bind + 49, // 36: saasapi.BindDelete.binds:type_name -> saasapi.Bind + 5, // 37: saasapi.ScriptRun.os:type_name -> saasapi.OS + 2, // 38: saasapi.SaasRes.code:type_name -> saasapi.ErrorCode + 40, // 39: saasapi.SaasRes.info_res:type_name -> saasapi.InfoRes + 41, // 40: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes + 42, // 41: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes + 18, // 42: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task + 44, // 43: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes + 18, // 44: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task + 18, // 45: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task + 18, // 46: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task + 45, // 47: saasapi.SaasRes.target_list_res:type_name -> saasapi.TargetListRes + 46, // 48: saasapi.SaasRes.target_create_res:type_name -> saasapi.TargetCreateRes + 47, // 49: saasapi.SaasRes.target_delete_res:type_name -> saasapi.TargetDeleteRes + 50, // 50: saasapi.SaasRes.bind_set_res:type_name -> saasapi.BindSetRes + 51, // 51: saasapi.SaasRes.bind_delete_res:type_name -> saasapi.BindDeleteRes + 53, // 52: saasapi.SaasRes.script_run_res:type_name -> saasapi.ScriptRunRes + 55, // 53: saasapi.SaasRes.script_create_res:type_name -> saasapi.ScriptCreateRes + 56, // 54: saasapi.SaasRes.script_list_res:type_name -> saasapi.ScriptListRes + 58, // 55: saasapi.SaasRes.script_delete_res:type_name -> saasapi.ScriptDeleteRes + 57, // 56: saasapi.SaasRes.script_get_res:type_name -> saasapi.ScriptGetRes + 59, // 57: saasapi.SaasRes.script_use_res:type_name -> saasapi.ScriptUseRes + 60, // 58: saasapi.SaasRes.exp_list_res:type_name -> saasapi.ExpListRes + 62, // 59: saasapi.SaasRes.exp_get_res:type_name -> saasapi.ExpGetRes + 39, // 60: saasapi.InfoRes.dataspace:type_name -> saasapi.DataSpace + 43, // 61: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem + 3, // 62: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode + 16, // 63: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire + 18, // 64: saasapi.TaskListRes.tasks:type_name -> saasapi.Task + 65, // 65: saasapi.TargetListRes.target_list:type_name -> saasapi.TargetListRes.TargetListEntry + 49, // 66: saasapi.Binds.binds:type_name -> saasapi.Bind + 0, // 67: saasapi.Bind.bind_type:type_name -> saasapi.BindType + 1, // 68: saasapi.Bind.bind_source:type_name -> saasapi.BindSourceType + 52, // 69: saasapi.BindSetRes.errors:type_name -> saasapi.BindError + 52, // 70: saasapi.BindDeleteRes.errors:type_name -> saasapi.BindError + 54, // 71: saasapi.ScriptCreateRes.script_info:type_name -> saasapi.ScriptInfo + 54, // 72: saasapi.ScriptListRes.script_info:type_name -> saasapi.ScriptInfo + 54, // 73: saasapi.ScriptGetRes.script_info:type_name -> saasapi.ScriptInfo + 54, // 74: saasapi.ScriptDeleteRes.script_info:type_name -> saasapi.ScriptInfo + 54, // 75: saasapi.ScriptUseRes.script_info:type_name -> saasapi.ScriptInfo + 61, // 76: saasapi.ExpListRes.buckets:type_name -> saasapi.ExpBucket + 63, // 77: saasapi.ExpGetRes.exp_data:type_name -> saasapi.ExpData + 64, // 78: saasapi.ExpData.base_fields:type_name -> saasapi.ExpBaseFields + 66, // 79: saasapi.ExpData.ext_fields:type_name -> saasapi.ExpData.ExtFieldsEntry + 67, // 80: saasapi.ExpData.group:type_name -> saasapi.ExpData.GroupEntry + 48, // 81: saasapi.TargetListRes.TargetListEntry.value:type_name -> saasapi.Binds + 82, // [82:82] is the sub-list for method output_type + 82, // [82:82] is the sub-list for method input_type + 82, // [82:82] is the sub-list for extension type_name + 82, // [82:82] is the sub-list for extension extendee + 0, // [0:82] is the sub-list for field type_name } func init() { file_cmd_proto_init() } @@ -4150,14 +5080,20 @@ func file_cmd_proto_init() { (*SaasReq_TaskDelete)(nil), (*SaasReq_TaskInfo)(nil), (*SaasReq_TargetList)(nil), + (*SaasReq_TargetCreate)(nil), + (*SaasReq_TargetDelete)(nil), (*SaasReq_BindSet)(nil), (*SaasReq_BindDelete)(nil), (*SaasReq_ScriptRun)(nil), - (*SaasReq_ScriptUpdate)(nil), + (*SaasReq_ScriptCreate)(nil), + (*SaasReq_ScriptList)(nil), + (*SaasReq_ScriptDelete)(nil), + (*SaasReq_ScriptGet)(nil), + (*SaasReq_ScriptUse)(nil), (*SaasReq_ExpList)(nil), (*SaasReq_ExpGet)(nil), } - file_cmd_proto_msgTypes[25].OneofWrappers = []any{ + file_cmd_proto_msgTypes[31].OneofWrappers = []any{ (*SaasRes_InfoRes)(nil), (*SaasRes_ReadRes)(nil), (*SaasRes_WriteRes)(nil), @@ -4167,10 +5103,16 @@ func file_cmd_proto_init() { (*SaasRes_TaskDeleteRes)(nil), (*SaasRes_TaskInfoRes)(nil), (*SaasRes_TargetListRes)(nil), + (*SaasRes_TargetCreateRes)(nil), + (*SaasRes_TargetDeleteRes)(nil), (*SaasRes_BindSetRes)(nil), (*SaasRes_BindDeleteRes)(nil), (*SaasRes_ScriptRunRes)(nil), - (*SaasRes_ScriptUpdateRes)(nil), + (*SaasRes_ScriptCreateRes)(nil), + (*SaasRes_ScriptListRes)(nil), + (*SaasRes_ScriptDeleteRes)(nil), + (*SaasRes_ScriptGetRes)(nil), + (*SaasRes_ScriptUseRes)(nil), (*SaasRes_ExpListRes)(nil), (*SaasRes_ExpGetRes)(nil), } @@ -4180,7 +5122,7 @@ func file_cmd_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmd_proto_rawDesc), len(file_cmd_proto_rawDesc)), NumEnums: 7, - NumMessages: 48, + NumMessages: 61, NumExtensions: 0, NumServices: 0, }, diff --git a/cmd.proto b/cmd.proto index 273dda6..6f0a08c 100644 --- a/cmd.proto +++ b/cmd.proto @@ -20,12 +20,18 @@ message SaasReq { TaskInfo task_info = 24; // 任务详情 TargetList target_list = 50; // 列出策略及绑定 + TargetCreate target_create = 51; // 创建策略 + TargetDelete target_delete = 52; // 删除策略 BindSet bind_set = 61; // 设置绑定 BindDelete bind_delete = 62; // 解除绑定 ScriptRun script_run = 90; // 运行脚本 - ScriptUpdate script_update = 91; // 脚本升级 + ScriptCreate script_create = 91; // 脚本创建 + ScriptList script_list = 92; // 列出脚本 + ScriptDelete script_delete = 93; // 删除脚本 + ScriptGet script_get = 94; // 获取脚本内容 + ScriptUse script_use = 95; // 使用脚本 ExpList exp_list = 100; // 列出实验 ExpGet exp_get = 101; // 获取实验报表 @@ -159,6 +165,17 @@ message TargetList { bool list_bind = 2; // 是否同时列出绑定信息 } +// TargetCreate 创建策略 +message TargetCreate { + string target_id = 1; // 策略ID + string target_description = 2; // 策略描述 +} + +// TargetDelete 删除策略 +message TargetDelete { + string target_id = 1; // 策略ID +} + // BindSet 设置绑定 message BindSet { repeated Bind binds = 2; // 设置绑定内容 @@ -178,8 +195,30 @@ message ScriptRun { OS os = 5; // 操作系统 } -// ScriptUpdate 升级脚本 -message ScriptUpdate { +// ScriptCreate 创建脚本 +message ScriptCreate { + string lua_name = 2; // 要上传的脚本名称 + string lua_script = 1; // 要调试的lua脚本 +} + +// ScriptList 列出脚本 +message ScriptList { + +} + +// ScriptDelete 删除脚本 +message ScriptDelete { + string lua_name = 1; // 要删除的脚本名称 +} + +// ScriptGet 获取脚本 +message ScriptGet { + string lua_name = 1; // 要获取的脚本名称 +} + +// ScriptUse 使用脚本 +message ScriptUse { + string lua_name = 1; // 要使用的脚本名称 } // ExpList 列出实验 @@ -222,12 +261,18 @@ message SaasRes { Task task_info_res = 24; // 任务详情返回状态 TargetListRes target_list_res = 50; // 列出策略及绑定返回状态 - + TargetCreateRes target_create_res = 51; // 创建策略返回状态 + TargetDeleteRes target_delete_res = 52; // 删除策略返回状态 + BindSetRes bind_set_res = 61; // 设置绑定返回状态 BindDeleteRes bind_delete_res = 62; // 删除绑定返回状态 ScriptRunRes script_run_res = 90; // 运行脚本返回 - ScriptUpdateRes script_update_res = 91; // 升级脚本返回 + ScriptCreateRes script_create_res = 91; // 创建脚本返回 + ScriptListRes script_list_res = 92; // 列出脚本返回 + ScriptDeleteRes script_delete_res = 93; // 删除脚本返回 + ScriptGetRes script_get_res = 94; // 获取脚本返回 + ScriptUseRes script_use_res = 95; // 使用脚本返回 ExpListRes exp_list_res = 100; // 实验列表返回 ExpGetRes exp_get_res = 101; // 实验报表返回 @@ -281,8 +326,20 @@ message TargetListRes { map target_list = 1; // 绑定列表 } +// TargetCreateRes 策略创建返回 +message TargetCreateRes { + string target_id = 1; // 策略ID + string target_description = 2; // 策略描述 +} + +// TargetDeleteRes 策略创建返回 +message TargetDeleteRes { + string target_id = 1; // 策略ID + string target_description = 2; // 策略描述 +} + message Binds { - repeated Bind binds = 1; + repeated Bind binds = 1; // 绑定列表 } // Bind 绑定信息 @@ -341,8 +398,36 @@ message ScriptRunRes { string dataspace_out = 4; // 数据区输出 } -// ScriptUpdateRes 升级脚本返回 -message ScriptUpdateRes { +message ScriptInfo { + string lua_name = 1; // 脚本名称 + string lua_script = 2; // 脚本内容 + bool lua_checked = 3; // 脚本校验结果 + bool lua_used = 4; // 脚本是否被使用 +} + +// ScriptCreateRes 创建脚本返回 +message ScriptCreateRes { + ScriptInfo script_info = 1; // 脚本信息 +} + +// ScriptListRes 脚本列表返回 +message ScriptListRes { + repeated ScriptInfo script_info = 1; // 脚本信息 +} + +// ScriptGetRes 获取脚本返回 +message ScriptGetRes { + ScriptInfo script_info = 1; // 脚本信息 +} + +// ScriptDeleteRes 删除脚本返回 +message ScriptDeleteRes { + ScriptInfo script_info = 1; // 脚本信息 +} + +// ScriptUseRes 使用脚本返回 +message ScriptUseRes { + ScriptInfo script_info = 1; // 脚本信息 } // ExpListRes 实验列表返回 diff --git a/cmd/saastool/params.go b/cmd/saastool/params.go index c56c223..4df7066 100644 --- a/cmd/saastool/params.go +++ b/cmd/saastool/params.go @@ -109,6 +109,10 @@ func paramLua(fs *flag.FlagSet) *string { return fs.String("lua", "", "LUA file name") } +func paramName(fs *flag.FlagSet) *string { + return fs.String("name", "", "Name") +} + func paramDid(fs *flag.FlagSet) *string { return fs.String("did", "", "device md5 (lower case)") } diff --git a/cmd/saastool/script.go b/cmd/saastool/script.go index 7229708..2ccac5e 100644 --- a/cmd/saastool/script.go +++ b/cmd/saastool/script.go @@ -15,6 +15,16 @@ func RunScript(args ...string) error { return RunScriptHelp(args...) case "run": return RunScriptRun(args...) + case "create": + return RunScriptCreate(args...) + case "list": + return RunScriptList(args...) + case "delete": + return RunScriptDelete(args...) + case "get": + return RunScriptGet(args...) + case "use": + return RunScriptUse(args...) default: err := fmt.Errorf(`unknown command "%s"`+"\n"+`Run 'saastool script help' for usage`, name) fmt.Fprintln(os.Stderr, err) @@ -29,10 +39,15 @@ func RunScriptHelp(args ...string) error { } const scriptUsage = ` -Usage: saastoola script COMMAND [OPTIONS] +Usage: saastool script COMMAND [OPTIONS] Commands: run Run lua script test on server + create Create lua script on server + list List all scripts on server + delete Delete a script from server + get Get script content from server + use Use a script as default "help" is the default command. diff --git a/cmd/saastool/script_create.go b/cmd/saastool/script_create.go new file mode 100644 index 0000000..5bdd904 --- /dev/null +++ b/cmd/saastool/script_create.go @@ -0,0 +1,94 @@ +package main + +import ( + "flag" + "fmt" + "io" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type scriptCreateParams struct { + luaName string + luaScript string + saasHttp *saashttp.SaasClient +} + +func RunScriptCreate(args ...string) error { + fs := flag.NewFlagSet("create", flag.ExitOnError) + cfgFile := paramConfig(fs) + luaFile := paramLua(fs) + luaName := paramName(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 || len(*luaFile) == 0 || len(*luaName) == 0 { + fs.PrintDefaults() + return nil + } + + file, err := os.Open(*luaFile) + if err != nil { + fmt.Fprintln(os.Stderr, "lua file error", "err", err) + return err + } + defer file.Close() + + body, err := io.ReadAll(file) + if err != nil { + fmt.Fprintln(os.Stderr, "lua file read error", "err", err) + return err + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + scriptCreateParams := scriptCreateParams{ + luaName: *luaName, + luaScript: string(body), + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doScriptCreate(scriptCreateParams) +} + +func doScriptCreate(scriptCreateParams scriptCreateParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_ScriptCreate{ + ScriptCreate: &saasapi.ScriptCreate{ + LuaName: scriptCreateParams.luaName, + LuaScript: scriptCreateParams.luaScript, + }, + }, + } + + res, err := scriptCreateParams.saasHttp.ScriptCreate(saasReq) + if err != nil { + fmt.Fprintln(os.Stderr, "submit Create Script error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + fmt.Fprintln(os.Stderr, "script create failed", "code", res.Code, "status", res.Status) + return nil + } + + scriptRes := res.GetScriptCreateRes() + + fmt.Printf("script res: %v\n", protojson.Format(scriptRes)) + return nil +} diff --git a/cmd/saastool/script_delete.go b/cmd/saastool/script_delete.go new file mode 100644 index 0000000..2cab016 --- /dev/null +++ b/cmd/saastool/script_delete.go @@ -0,0 +1,76 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type scriptDeleteParams struct { + luaName string + saasHttp *saashttp.SaasClient +} + +func RunScriptDelete(args ...string) error { + fs := flag.NewFlagSet("delete", flag.ExitOnError) + cfgFile := paramConfig(fs) + luaName := paramName(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 || len(*luaName) == 0 { + fs.PrintDefaults() + return nil + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + scriptDeleteParams := scriptDeleteParams{ + luaName: *luaName, + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doScriptDelete(scriptDeleteParams) +} + +func doScriptDelete(scriptDeleteParams scriptDeleteParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_ScriptDelete{ + ScriptDelete: &saasapi.ScriptDelete{ + LuaName: scriptDeleteParams.luaName, + }, + }, + } + + res, err := scriptDeleteParams.saasHttp.ScriptDelete(saasReq) + if err != nil { + fmt.Fprintln(os.Stderr, "submit Delete Script error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + fmt.Fprintln(os.Stderr, "script delete failed", "code", res.Code, "status", res.Status) + return nil + } + + scriptRes := res.GetScriptDeleteRes() + + fmt.Printf("script res: %v\n", protojson.Format(scriptRes)) + return nil +} diff --git a/cmd/saastool/script_get.go b/cmd/saastool/script_get.go new file mode 100644 index 0000000..39d0d18 --- /dev/null +++ b/cmd/saastool/script_get.go @@ -0,0 +1,76 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type scriptGetParams struct { + luaName string + saasHttp *saashttp.SaasClient +} + +func RunScriptGet(args ...string) error { + fs := flag.NewFlagSet("get", flag.ExitOnError) + cfgFile := paramConfig(fs) + luaName := paramName(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 || len(*luaName) == 0 { + fs.PrintDefaults() + return nil + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + scriptGetParams := scriptGetParams{ + luaName: *luaName, + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doScriptGet(scriptGetParams) +} + +func doScriptGet(scriptGetParams scriptGetParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_ScriptGet{ + ScriptGet: &saasapi.ScriptGet{ + LuaName: scriptGetParams.luaName, + }, + }, + } + + res, err := scriptGetParams.saasHttp.ScriptGet(saasReq) + if err != nil { + fmt.Fprintln(os.Stderr, "submit Get Script error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + fmt.Fprintln(os.Stderr, "script get failed", "code", res.Code, "status", res.Status) + return nil + } + + scriptRes := res.GetScriptGetRes() + + fmt.Printf("script res: %v\n", protojson.Format(scriptRes)) + return nil +} diff --git a/cmd/saastool/script_list.go b/cmd/saastool/script_list.go new file mode 100644 index 0000000..73f38aa --- /dev/null +++ b/cmd/saastool/script_list.go @@ -0,0 +1,71 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type scriptListParams struct { + saasHttp *saashttp.SaasClient +} + +func RunScriptList(args ...string) error { + fs := flag.NewFlagSet("list", flag.ExitOnError) + cfgFile := paramConfig(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 { + fs.PrintDefaults() + return nil + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + scriptListParams := scriptListParams{ + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doScriptList(scriptListParams) +} + +func doScriptList(scriptListParams scriptListParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_ScriptList{ + ScriptList: &saasapi.ScriptList{}, + }, + } + + res, err := scriptListParams.saasHttp.ScriptList(saasReq) + if err != nil { + fmt.Fprintln(os.Stderr, "submit List Script error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + fmt.Fprintln(os.Stderr, "script list failed", "code", res.Code, "status", res.Status) + return nil + } + + scriptRes := res.GetScriptListRes() + + fmt.Printf("script res: %v\n", protojson.Format(scriptRes)) + return nil +} diff --git a/cmd/saastool/script_use.go b/cmd/saastool/script_use.go new file mode 100644 index 0000000..df0ac7d --- /dev/null +++ b/cmd/saastool/script_use.go @@ -0,0 +1,76 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type scriptUseParams struct { + luaName string + saasHttp *saashttp.SaasClient +} + +func RunScriptUse(args ...string) error { + fs := flag.NewFlagSet("use", flag.ExitOnError) + cfgFile := paramConfig(fs) + luaName := paramName(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 || len(*luaName) == 0 { + fs.PrintDefaults() + return nil + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + scriptUseParams := scriptUseParams{ + luaName: *luaName, + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doScriptUse(scriptUseParams) +} + +func doScriptUse(scriptUseParams scriptUseParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_ScriptUse{ + ScriptUse: &saasapi.ScriptUse{ + LuaName: scriptUseParams.luaName, + }, + }, + } + + res, err := scriptUseParams.saasHttp.ScriptUse(saasReq) + if err != nil { + fmt.Fprintln(os.Stderr, "submit Use Script error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + fmt.Fprintln(os.Stderr, "script use failed", "code", res.Code, "status", res.Status) + return nil + } + + scriptRes := res.GetScriptUseRes() + + fmt.Printf("script use res: %v\n", protojson.Format(scriptRes)) + return nil +} diff --git a/cmd/saastool/target.go b/cmd/saastool/target.go index 752af16..a53b330 100644 --- a/cmd/saastool/target.go +++ b/cmd/saastool/target.go @@ -15,6 +15,10 @@ func RunTarget(args ...string) error { return RunTargetHelp(args...) case "list": return RunTargetList(args...) + case "create": + return RunTargetCreate(args...) + case "delete": + return RunTargetDelete(args...) default: err := fmt.Errorf(`unknown command "%s"`+"\n"+`Run 'saastool target help' for usage`, name) fmt.Fprintln(os.Stderr, err) @@ -33,6 +37,8 @@ Usage: saastoola target COMMAND [OPTIONS] Commands: list List targets + create Create a new target + delete Delete an existing target "help" is the default command. diff --git a/cmd/saastool/target_create.go b/cmd/saastool/target_create.go new file mode 100644 index 0000000..6a9e10d --- /dev/null +++ b/cmd/saastool/target_create.go @@ -0,0 +1,81 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type createTargetParams struct { + targetId string + targetDesc string + saasHttp *saashttp.SaasClient +} + +func RunTargetCreate(args ...string) error { + fs := flag.NewFlagSet("create", flag.ExitOnError) + cfgFile := paramConfig(fs) + targetId := paramTarget(fs) + targetDesc := paramTaskDesc(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 || len(*targetId) == 0 { + fs.PrintDefaults() + return nil + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + createTargetParams := createTargetParams{ + targetId: *targetId, + targetDesc: *targetDesc, + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doTargetCreate(createTargetParams) +} + +func doTargetCreate(createTargetParams createTargetParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_TargetCreate{ + TargetCreate: &saasapi.TargetCreate{ + TargetId: createTargetParams.targetId, + TargetDescription: createTargetParams.targetDesc, + }, + }, + } + + res, err := createTargetParams.saasHttp.TargetCreate(saasReq) + + if err != nil { + fmt.Fprintln(os.Stderr, "submit Create Target error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + fmt.Fprintln(os.Stderr, "target create failed", "code", res.Code, "status", res.Status) + return nil + } + + targetRes := res.GetTargetCreateRes() + + fmt.Printf("target res: %v\n", protojson.Format(targetRes)) + return nil +} diff --git a/cmd/saastool/target_delete.go b/cmd/saastool/target_delete.go new file mode 100644 index 0000000..f7bed07 --- /dev/null +++ b/cmd/saastool/target_delete.go @@ -0,0 +1,76 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + + "git.algo.com.cn/public/saasapi" + "git.algo.com.cn/public/saasapi/pkg/saashttp" + "google.golang.org/protobuf/encoding/protojson" +) + +type deleteTargetParams struct { + targetId string + saasHttp *saashttp.SaasClient +} + +func RunTargetDelete(args ...string) error { + fs := flag.NewFlagSet("delete", flag.ExitOnError) + cfgFile := paramConfig(fs) + targetId := paramTarget(fs) + + if err := fs.Parse(args); err != nil { + fmt.Fprintln(os.Stderr, "command line parse error", "err", err) + return err + } + + if fs.NArg() > 0 || len(*targetId) == 0 { + fs.PrintDefaults() + return nil + } + + cfg, err := LoadConfigFile(*cfgFile) + if err != nil { + fmt.Fprintln(os.Stderr, "LoadConfigFile error", "err", err) + return err + } + + deleteTargetParams := deleteTargetParams{ + targetId: *targetId, + saasHttp: &saashttp.SaasClient{ + Client: &http.Client{}, + ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls), + Auth: &cfg.Auth, + }, + } + + return doTargetDelete(deleteTargetParams) +} + +func doTargetDelete(deleteTargetParams deleteTargetParams) error { + saasReq := &saasapi.SaasReq{ + Cmd: &saasapi.SaasReq_TargetDelete{ + TargetDelete: &saasapi.TargetDelete{ + TargetId: deleteTargetParams.targetId, + }, + }, + } + + res, err := deleteTargetParams.saasHttp.TargetDelete(saasReq) + if err != nil { + fmt.Fprintln(os.Stderr, "submit Target delete error", "err", err) + return err + } + + if res.Code != saasapi.ErrorCode_SUCC { + err = fmt.Errorf("target delete failed. code:%v, status:%v", res.Code, res.Status) + fmt.Fprintln(os.Stderr, err) + return err + } + + targetDeleteRes := res.GetTargetDeleteRes() + fmt.Printf("target res: %v\n", protojson.Format(targetDeleteRes)) + return nil +} diff --git a/cmd/saastool/term.go b/cmd/saastool/term.go deleted file mode 100644 index 48aa7ed..0000000 --- a/cmd/saastool/term.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "os" - "syscall" - "unsafe" -) - -// https://man7.org/linux/man-pages/man2/TIOCSWINSZ.2const.html - -// winSize console窗口大小 -type winSize struct { - wsRow uint16 - wsCols uint16 - wsXPixels uint16 - wxYPixels uint16 -} - -// getConsoleSize 获取控制台窗口大小 -func getConsoleSize() (cols, rows int) { - var sz winSize - _, _, _ = syscall.Syscall(syscall.SYS_IOCTL, - os.Stdout.Fd(), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&sz))) - return int(sz.wsCols), int(sz.wsRow) -} diff --git a/pkg/saashttp/cfg.go b/pkg/saashttp/cfg.go index 537315d..2726099 100644 --- a/pkg/saashttp/cfg.go +++ b/pkg/saashttp/cfg.go @@ -14,13 +14,25 @@ const ( taskDeletePath = "/saas/task/delete" taskRunPath = "/saas/task/run" targetListPath = "/saas/target/list" + targetCreatePath = "/saas/target/create" + targetDeletePath = "/saas/target/delete" bindSetPath = "/saas/bind/set" bindDeletePath = "/saas/bind/delete" scriptRunPath = "/saas/script/run" + scriptCreatePath = "/saas/script/create" + scriptListPath = "/saas/script/list" + scriptDeletePath = "/saas/script/delete" + scriptGetPath = "/saas/script/get" + scriptUsePath = "/saas/script/use" expListPath = "/saas/exp/list" expGetPath = "/saas/exp/get" ) +type Auth struct { + Account string + Token string +} + type ApiUrls struct { BaseUrl string InfoPath string @@ -35,9 +47,16 @@ type ApiUrls struct { TaskUploadPath string TaskDownloadPath string TargetListPath string + TargetCreatePath string + TargetDeletePath string BindSetPath string BindDeletePath string ScriptRunPath string + ScriptCreatePath string + ScriptListPath string + ScriptDeletePath string + ScriptGetPath string + ScriptUsePath string ExpListPath string ExpGetPath string } @@ -49,79 +68,76 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls { } else { r.BaseUrl = baseUrl } - if c.InfoPath != "" { r.InfoPath = c.InfoPath } else { r.InfoPath = infoPath } - if c.WritePath != "" { r.WritePath = c.WritePath } else { r.WritePath = writePath } - if c.ReadPath != "" { r.ReadPath = c.ReadPath } else { r.ReadPath = readPath } - if c.ColumnWritePath != "" { r.ColumnWritePath = c.ColumnWritePath } else { r.ColumnWritePath = columnWritePath } - if c.TaskCreatePath != "" { r.TaskCreatePath = c.TaskCreatePath } else { r.TaskCreatePath = taskCreatePath } - if c.TaskListPath != "" { r.TaskListPath = c.TaskListPath } else { r.TaskListPath = taskListPath } - if c.TaskInfoPath != "" { r.TaskInfoPath = c.TaskInfoPath } else { r.TaskInfoPath = taskInfoPath } - if c.TaskDeletePath != "" { r.TaskDeletePath = c.TaskDeletePath } else { r.TaskDeletePath = taskDeletePath } - if c.TaskRunPath != "" { r.TaskRunPath = c.TaskRunPath } else { r.TaskRunPath = taskRunPath } - if c.TaskUploadPath != "" { r.TaskUploadPath = c.TaskUploadPath } else { r.TaskUploadPath = taskUploadPath } - if c.TaskDownloadPath != "" { r.TaskDownloadPath = c.TaskDownloadPath } else { r.TaskDownloadPath = taskDownloadPath } - if c.TargetListPath != "" { r.TargetListPath = c.TargetListPath } else { r.TargetListPath = targetListPath } - + if c.TargetCreatePath != "" { + r.TargetCreatePath = c.TargetCreatePath + } else { + r.TargetCreatePath = targetCreatePath + } + if c.TargetDeletePath != "" { + r.TargetDeletePath = c.TargetDeletePath + } else { + r.TargetDeletePath = targetDeletePath + } if c.BindSetPath != "" { r.BindSetPath = c.BindSetPath } else { @@ -140,6 +156,36 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls { r.ScriptRunPath = scriptRunPath } + if c.ScriptCreatePath != "" { + r.ScriptCreatePath = c.ScriptCreatePath + } else { + r.ScriptCreatePath = scriptCreatePath + } + + if c.ScriptListPath != "" { + r.ScriptListPath = c.ScriptListPath + } else { + r.ScriptListPath = scriptListPath + } + + if c.ScriptDeletePath != "" { + r.ScriptDeletePath = c.ScriptDeletePath + } else { + r.ScriptDeletePath = scriptDeletePath + } + + if c.ScriptGetPath != "" { + r.ScriptGetPath = c.ScriptGetPath + } else { + r.ScriptGetPath = scriptGetPath + } + + if c.ScriptUsePath != "" { + r.ScriptUsePath = c.ScriptUsePath + } else { + r.ScriptUsePath = scriptUsePath + } + if c.ExpListPath != "" { r.ExpListPath = c.ExpListPath } else { @@ -154,8 +200,3 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls { return r } - -type Auth struct { - Account string - Token string -} diff --git a/pkg/saashttp/httpcli.go b/pkg/saashttp/httpcli.go index 9934f45..148cd22 100644 --- a/pkg/saashttp/httpcli.go +++ b/pkg/saashttp/httpcli.go @@ -93,6 +93,16 @@ func (c *SaasClient) TargetList(saasReq *saasapi.SaasReq) (saasRes *saasapi.Saas return c.post(postUrl, saasReq) } +func (c *SaasClient) TargetCreate(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.TargetCreatePath) + return c.post(postUrl, saasReq) +} + +func (c *SaasClient) TargetDelete(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.TargetDeletePath) + return c.post(postUrl, saasReq) +} + func (c *SaasClient) BindSet(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.BindSetPath) return c.post(postUrl, saasReq) @@ -356,3 +366,28 @@ func (c *SaasClient) download(url string, file *os.File, offset int64, size int) return saasRes, nil } + +func (c *SaasClient) ScriptCreate(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ScriptCreatePath) + return c.post(postUrl, saasReq) +} + +func (c *SaasClient) ScriptList(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ScriptListPath) + return c.post(postUrl, saasReq) +} + +func (c *SaasClient) ScriptDelete(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ScriptDeletePath) + return c.post(postUrl, saasReq) +} + +func (c *SaasClient) ScriptGet(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ScriptGetPath) + return c.post(postUrl, saasReq) +} + +func (c *SaasClient) ScriptUse(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) { + postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ScriptUsePath) + return c.post(postUrl, saasReq) +}