saastool增加docker/daemon模式

This commit is contained in:
algotao
2025-09-24 18:38:03 +08:00
parent a88c5c6e3f
commit d7ab7b5156
14 changed files with 1023 additions and 120 deletions

541
cmd.pb.go
View File

@@ -472,6 +472,8 @@ type SaasReq struct {
// *SaasReq_BindDelete
// *SaasReq_ScriptRun
// *SaasReq_ScriptUpdate
// *SaasReq_ExpList
// *SaasReq_ExpGet
Cmd isSaasReq_Cmd `protobuf_oneof:"cmd"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -640,6 +642,24 @@ func (x *SaasReq) GetScriptUpdate() *ScriptUpdate {
return nil
}
func (x *SaasReq) GetExpList() *ExpList {
if x != nil {
if x, ok := x.Cmd.(*SaasReq_ExpList); ok {
return x.ExpList
}
}
return nil
}
func (x *SaasReq) GetExpGet() *ExpGet {
if x != nil {
if x, ok := x.Cmd.(*SaasReq_ExpGet); ok {
return x.ExpGet
}
}
return nil
}
type isSaasReq_Cmd interface {
isSaasReq_Cmd()
}
@@ -700,6 +720,14 @@ type SaasReq_ScriptUpdate struct {
ScriptUpdate *ScriptUpdate `protobuf:"bytes,91,opt,name=script_update,json=scriptUpdate,proto3,oneof"` // 脚本升级
}
type SaasReq_ExpList struct {
ExpList *ExpList `protobuf:"bytes,100,opt,name=exp_list,json=expList,proto3,oneof"` // 列出实验
}
type SaasReq_ExpGet struct {
ExpGet *ExpGet `protobuf:"bytes,101,opt,name=exp_get,json=expGet,proto3,oneof"` // 获取实验报表
}
func (*SaasReq_Info) isSaasReq_Cmd() {}
func (*SaasReq_Read) isSaasReq_Cmd() {}
@@ -728,6 +756,10 @@ func (*SaasReq_ScriptRun) isSaasReq_Cmd() {}
func (*SaasReq_ScriptUpdate) isSaasReq_Cmd() {}
func (*SaasReq_ExpList) isSaasReq_Cmd() {}
func (*SaasReq_ExpGet) isSaasReq_Cmd() {}
// Info 获取账号信息
type Info struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -2024,6 +2056,80 @@ func (*ScriptUpdate) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{22}
}
// ExpList 列出实验
type ExpList struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpList) Reset() {
*x = ExpList{}
mi := &file_cmd_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpList) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpList) ProtoMessage() {}
func (x *ExpList) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[23]
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 ExpList.ProtoReflect.Descriptor instead.
func (*ExpList) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{23}
}
// ExpGet 获取实验报表
type ExpGet struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpGet) Reset() {
*x = ExpGet{}
mi := &file_cmd_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpGet) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpGet) ProtoMessage() {}
func (x *ExpGet) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[24]
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 ExpGet.ProtoReflect.Descriptor instead.
func (*ExpGet) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{24}
}
// SaasRes 命令返回
type SaasRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -2044,6 +2150,8 @@ type SaasRes struct {
// *SaasRes_BindDeleteRes
// *SaasRes_ScriptRunRes
// *SaasRes_ScriptUpdateRes
// *SaasRes_ExpListRes
// *SaasRes_ExpGetRes
Res isSaasRes_Res `protobuf_oneof:"res"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -2051,7 +2159,7 @@ type SaasRes struct {
func (x *SaasRes) Reset() {
*x = SaasRes{}
mi := &file_cmd_proto_msgTypes[23]
mi := &file_cmd_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2063,7 +2171,7 @@ func (x *SaasRes) String() string {
func (*SaasRes) ProtoMessage() {}
func (x *SaasRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[23]
mi := &file_cmd_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2076,7 +2184,7 @@ func (x *SaasRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use SaasRes.ProtoReflect.Descriptor instead.
func (*SaasRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{23}
return file_cmd_proto_rawDescGZIP(), []int{25}
}
func (x *SaasRes) GetCode() ErrorCode {
@@ -2217,6 +2325,24 @@ func (x *SaasRes) GetScriptUpdateRes() *ScriptUpdateRes {
return nil
}
func (x *SaasRes) GetExpListRes() *ExpListRes {
if x != nil {
if x, ok := x.Res.(*SaasRes_ExpListRes); ok {
return x.ExpListRes
}
}
return nil
}
func (x *SaasRes) GetExpGetRes() *ExpGetRes {
if x != nil {
if x, ok := x.Res.(*SaasRes_ExpGetRes); ok {
return x.ExpGetRes
}
}
return nil
}
type isSaasRes_Res interface {
isSaasRes_Res()
}
@@ -2273,6 +2399,14 @@ type SaasRes_ScriptUpdateRes struct {
ScriptUpdateRes *ScriptUpdateRes `protobuf:"bytes,91,opt,name=script_update_res,json=scriptUpdateRes,proto3,oneof"` // 升级脚本返回
}
type SaasRes_ExpListRes struct {
ExpListRes *ExpListRes `protobuf:"bytes,100,opt,name=exp_list_res,json=expListRes,proto3,oneof"` // 实验列表返回
}
type SaasRes_ExpGetRes struct {
ExpGetRes *ExpGetRes `protobuf:"bytes,101,opt,name=exp_get_res,json=expGetRes,proto3,oneof"` // 实验报表返回
}
func (*SaasRes_InfoRes) isSaasRes_Res() {}
func (*SaasRes_ReadRes) isSaasRes_Res() {}
@@ -2299,6 +2433,10 @@ func (*SaasRes_ScriptRunRes) isSaasRes_Res() {}
func (*SaasRes_ScriptUpdateRes) isSaasRes_Res() {}
func (*SaasRes_ExpListRes) isSaasRes_Res() {}
func (*SaasRes_ExpGetRes) isSaasRes_Res() {}
type DataSpace struct {
state protoimpl.MessageState `protogen:"open.v1"`
Did []string `protobuf:"bytes,1,rep,name=did,proto3" json:"did,omitempty"` // 设备ID区
@@ -2309,7 +2447,7 @@ type DataSpace struct {
func (x *DataSpace) Reset() {
*x = DataSpace{}
mi := &file_cmd_proto_msgTypes[24]
mi := &file_cmd_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2321,7 +2459,7 @@ func (x *DataSpace) String() string {
func (*DataSpace) ProtoMessage() {}
func (x *DataSpace) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[24]
mi := &file_cmd_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2334,7 +2472,7 @@ func (x *DataSpace) ProtoReflect() protoreflect.Message {
// Deprecated: Use DataSpace.ProtoReflect.Descriptor instead.
func (*DataSpace) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{24}
return file_cmd_proto_rawDescGZIP(), []int{26}
}
func (x *DataSpace) GetDid() []string {
@@ -2362,7 +2500,7 @@ type InfoRes struct {
func (x *InfoRes) Reset() {
*x = InfoRes{}
mi := &file_cmd_proto_msgTypes[25]
mi := &file_cmd_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2374,7 +2512,7 @@ func (x *InfoRes) String() string {
func (*InfoRes) ProtoMessage() {}
func (x *InfoRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[25]
mi := &file_cmd_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2387,7 +2525,7 @@ func (x *InfoRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use InfoRes.ProtoReflect.Descriptor instead.
func (*InfoRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{25}
return file_cmd_proto_rawDescGZIP(), []int{27}
}
func (x *InfoRes) GetDataspace() *DataSpace {
@@ -2416,7 +2554,7 @@ type ReadRes struct {
func (x *ReadRes) Reset() {
*x = ReadRes{}
mi := &file_cmd_proto_msgTypes[26]
mi := &file_cmd_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2428,7 +2566,7 @@ func (x *ReadRes) String() string {
func (*ReadRes) ProtoMessage() {}
func (x *ReadRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[26]
mi := &file_cmd_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2441,7 +2579,7 @@ func (x *ReadRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use ReadRes.ProtoReflect.Descriptor instead.
func (*ReadRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{26}
return file_cmd_proto_rawDescGZIP(), []int{28}
}
func (x *ReadRes) GetSuccCmdCount() uint32 {
@@ -2477,7 +2615,7 @@ type WriteRes struct {
func (x *WriteRes) Reset() {
*x = WriteRes{}
mi := &file_cmd_proto_msgTypes[27]
mi := &file_cmd_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2489,7 +2627,7 @@ func (x *WriteRes) String() string {
func (*WriteRes) ProtoMessage() {}
func (x *WriteRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[27]
mi := &file_cmd_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2502,7 +2640,7 @@ func (x *WriteRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use WriteRes.ProtoReflect.Descriptor instead.
func (*WriteRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{27}
return file_cmd_proto_rawDescGZIP(), []int{29}
}
func (x *WriteRes) GetFailedUserid() []string {
@@ -2528,7 +2666,7 @@ type ValueItem struct {
func (x *ValueItem) Reset() {
*x = ValueItem{}
mi := &file_cmd_proto_msgTypes[28]
mi := &file_cmd_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2540,7 +2678,7 @@ func (x *ValueItem) String() string {
func (*ValueItem) ProtoMessage() {}
func (x *ValueItem) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[28]
mi := &file_cmd_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2553,7 +2691,7 @@ func (x *ValueItem) ProtoReflect() protoreflect.Message {
// Deprecated: Use ValueItem.ProtoReflect.Descriptor instead.
func (*ValueItem) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{28}
return file_cmd_proto_rawDescGZIP(), []int{30}
}
func (x *ValueItem) GetCmdIndex() uint32 {
@@ -2615,7 +2753,7 @@ type TaskListRes struct {
func (x *TaskListRes) Reset() {
*x = TaskListRes{}
mi := &file_cmd_proto_msgTypes[29]
mi := &file_cmd_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2627,7 +2765,7 @@ func (x *TaskListRes) String() string {
func (*TaskListRes) ProtoMessage() {}
func (x *TaskListRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[29]
mi := &file_cmd_proto_msgTypes[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2640,7 +2778,7 @@ func (x *TaskListRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskListRes.ProtoReflect.Descriptor instead.
func (*TaskListRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{29}
return file_cmd_proto_rawDescGZIP(), []int{31}
}
func (x *TaskListRes) GetTasks() []*Task {
@@ -2660,7 +2798,7 @@ type TargetListRes struct {
func (x *TargetListRes) Reset() {
*x = TargetListRes{}
mi := &file_cmd_proto_msgTypes[30]
mi := &file_cmd_proto_msgTypes[32]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2672,7 +2810,7 @@ func (x *TargetListRes) String() string {
func (*TargetListRes) ProtoMessage() {}
func (x *TargetListRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[30]
mi := &file_cmd_proto_msgTypes[32]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2685,7 +2823,7 @@ func (x *TargetListRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use TargetListRes.ProtoReflect.Descriptor instead.
func (*TargetListRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{30}
return file_cmd_proto_rawDescGZIP(), []int{32}
}
func (x *TargetListRes) GetTargetList() map[string]*Binds {
@@ -2704,7 +2842,7 @@ type Binds struct {
func (x *Binds) Reset() {
*x = Binds{}
mi := &file_cmd_proto_msgTypes[31]
mi := &file_cmd_proto_msgTypes[33]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2716,7 +2854,7 @@ func (x *Binds) String() string {
func (*Binds) ProtoMessage() {}
func (x *Binds) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[31]
mi := &file_cmd_proto_msgTypes[33]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2729,7 +2867,7 @@ func (x *Binds) ProtoReflect() protoreflect.Message {
// Deprecated: Use Binds.ProtoReflect.Descriptor instead.
func (*Binds) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{31}
return file_cmd_proto_rawDescGZIP(), []int{33}
}
func (x *Binds) GetBinds() []*Bind {
@@ -2753,7 +2891,7 @@ type Bind struct {
func (x *Bind) Reset() {
*x = Bind{}
mi := &file_cmd_proto_msgTypes[32]
mi := &file_cmd_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2765,7 +2903,7 @@ func (x *Bind) String() string {
func (*Bind) ProtoMessage() {}
func (x *Bind) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[32]
mi := &file_cmd_proto_msgTypes[34]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2778,7 +2916,7 @@ func (x *Bind) ProtoReflect() protoreflect.Message {
// Deprecated: Use Bind.ProtoReflect.Descriptor instead.
func (*Bind) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{32}
return file_cmd_proto_rawDescGZIP(), []int{34}
}
func (x *Bind) GetBindId() int64 {
@@ -2828,7 +2966,7 @@ type BindSetRes struct {
func (x *BindSetRes) Reset() {
*x = BindSetRes{}
mi := &file_cmd_proto_msgTypes[33]
mi := &file_cmd_proto_msgTypes[35]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2840,7 +2978,7 @@ func (x *BindSetRes) String() string {
func (*BindSetRes) ProtoMessage() {}
func (x *BindSetRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[33]
mi := &file_cmd_proto_msgTypes[35]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2853,7 +2991,7 @@ func (x *BindSetRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use BindSetRes.ProtoReflect.Descriptor instead.
func (*BindSetRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{33}
return file_cmd_proto_rawDescGZIP(), []int{35}
}
func (x *BindSetRes) GetSuccessNum() int32 {
@@ -2889,7 +3027,7 @@ type BindDeleteRes struct {
func (x *BindDeleteRes) Reset() {
*x = BindDeleteRes{}
mi := &file_cmd_proto_msgTypes[34]
mi := &file_cmd_proto_msgTypes[36]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2901,7 +3039,7 @@ func (x *BindDeleteRes) String() string {
func (*BindDeleteRes) ProtoMessage() {}
func (x *BindDeleteRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[34]
mi := &file_cmd_proto_msgTypes[36]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2914,7 +3052,7 @@ func (x *BindDeleteRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use BindDeleteRes.ProtoReflect.Descriptor instead.
func (*BindDeleteRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{34}
return file_cmd_proto_rawDescGZIP(), []int{36}
}
func (x *BindDeleteRes) GetSuccessNum() int32 {
@@ -2950,7 +3088,7 @@ type BindError struct {
func (x *BindError) Reset() {
*x = BindError{}
mi := &file_cmd_proto_msgTypes[35]
mi := &file_cmd_proto_msgTypes[37]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2962,7 +3100,7 @@ func (x *BindError) String() string {
func (*BindError) ProtoMessage() {}
func (x *BindError) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[35]
mi := &file_cmd_proto_msgTypes[37]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2975,7 +3113,7 @@ func (x *BindError) ProtoReflect() protoreflect.Message {
// Deprecated: Use BindError.ProtoReflect.Descriptor instead.
func (*BindError) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{35}
return file_cmd_proto_rawDescGZIP(), []int{37}
}
func (x *BindError) GetBindId() int64 {
@@ -3012,7 +3150,7 @@ type ScriptRunRes struct {
func (x *ScriptRunRes) Reset() {
*x = ScriptRunRes{}
mi := &file_cmd_proto_msgTypes[36]
mi := &file_cmd_proto_msgTypes[38]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3024,7 +3162,7 @@ func (x *ScriptRunRes) String() string {
func (*ScriptRunRes) ProtoMessage() {}
func (x *ScriptRunRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[36]
mi := &file_cmd_proto_msgTypes[38]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3037,7 +3175,7 @@ func (x *ScriptRunRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use ScriptRunRes.ProtoReflect.Descriptor instead.
func (*ScriptRunRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{36}
return file_cmd_proto_rawDescGZIP(), []int{38}
}
func (x *ScriptRunRes) GetPrintOutput() string {
@@ -3077,7 +3215,7 @@ type ScriptUpdateRes struct {
func (x *ScriptUpdateRes) Reset() {
*x = ScriptUpdateRes{}
mi := &file_cmd_proto_msgTypes[37]
mi := &file_cmd_proto_msgTypes[39]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3089,7 +3227,7 @@ func (x *ScriptUpdateRes) String() string {
func (*ScriptUpdateRes) ProtoMessage() {}
func (x *ScriptUpdateRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[37]
mi := &file_cmd_proto_msgTypes[39]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3102,14 +3240,156 @@ func (x *ScriptUpdateRes) ProtoReflect() protoreflect.Message {
// Deprecated: Use ScriptUpdateRes.ProtoReflect.Descriptor instead.
func (*ScriptUpdateRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{37}
return file_cmd_proto_rawDescGZIP(), []int{39}
}
// ExpListRes 实验列表返回
type ExpListRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
Buckets []*ExpBucket `protobuf:"bytes,1,rep,name=buckets,proto3" json:"buckets,omitempty"` //实验桶
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpListRes) Reset() {
*x = ExpListRes{}
mi := &file_cmd_proto_msgTypes[40]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpListRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpListRes) ProtoMessage() {}
func (x *ExpListRes) 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 ExpListRes.ProtoReflect.Descriptor instead.
func (*ExpListRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{40}
}
func (x *ExpListRes) GetBuckets() []*ExpBucket {
if x != nil {
return x.Buckets
}
return nil
}
type ExpBucket struct {
state protoimpl.MessageState `protogen:"open.v1"`
BucketId uint32 `protobuf:"varint,1,opt,name=bucket_id,json=bucketId,proto3" json:"bucket_id,omitempty"` //分桶号
PtExpId uint32 `protobuf:"varint,2,opt,name=pt_exp_id,json=ptExpId,proto3" json:"pt_exp_id,omitempty"` //平台实验ID
Percent uint32 `protobuf:"varint,3,opt,name=percent,proto3" json:"percent,omitempty"` //流量百分比
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpBucket) Reset() {
*x = ExpBucket{}
mi := &file_cmd_proto_msgTypes[41]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpBucket) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpBucket) ProtoMessage() {}
func (x *ExpBucket) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[41]
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 ExpBucket.ProtoReflect.Descriptor instead.
func (*ExpBucket) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{41}
}
func (x *ExpBucket) GetBucketId() uint32 {
if x != nil {
return x.BucketId
}
return 0
}
func (x *ExpBucket) GetPtExpId() uint32 {
if x != nil {
return x.PtExpId
}
return 0
}
func (x *ExpBucket) GetPercent() uint32 {
if x != nil {
return x.Percent
}
return 0
}
// ExpGetRes 实验报表返回
type ExpGetRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpGetRes) Reset() {
*x = ExpGetRes{}
mi := &file_cmd_proto_msgTypes[42]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpGetRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpGetRes) ProtoMessage() {}
func (x *ExpGetRes) ProtoReflect() protoreflect.Message {
mi := &file_cmd_proto_msgTypes[42]
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 ExpGetRes.ProtoReflect.Descriptor instead.
func (*ExpGetRes) Descriptor() ([]byte, []int) {
return file_cmd_proto_rawDescGZIP(), []int{42}
}
var File_cmd_proto protoreflect.FileDescriptor
const file_cmd_proto_rawDesc = "" +
"\n" +
"\tcmd.proto\x12\asaasapi\"\xcc\x05\n" +
"\tcmd.proto\x12\asaasapi\"\xa7\x06\n" +
"\aSaasReq\x12#\n" +
"\x04info\x18\x05 \x01(\v2\r.saasapi.InfoH\x00R\x04info\x12#\n" +
"\x04read\x18\n" +
@@ -3130,7 +3410,9 @@ const file_cmd_proto_rawDesc = "" +
"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\fscriptUpdateB\x05\n" +
"\rscript_update\x18[ \x01(\v2\x15.saasapi.ScriptUpdateH\x00R\fscriptUpdate\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" +
"\x04Info\"q\n" +
"\x04Read\x12!\n" +
@@ -3232,7 +3514,9 @@ const file_cmd_proto_rawDesc = "" +
"\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\"\xba\x06\n" +
"\fScriptUpdate\"\t\n" +
"\aExpList\"\b\n" +
"\x06ExpGet\"\xa9\a\n" +
"\aSaasRes\x12&\n" +
"\x04code\x18\x01 \x01(\x0e2\x12.saasapi.ErrorCodeR\x04code\x12\x16\n" +
"\x06status\x18\x02 \x01(\tR\x06status\x12-\n" +
@@ -3251,7 +3535,10 @@ const file_cmd_proto_rawDesc = "" +
"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\x0fscriptUpdateResB\x05\n" +
"\x11script_update_res\x18[ \x01(\v2\x18.saasapi.ScriptUpdateResH\x00R\x0fscriptUpdateRes\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" +
"\x03res\"1\n" +
"\tDataSpace\x12\x10\n" +
"\x03did\x18\x01 \x03(\tR\x03did\x12\x12\n" +
@@ -3311,7 +3598,15 @@ const file_cmd_proto_rawDesc = "" +
"\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" +
"\x0fScriptUpdateRes\":\n" +
"\n" +
"ExpListRes\x12,\n" +
"\abuckets\x18\x01 \x03(\v2\x12.saasapi.ExpBucketR\abuckets\"^\n" +
"\tExpBucket\x12\x1b\n" +
"\tbucket_id\x18\x01 \x01(\rR\bbucketId\x12\x1a\n" +
"\tpt_exp_id\x18\x02 \x01(\rR\aptExpId\x12\x18\n" +
"\apercent\x18\x03 \x01(\rR\apercent\"\v\n" +
"\tExpGetRes*=\n" +
"\bBindType\x12\x13\n" +
"\x0fUnknownBindType\x10\x00\x12\r\n" +
"\tAdgroupId\x10\x01\x12\r\n" +
@@ -3388,7 +3683,7 @@ func file_cmd_proto_rawDescGZIP() []byte {
}
var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 7)
var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 39)
var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 44)
var file_cmd_proto_goTypes = []any{
(BindType)(0), // 0: saasapi.BindType
(BindSourceType)(0), // 1: saasapi.BindSourceType
@@ -3420,22 +3715,27 @@ var file_cmd_proto_goTypes = []any{
(*BindDelete)(nil), // 27: saasapi.BindDelete
(*ScriptRun)(nil), // 28: saasapi.ScriptRun
(*ScriptUpdate)(nil), // 29: saasapi.ScriptUpdate
(*SaasRes)(nil), // 30: saasapi.SaasRes
(*DataSpace)(nil), // 31: saasapi.DataSpace
(*InfoRes)(nil), // 32: saasapi.InfoRes
(*ReadRes)(nil), // 33: saasapi.ReadRes
(*WriteRes)(nil), // 34: saasapi.WriteRes
(*ValueItem)(nil), // 35: saasapi.ValueItem
(*TaskListRes)(nil), // 36: saasapi.TaskListRes
(*TargetListRes)(nil), // 37: saasapi.TargetListRes
(*Binds)(nil), // 38: saasapi.Binds
(*Bind)(nil), // 39: saasapi.Bind
(*BindSetRes)(nil), // 40: saasapi.BindSetRes
(*BindDeleteRes)(nil), // 41: saasapi.BindDeleteRes
(*BindError)(nil), // 42: saasapi.BindError
(*ScriptRunRes)(nil), // 43: saasapi.ScriptRunRes
(*ScriptUpdateRes)(nil), // 44: saasapi.ScriptUpdateRes
nil, // 45: saasapi.TargetListRes.TargetListEntry
(*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
nil, // 50: saasapi.TargetListRes.TargetListEntry
}
var file_cmd_proto_depIdxs = []int32{
8, // 0: saasapi.SaasReq.info:type_name -> saasapi.Info
@@ -3452,53 +3752,58 @@ var file_cmd_proto_depIdxs = []int32{
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
10, // 14: saasapi.Read.read_items:type_name -> saasapi.ReadItem
12, // 15: saasapi.Write.write_items:type_name -> saasapi.WriteItem
13, // 16: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes
14, // 17: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s
15, // 18: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire
16, // 19: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire
13, // 20: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes
14, // 21: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s
15, // 22: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire
23, // 23: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo
4, // 24: saasapi.Task.status:type_name -> saasapi.TaskStatus
4, // 25: saasapi.TaskList.status_filter:type_name -> saasapi.TaskStatus
24, // 26: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock
39, // 27: saasapi.BindSet.binds:type_name -> saasapi.Bind
39, // 28: saasapi.BindDelete.binds:type_name -> saasapi.Bind
5, // 29: saasapi.ScriptRun.os:type_name -> saasapi.OS
2, // 30: saasapi.SaasRes.code:type_name -> saasapi.ErrorCode
32, // 31: saasapi.SaasRes.info_res:type_name -> saasapi.InfoRes
33, // 32: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes
34, // 33: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes
18, // 34: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task
36, // 35: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes
18, // 36: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task
18, // 37: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task
18, // 38: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task
37, // 39: saasapi.SaasRes.target_list_res:type_name -> saasapi.TargetListRes
40, // 40: saasapi.SaasRes.bind_set_res:type_name -> saasapi.BindSetRes
41, // 41: saasapi.SaasRes.bind_delete_res:type_name -> saasapi.BindDeleteRes
43, // 42: saasapi.SaasRes.script_run_res:type_name -> saasapi.ScriptRunRes
44, // 43: saasapi.SaasRes.script_update_res:type_name -> saasapi.ScriptUpdateRes
31, // 44: saasapi.InfoRes.dataspace:type_name -> saasapi.DataSpace
35, // 45: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem
3, // 46: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode
16, // 47: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire
18, // 48: saasapi.TaskListRes.tasks:type_name -> saasapi.Task
45, // 49: saasapi.TargetListRes.target_list:type_name -> saasapi.TargetListRes.TargetListEntry
39, // 50: saasapi.Binds.binds:type_name -> saasapi.Bind
0, // 51: saasapi.Bind.bind_type:type_name -> saasapi.BindType
1, // 52: saasapi.Bind.bind_source:type_name -> saasapi.BindSourceType
42, // 53: saasapi.BindSetRes.errors:type_name -> saasapi.BindError
42, // 54: saasapi.BindDeleteRes.errors:type_name -> saasapi.BindError
38, // 55: saasapi.TargetListRes.TargetListEntry.value:type_name -> saasapi.Binds
56, // [56:56] is the sub-list for method output_type
56, // [56:56] is the sub-list for method input_type
56, // [56:56] is the sub-list for extension type_name
56, // [56:56] is the sub-list for extension extendee
0, // [0:56] is the sub-list for field type_name
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
50, // 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
40, // 60: saasapi.TargetListRes.TargetListEntry.value:type_name -> saasapi.Binds
61, // [61:61] is the sub-list for method output_type
61, // [61:61] is the sub-list for method input_type
61, // [61:61] is the sub-list for extension type_name
61, // [61:61] is the sub-list for extension extendee
0, // [0:61] is the sub-list for field type_name
}
func init() { file_cmd_proto_init() }
@@ -3521,8 +3826,10 @@ func file_cmd_proto_init() {
(*SaasReq_BindDelete)(nil),
(*SaasReq_ScriptRun)(nil),
(*SaasReq_ScriptUpdate)(nil),
(*SaasReq_ExpList)(nil),
(*SaasReq_ExpGet)(nil),
}
file_cmd_proto_msgTypes[23].OneofWrappers = []any{
file_cmd_proto_msgTypes[25].OneofWrappers = []any{
(*SaasRes_InfoRes)(nil),
(*SaasRes_ReadRes)(nil),
(*SaasRes_WriteRes)(nil),
@@ -3536,6 +3843,8 @@ func file_cmd_proto_init() {
(*SaasRes_BindDeleteRes)(nil),
(*SaasRes_ScriptRunRes)(nil),
(*SaasRes_ScriptUpdateRes)(nil),
(*SaasRes_ExpListRes)(nil),
(*SaasRes_ExpGetRes)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -3543,7 +3852,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: 39,
NumMessages: 44,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -26,6 +26,9 @@ message SaasReq {
ScriptRun script_run = 90; // 运行脚本
ScriptUpdate script_update = 91; // 脚本升级
ExpList exp_list = 100; // 列出实验
ExpGet exp_get = 101; // 获取实验报表
}
}
@@ -66,7 +69,6 @@ message WriteItem {
message Bytes {
bytes bytes = 1; // 写入的byte
uint64 index_1 = 2; // 写入byte的索引值(0..63)
uint64 index_2 = 3 [deprecated=true]; // **已弃用 写入byte的索引值(64..127)
}
// Uint32s 写入uint32区域
@@ -181,6 +183,16 @@ message ScriptRun {
message ScriptUpdate {
}
// ExpList 列出实验
message ExpList {
}
// ExpGet 获取实验报表
message ExpGet {
}
// SaasRes 命令返回
message SaasRes {
ErrorCode code = 1; // 返回码
@@ -204,6 +216,9 @@ message SaasRes {
ScriptRunRes script_run_res = 90; // 运行脚本返回
ScriptUpdateRes script_update_res = 91; // 升级脚本返回
ExpListRes exp_list_res = 100; // 实验列表返回
ExpGetRes exp_get_res = 101; // 实验报表返回
}
}
@@ -318,6 +333,22 @@ message ScriptRunRes {
message ScriptUpdateRes {
}
// ExpListRes 实验列表返回
message ExpListRes {
repeated ExpBucket buckets = 1; //实验桶
}
message ExpBucket {
uint32 bucket_id = 1; //分桶号
uint32 pt_exp_id = 2; //平台实验ID
uint32 percent = 3; //流量百分比
}
// ExpGetRes 实验报表返回
message ExpGetRes {
}
// ErrorCode 返回码
enum ErrorCode {
SUCC = 0; // 成功

View File

@@ -3,3 +3,4 @@ saastool
saastool_linux
*.toml
test/
*.lua

397
cmd/saastool/daemon.go Normal file
View File

@@ -0,0 +1,397 @@
package main
import (
"bufio"
"encoding/json"
"fmt"
"log/slog"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
"git.algo.com.cn/public/saasapi"
"git.algo.com.cn/public/saasapi/pkg/saashttp"
)
type Daemon struct {
saasHttp *saashttp.SaasClient
currTimeStamp uint32
}
type daemonPublicParams struct {
ds string
appid string
}
func RunDaemon(args ...string) error {
var err error
account := os.Getenv("SRTA_ACCOUNT")
token := os.Getenv("SRTA_TOKEN")
env := os.Getenv("SRTA_ENV")
slog.Info("Env", "SRTA_ACCOUNT", account)
slog.Info("Env", "SRTA_TOKEN", token)
slog.Info("Env", "SRTA_ENV", env)
if strings.TrimSpace(account) == "" {
err = fmt.Errorf("SRTA_ACCOUNT is empty")
slog.Error("Env", "err", err)
return err
}
if strings.TrimSpace(token) == "" {
err = fmt.Errorf("SRTA_TOKEN is empty")
slog.Error("Env", "err", err)
return err
}
apiurls := &saashttp.ApiUrls{}
switch strings.ToLower(env) {
case "demo":
apiurls.BaseUrl = "https://srta.algo.com.cn"
case "prd":
apiurls.BaseUrl = "https://api.rta.qq.com"
default:
err = fmt.Errorf("SRTA_ENV is not demo or prd")
slog.Error("Env", "err", err)
return err
}
mux := http.NewServeMux()
daemon := &Daemon{
saasHttp: &saashttp.SaasClient{
Client: &http.Client{},
ApiUrls: saashttp.InitAPIUrl(apiurls),
Auth: &saashttp.Auth{
Account: account,
Token: token,
},
},
}
mux.HandleFunc("/read", daemon.httpRead)
mux.HandleFunc("/write", daemon.httpWrite)
daemonPort := ":8080"
svrHttp := http.Server{
Addr: daemonPort,
Handler: mux,
}
slog.Info("Start running", "port", daemonPort)
err = svrHttp.ListenAndServe()
if err != nil {
slog.Error("failed", "err", err)
return err
}
return nil
}
func (d *Daemon) httpRead(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
w.Header().Set("Allow", http.MethodGet)
http.Error(w, fmt.Sprintf("Not support method: %s。Only GET。", r.Method), http.StatusMethodNotAllowed)
return
}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("X-Content-Type-Options", "nosniff")
saasRes := &saasapi.SaasRes{}
defer func() {
json.NewEncoder(w).Encode(saasRes)
}()
params, err := d.parsePublicParams(r)
if err != nil {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = err.Error()
return
}
q := r.URL.Query()
userid := strings.TrimSpace(q.Get("userid"))
if len(userid) == 0 {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = "userid is null"
return
}
saasReadItems := []*saasapi.ReadItem{}
saasReadItems = append(saasReadItems, &saasapi.ReadItem{
Userid: userid,
})
saasReq := &saasapi.SaasReq{
Cmd: &saasapi.SaasReq_Read{
Read: &saasapi.Read{
DataspaceId: params.ds,
Appid: params.appid,
ReadItems: saasReadItems,
},
},
}
saasRes, err = d.saasHttp.Read(saasReq)
if err != nil {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = fmt.Sprintf("submit read error. %v", err)
return
}
}
func (d *Daemon) httpWrite(w http.ResponseWriter, r *http.Request) {
bPost := false
switch r.Method {
case http.MethodPost:
bPost = true
case http.MethodGet:
default:
w.Header().Set("Allow", http.MethodGet)
http.Error(w, fmt.Sprintf("Not support method: %s。Only GET/POST。", r.Method), http.StatusMethodNotAllowed)
return
}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("X-Content-Type-Options", "nosniff")
saasRes := &saasapi.SaasRes{}
defer func() {
json.NewEncoder(w).Encode(saasRes)
}()
params, err := d.parsePublicParams(r)
if err != nil {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = err.Error()
return
}
q := r.URL.Query()
clear := q.Get("clear")
bClear := false
if len(clear) > 0 {
bClear, err = strconv.ParseBool(clear)
if err != nil {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = fmt.Sprintf("clear is error. %v", err)
return
}
}
d.currTimeStamp = uint32(time.Now().Unix())
writeItems, err := d.parseWriteParams(r, bPost)
if err != nil {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = fmt.Sprintf("write info error. %v", err)
return
}
write := &saasapi.Write{
DataspaceId: params.ds,
Appid: params.appid,
IsClearAllFirst: bClear,
}
saasReq := &saasapi.SaasReq{
Cmd: &saasapi.SaasReq_Write{
Write: write,
},
}
write.WriteItems = writeItems
saasRes, err = d.saasHttp.Write(saasReq)
if err != nil {
saasRes.Code = saasapi.ErrorCode_CMD_ERROR
saasRes.Status = fmt.Sprintf("submit write error. %v", err)
return
}
}
func (d *Daemon) parsePublicParams(r *http.Request) (*daemonPublicParams, error) {
params := &daemonPublicParams{}
q := r.URL.Query()
params.ds = strings.ToLower(strings.TrimSpace(q.Get("ds")))
switch params.ds {
case "did", "wuid":
default:
return nil, fmt.Errorf("ds must use did/wuid. current is %v", params.ds)
}
params.appid = strings.TrimSpace(q.Get("appid"))
if params.ds == "wuid" && len(params.appid) == 0 {
return nil, fmt.Errorf("appid must exist when ds=wuid")
}
return params, nil
}
func (d *Daemon) parseWriteParams(r *http.Request, post bool) (writeItems []*saasapi.WriteItem, reterr error) {
writeItems = nil
lineNum := 0
if post {
scanner := bufio.NewScanner(r.Body)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
lineNum++
parsedQuery, err := url.ParseQuery(line)
if err != nil {
reterr = fmt.Errorf("parse error: %v", err)
return
}
item, err := d.parseQuery(parsedQuery, lineNum)
if err != nil {
reterr = fmt.Errorf("parse error: %v", err)
return
}
writeItems = append(writeItems, item)
}
} else {
item, err := d.parseQuery(r.URL.Query(), lineNum)
if err != nil {
reterr = fmt.Errorf("parse error: %v", err)
return
}
writeItems = append(writeItems, item)
}
return
}
func (d *Daemon) parseQuery(q url.Values, lineNum int) (writeItem *saasapi.WriteItem, reterr error) {
userid := strings.TrimSpace(q.Get("userid"))
if len(userid) == 0 {
reterr = fmt.Errorf("userid is null. line %v", lineNum)
return
}
writeItem = &saasapi.WriteItem{
Userid: userid,
}
for key, value := range q {
parts := strings.Split(strings.ToLower(key), ".")
if len(parts) == 2 {
switch parts[0] {
case "u8":
index, err := strconv.ParseUint(parts[1], 10, 8)
if err != nil {
reterr = fmt.Errorf("param is error. line %v, param %v", lineNum, key)
return
}
if index == 0 || index > uint64(saasapi.MAX_U8) {
reterr = fmt.Errorf("param index is error. line %v, param %v, index %v", lineNum, key, index)
return
}
nValue, err := strconv.ParseUint(value[0], 10, 8)
if err != nil {
reterr = fmt.Errorf("param value is error. line %v, param %v, value %v", lineNum, key, value)
return
}
if writeItem.GetWriteBytes() == nil {
writeItem.WriteBytes = &saasapi.Bytes{}
}
if writeItem.GetWriteBytes().GetIndex_1()&(1<<(index-1)) > 0 {
// 已经被写入过数据,跳过
continue
}
writeItem.GetWriteBytes().Bytes = append(writeItem.GetWriteBytes().Bytes, uint8(nValue))
writeItem.GetWriteBytes().Index_1 |= 1 << (index - 1)
case "u32":
index, err := strconv.ParseUint(parts[1], 10, 8)
if err != nil {
reterr = fmt.Errorf("param is error. line %v, param %v", lineNum, key)
return
}
if index == 0 || index > uint64(saasapi.MAX_U32) {
reterr = fmt.Errorf("param index is error. line %v, param %v, index %v", lineNum, key, index)
return
}
nValue, err := strconv.ParseUint(value[0], 10, 32)
if err != nil {
reterr = fmt.Errorf("param value is error. line %v, param %v, value %v", lineNum, key, value)
return
}
if writeItem.GetWriteUint32S() == nil {
writeItem.WriteUint32S = &saasapi.Uint32S{}
}
if writeItem.GetWriteUint32S().GetIndex_1()&(1<<(index-1)) > 0 {
// 已经被写入过数据,跳过
continue
}
writeItem.GetWriteUint32S().Uint32S = append(writeItem.GetWriteUint32S().Uint32S, uint32(nValue))
writeItem.GetWriteUint32S().Index_1 |= 1 << (index - 1)
case "flag":
index, err := strconv.ParseUint(parts[1], 10, 8)
if err != nil {
reterr = fmt.Errorf("param is error. line %v, param %v", lineNum, key)
return
}
if index == 0 || index > uint64(saasapi.MAX_FLAG) {
reterr = fmt.Errorf("param index is error. line %v, param %v, index %v", lineNum, key, index)
return
}
flag := saasapi.FlagWithExpire{}
switch strings.ToLower(value[0]) {
case "true":
flag.Flag = true
case "false":
flag.Flag = false
default:
if strings.HasPrefix(value[0], "!") {
// 相对时间戳
nValue, err := strconv.ParseUint(value[0][1:], 10, 32)
if err != nil {
reterr = fmt.Errorf("param value is error. line %v, param %v, value %v", lineNum, key, value)
return
}
flag.Flag = true
flag.Expire = d.currTimeStamp + uint32(nValue)
} else {
nValue, err := strconv.ParseUint(value[0], 10, 32)
if err != nil || nValue > 30*24*86400 {
reterr = fmt.Errorf("param value is error. line %v, param %v, value %v", lineNum, key, value)
return
}
flag.Flag = true
flag.Expire = uint32(nValue)
}
}
if writeItem.GetWriteFlagsWithExpire() == nil {
writeItem.WriteFlagsWithExpire = &saasapi.FlagsWithExpire{}
}
if writeItem.GetWriteFlagsWithExpire().GetIndex_1()&(1<<(index-1)) > 0 {
// 已经被写入过数据,跳过
continue
}
writeItem.GetWriteFlagsWithExpire().FlagsWithExpire = append(writeItem.GetWriteFlagsWithExpire().FlagsWithExpire, &flag)
writeItem.GetWriteFlagsWithExpire().Index_1 |= 1 << (index - 1)
}
}
}
return
}

43
cmd/saastool/exp.go Normal file
View File

@@ -0,0 +1,43 @@
package main
import (
"fmt"
"os"
"strings"
)
func RunExp(args ...string) error {
name, args := ParseCommandName(args)
// 从参数中解析出命令
switch name {
case "", "help":
return RunExpHelp(args...)
case "list":
return RunExpList(args...)
case "get":
return RunExpGet(args...)
default:
err := fmt.Errorf(`unknown command "%s"`+"\n"+`Run 'saastool exp help' for usage`, name)
fmt.Fprintln(os.Stderr, err)
return err
}
}
func RunExpHelp(args ...string) error {
fmt.Println(strings.TrimSpace(expUsage))
return nil
}
const expUsage = `
Usage: saastoola exp COMMAND [OPTIONS]
Commands:
list List exps
get Get exp report
"help" is the default command.
Use "saastool exp COMMAND -help" for more information about a command.
`

5
cmd/saastool/exp_get.go Normal file
View File

@@ -0,0 +1,5 @@
package main
func RunExpGet(args ...string) error {
return nil
}

71
cmd/saastool/exp_list.go Normal file
View File

@@ -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 listExpParams struct {
saasHttp *saashttp.SaasClient
}
func RunExpList(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
}
listExpParams := listExpParams{
saasHttp: &saashttp.SaasClient{
Client: &http.Client{},
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
Auth: &cfg.Auth,
},
}
return doExpList(listExpParams)
}
func doExpList(listExpParams listExpParams) error {
saasReq := &saasapi.SaasReq{
Cmd: &saasapi.SaasReq_ExpList{
ExpList: &saasapi.ExpList{},
},
}
res, err := listExpParams.saasHttp.ExpList(saasReq)
if err != nil {
fmt.Fprintln(os.Stderr, "submit ListExp error", "err", err)
return err
}
if res.Code != saasapi.ErrorCode_SUCC {
fmt.Fprintln(os.Stderr, "list exp failed", "code", res.Code, "status", res.Status)
return nil
}
listExpRes := res.GetExpListRes()
fmt.Printf("exp res: %v\n", protojson.Format(listExpRes))
return nil
}

View File

@@ -27,6 +27,8 @@ Commands:
bind Bind commands
script Script commands
daemon Run in daemon mode
"help" is the default command.
Use "saastool COMMAND -help" for more information about a command.

View File

@@ -38,6 +38,10 @@ func Run(args ...string) error {
return RunBind(args...)
case "script":
return RunScript(args...)
case "exp":
return RunExp(args...)
case "daemon":
return RunDaemon(args...)
default:
err := fmt.Errorf(`unknown command "%v"`+"\n"+`Run 'saastool help' for usage`, name)
fmt.Fprintln(os.Stderr, err.Error())

View File

@@ -47,8 +47,8 @@ func RunTaskUpload(args ...string) error {
}
return doTaskUpload(uploadTaskParams)
}
func doTaskUpload(uploadTaskParams uploadTaskParams) error {
infoTaskParams := infoTaskParams{
taskSha256: uploadTaskParams.taskSha256,

10
docker/build_saastool.sh Executable file
View File

@@ -0,0 +1,10 @@
#/bin/sh -v
set -e
docker buildx build --platform linux/amd64 \
-t registry.algo.com.cn/public/saastool:latest \
-t registry.algo.com.cn/public/saastool:20250924 \
-o type=registry \
-f saastool.Dockerfile \
../ ;

View File

@@ -10,3 +10,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
FROM registry.algo.com.cn/public/alpine:latest AS product
COPY --from=builder /tmp/saasapi/build/saastool /bin/saastool
EXPOSE 8080
CMD ["saastool", "daemon"]

View File

@@ -17,6 +17,8 @@ const (
bindSetPath = "/saas/bind/set"
bindDeletePath = "/saas/bind/delete"
scriptRunPath = "/saas/script/run"
expListPath = "/saas/exp/list"
expGetPath = "/saas/exp/get"
)
type ApiUrls struct {
@@ -36,6 +38,8 @@ type ApiUrls struct {
BindSetPath string
BindDeletePath string
ScriptRunPath string
ExpListPath string
ExpGetPath string
}
func InitAPIUrl(c *ApiUrls) *ApiUrls {
@@ -136,6 +140,18 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls {
r.ScriptRunPath = scriptRunPath
}
if c.ExpListPath != "" {
r.ExpListPath = c.ExpListPath
} else {
r.ExpListPath = expListPath
}
if c.ExpGetPath != "" {
r.ExpGetPath = c.ExpGetPath
} else {
r.ExpGetPath = expGetPath
}
return r
}

View File

@@ -108,6 +108,16 @@ func (c *SaasClient) ScriptRun(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasR
return c.post(postUrl, saasReq)
}
func (c *SaasClient) ExpList(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ExpListPath)
return c.post(postUrl, saasReq)
}
func (c *SaasClient) ExpGet(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ExpGetPath)
return c.post(postUrl, saasReq)
}
func (c *SaasClient) makeUrl(baseUrl, path string, params ...string) string {
url, err := url.Parse(baseUrl)
if err != nil {