mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-25 12:30:24 +08:00
实现基础的IP地址阈值
This commit is contained in:
@@ -5,7 +5,6 @@ package nodeconfigs
|
||||
type NodeIPAddr struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Thresholds []*NodeValueThresholdConfig `json:"thresholds"`
|
||||
IP string `json:"ip"`
|
||||
IsOn bool `json:"isOn"`
|
||||
IsUp bool `json:"isUp"`
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
package nodeconfigs
|
||||
|
||||
import "encoding/json"
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// NodeValueItem 监控项
|
||||
type NodeValueItem = string
|
||||
@@ -306,12 +308,3 @@ func UnmarshalNodeValue(valueJSON []byte) string {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// NodeValueThresholdConfig 阈值
|
||||
type NodeValueThresholdConfig struct {
|
||||
Item NodeValueItem `json:"item"`
|
||||
Operator NodeValueOperator `json:"operator"`
|
||||
Value int64 `json:"value"`
|
||||
Duration int `json:"duration"`
|
||||
DurationUnit NodeValueDurationUnit `json:"durationUnit"`
|
||||
}
|
||||
|
||||
46
pkg/nodeconfigs/node_value_thresholds.go
Normal file
46
pkg/nodeconfigs/node_value_thresholds.go
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package nodeconfigs
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
type IPAddressThresholdItem = string
|
||||
|
||||
const (
|
||||
IPAddressThresholdItemAvgRequests IPAddressThresholdItem = "avgRequests"
|
||||
IPAddressThresholdItemAvgTrafficOut IPAddressThresholdItem = "avgTrafficOut" // M
|
||||
IPAddressThresholdItemAvgTrafficIn IPAddressThresholdItem = "avgTrafficIn" // M
|
||||
IPAddressThresholdItemConnectivity IPAddressThresholdItem = "connectivity" // 0-100
|
||||
)
|
||||
|
||||
// NodeValueThresholdConfig 阈值列表
|
||||
type NodeValueThresholdConfig struct {
|
||||
Id int64 `json:"id"`
|
||||
Items []*NodeValueThresholdItemConfig `json:"items"`
|
||||
Actions []*NodeValueThresholdActionConfig `json:"actions"`
|
||||
}
|
||||
|
||||
// NodeValueThresholdItemConfig 阈值项目
|
||||
type NodeValueThresholdItemConfig struct {
|
||||
Item NodeValueItem `json:"item"`
|
||||
Operator NodeValueOperator `json:"operator"`
|
||||
Value float64 `json:"value"`
|
||||
Duration int `json:"duration"`
|
||||
DurationUnit NodeValueDurationUnit `json:"durationUnit"`
|
||||
Options maps.Map `json:"options"` // 附加选项
|
||||
}
|
||||
|
||||
type NodeValueThresholdActionConfig struct {
|
||||
Action string `json:"action"`
|
||||
Options maps.Map `json:"options"`
|
||||
}
|
||||
|
||||
// NodeValueThresholdAction 动作
|
||||
type NodeValueThresholdAction = string
|
||||
|
||||
const (
|
||||
NodeValueThresholdActionUp NodeValueThresholdAction = "up" // 上线
|
||||
NodeValueThresholdActionDown NodeValueThresholdAction = "down" // 下线
|
||||
NodeValueThresholdActionNotify NodeValueThresholdAction = "notify" // 通知
|
||||
NodeValueThresholdActionSwitch NodeValueThresholdAction = "switch" // 切换到备用IP
|
||||
)
|
||||
@@ -41,7 +41,6 @@ type NodeIPAddress struct {
|
||||
CanAccess bool `protobuf:"varint,8,opt,name=canAccess,proto3" json:"canAccess,omitempty"`
|
||||
IsOn bool `protobuf:"varint,9,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||
IsUp bool `protobuf:"varint,10,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
||||
ThresholdsJSON []byte `protobuf:"bytes,11,opt,name=thresholdsJSON,proto3" json:"thresholdsJSON,omitempty"`
|
||||
Role string `protobuf:"bytes,12,opt,name=role,proto3" json:"role,omitempty"`
|
||||
}
|
||||
|
||||
@@ -147,13 +146,6 @@ func (x *NodeIPAddress) GetIsUp() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetThresholdsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ThresholdsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetRole() string {
|
||||
if x != nil {
|
||||
return x.Role
|
||||
@@ -166,7 +158,7 @@ var File_models_model_node_ip_address_proto protoreflect.FileDescriptor
|
||||
var file_models_model_node_ip_address_proto_rawDesc = []byte{
|
||||
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xab, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x64,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x83, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f,
|
||||
0x64, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65,
|
||||
@@ -181,12 +173,9 @@ var file_models_model_node_ip_address_proto_rawDesc = []byte{
|
||||
0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x0a,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x26, 0x0a, 0x0e, 0x74, 0x68,
|
||||
0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0b, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x0e, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x73, 0x4a, 0x53,
|
||||
0x4f, 0x4e, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
|
||||
0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
168
pkg/rpc/pb/model_node_ip_address_threshold.pb.go
Normal file
168
pkg/rpc/pb/model_node_ip_address_threshold.pb.go
Normal file
@@ -0,0 +1,168 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: models/model_node_ip_address_threshold.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NodeIPAddressThreshold struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
ItemsJSON []byte `protobuf:"bytes,2,opt,name=itemsJSON,proto3" json:"itemsJSON,omitempty"`
|
||||
ActionsJSON []byte `protobuf:"bytes,3,opt,name=actionsJSON,proto3" json:"actionsJSON,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeIPAddressThreshold) Reset() {
|
||||
*x = NodeIPAddressThreshold{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_models_model_node_ip_address_threshold_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeIPAddressThreshold) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeIPAddressThreshold) ProtoMessage() {}
|
||||
|
||||
func (x *NodeIPAddressThreshold) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_models_model_node_ip_address_threshold_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeIPAddressThreshold.ProtoReflect.Descriptor instead.
|
||||
func (*NodeIPAddressThreshold) Descriptor() ([]byte, []int) {
|
||||
return file_models_model_node_ip_address_threshold_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeIPAddressThreshold) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeIPAddressThreshold) GetItemsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ItemsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NodeIPAddressThreshold) GetActionsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ActionsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_models_model_node_ip_address_threshold_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_models_model_node_ip_address_threshold_proto_rawDesc = []byte{
|
||||
0x0a, 0x2c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x74,
|
||||
0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02,
|
||||
0x70, 0x62, 0x22, 0x68, 0x0a, 0x16, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09,
|
||||
0x69, 0x74, 0x65, 0x6d, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x09, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x42, 0x06, 0x5a, 0x04,
|
||||
0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_models_model_node_ip_address_threshold_proto_rawDescOnce sync.Once
|
||||
file_models_model_node_ip_address_threshold_proto_rawDescData = file_models_model_node_ip_address_threshold_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_models_model_node_ip_address_threshold_proto_rawDescGZIP() []byte {
|
||||
file_models_model_node_ip_address_threshold_proto_rawDescOnce.Do(func() {
|
||||
file_models_model_node_ip_address_threshold_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_node_ip_address_threshold_proto_rawDescData)
|
||||
})
|
||||
return file_models_model_node_ip_address_threshold_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_models_model_node_ip_address_threshold_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_models_model_node_ip_address_threshold_proto_goTypes = []interface{}{
|
||||
(*NodeIPAddressThreshold)(nil), // 0: pb.NodeIPAddressThreshold
|
||||
}
|
||||
var file_models_model_node_ip_address_threshold_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_models_model_node_ip_address_threshold_proto_init() }
|
||||
func file_models_model_node_ip_address_threshold_proto_init() {
|
||||
if File_models_model_node_ip_address_threshold_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_models_model_node_ip_address_threshold_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeIPAddressThreshold); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_models_model_node_ip_address_threshold_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_models_model_node_ip_address_threshold_proto_goTypes,
|
||||
DependencyIndexes: file_models_model_node_ip_address_threshold_proto_depIdxs,
|
||||
MessageInfos: file_models_model_node_ip_address_threshold_proto_msgTypes,
|
||||
}.Build()
|
||||
File_models_model_node_ip_address_threshold_proto = out.File
|
||||
file_models_model_node_ip_address_threshold_proto_rawDesc = nil
|
||||
file_models_model_node_ip_address_threshold_proto_goTypes = nil
|
||||
file_models_model_node_ip_address_threshold_proto_depIdxs = nil
|
||||
}
|
||||
@@ -40,7 +40,6 @@ type CreateNodeIPAddressRequest struct {
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
CanAccess bool `protobuf:"varint,5,opt,name=canAccess,proto3" json:"canAccess,omitempty"`
|
||||
ThresholdsJSON []byte `protobuf:"bytes,6,opt,name=thresholdsJSON,proto3" json:"thresholdsJSON,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateNodeIPAddressRequest) Reset() {
|
||||
@@ -110,13 +109,6 @@ func (x *CreateNodeIPAddressRequest) GetCanAccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CreateNodeIPAddressRequest) GetThresholdsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ThresholdsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateNodeIPAddressResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -175,7 +167,6 @@ type UpdateNodeIPAddressRequest struct {
|
||||
Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
CanAccess bool `protobuf:"varint,4,opt,name=canAccess,proto3" json:"canAccess,omitempty"`
|
||||
IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||
ThresholdsJSON []byte `protobuf:"bytes,6,opt,name=thresholdsJSON,proto3" json:"thresholdsJSON,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateNodeIPAddressRequest) Reset() {
|
||||
@@ -245,13 +236,6 @@ func (x *UpdateNodeIPAddressRequest) GetIsOn() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *UpdateNodeIPAddressRequest) GetThresholdsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ThresholdsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 修改IP地址所属节点
|
||||
type UpdateNodeIPAddressNodeIdRequest struct {
|
||||
state protoimpl.MessageState
|
||||
@@ -902,7 +886,7 @@ var file_service_node_ip_address_proto_rawDesc = []byte{
|
||||
0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f,
|
||||
0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x22, 0xb2, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x74, 0x6f, 0x22, 0x8a, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c,
|
||||
@@ -910,27 +894,22 @@ var file_service_node_ip_address_proto_rawDesc = []byte{
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
|
||||
0x70, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12,
|
||||
0x26, 0x0a, 0x0e, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x73, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f,
|
||||
0x6c, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x47, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50,
|
||||
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64,
|
||||
0x22, 0xc4, 0x01, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x49,
|
||||
0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x28, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50,
|
||||
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
||||
0x73, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12,
|
||||
0x26, 0x0a, 0x0e, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x73, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f,
|
||||
0x6c, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x64, 0x0a, 0x20, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22,
|
||||
0x47, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28,
|
||||
0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x22, 0x9c, 0x01, 0x0a, 0x1a, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49,
|
||||
0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49,
|
||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x41, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x22, 0x64, 0x0a, 0x20, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x18, 0x01,
|
||||
|
||||
1014
pkg/rpc/pb/service_node_ip_address_threshold.pb.go
Normal file
1014
pkg/rpc/pb/service_node_ip_address_threshold.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,5 @@ message NodeIPAddress {
|
||||
bool canAccess = 8;
|
||||
bool isOn = 9;
|
||||
bool isUp = 10;
|
||||
bytes thresholdsJSON = 11;
|
||||
string role = 12;
|
||||
}
|
||||
10
pkg/rpc/protos/models/model_node_ip_address_threshold.proto
Normal file
10
pkg/rpc/protos/models/model_node_ip_address_threshold.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NodeIPAddressThreshold {
|
||||
int64 id = 1;
|
||||
bytes itemsJSON = 2;
|
||||
bytes actionsJSON = 3;
|
||||
}
|
||||
@@ -42,7 +42,6 @@ message CreateNodeIPAddressRequest {
|
||||
string name = 3;
|
||||
string ip = 4;
|
||||
bool canAccess = 5;
|
||||
bytes thresholdsJSON = 6;
|
||||
}
|
||||
|
||||
message CreateNodeIPAddressResponse {
|
||||
@@ -56,7 +55,6 @@ message UpdateNodeIPAddressRequest {
|
||||
string ip = 3;
|
||||
bool canAccess = 4;
|
||||
bool isOn = 5;
|
||||
bytes thresholdsJSON = 6;
|
||||
}
|
||||
|
||||
// 修改IP地址所属节点
|
||||
|
||||
71
pkg/rpc/protos/service_node_ip_address_threshold.proto
Normal file
71
pkg/rpc/protos/service_node_ip_address_threshold.proto
Normal file
@@ -0,0 +1,71 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_node_ip_address_threshold.proto";
|
||||
import "models/rpc_messages.proto";
|
||||
|
||||
// IP阈值相关服务
|
||||
service NodeIPAddressThresholdService {
|
||||
// 创建阈值
|
||||
rpc createNodeIPAddressThreshold(CreateNodeIPAddressThresholdRequest) returns (CreateNodeIPAddressThresholdResponse);
|
||||
|
||||
// 修改阈值
|
||||
rpc updateNodeIPAddressThreshold(UpdateNodeIPAddressThresholdRequest) returns (RPCSuccess);
|
||||
|
||||
// 删除阈值
|
||||
rpc deleteNodeIPAddressThreshold(DeleteNodeIPAddressThresholdRequest) returns (RPCSuccess);
|
||||
|
||||
// 查找IP的所有阈值
|
||||
rpc findAllEnabledNodeIPAddressThresholds(FindAllEnabledNodeIPAddressThresholdsRequest) returns (FindAllEnabledNodeIPAddressThresholdsResponse);
|
||||
|
||||
// 计算IP阈值的数量
|
||||
rpc countAllEnabledNodeIPAddressThresholds(CountAllEnabledNodeIPAddressThresholdsRequest) returns (RPCCountResponse);
|
||||
|
||||
// 批量更新阈值
|
||||
rpc updateAllNodeIPAddressThresholds(UpdateAllNodeIPAddressThresholdsRequest) returns (RPCSuccess);
|
||||
}
|
||||
|
||||
// 创建阈值
|
||||
message CreateNodeIPAddressThresholdRequest{
|
||||
int64 nodeIPAddressId = 1;
|
||||
bytes itemsJSON = 2;
|
||||
bytes actionsJSON = 3;
|
||||
}
|
||||
|
||||
message CreateNodeIPAddressThresholdResponse {
|
||||
int64 nodeIPAddressThresholdId = 1;
|
||||
}
|
||||
|
||||
// 修改阈值
|
||||
message UpdateNodeIPAddressThresholdRequest {
|
||||
int64 nodeIPAddressThresholdId = 1;
|
||||
bytes itemsJSON = 2;
|
||||
bytes actionsJSON = 3;
|
||||
}
|
||||
|
||||
// 删除阈值
|
||||
message DeleteNodeIPAddressThresholdRequest {
|
||||
int64 nodeIPAddressThresholdId = 1;
|
||||
}
|
||||
|
||||
// 查找IP的所有阈值
|
||||
message FindAllEnabledNodeIPAddressThresholdsRequest {
|
||||
int64 nodeIPAddressId = 1;
|
||||
}
|
||||
|
||||
message FindAllEnabledNodeIPAddressThresholdsResponse {
|
||||
repeated NodeIPAddressThreshold nodeIPAddressThresholds = 1;
|
||||
}
|
||||
|
||||
// 计算IP阈值的数量
|
||||
message CountAllEnabledNodeIPAddressThresholdsRequest {
|
||||
int64 nodeIPAddressId = 1;
|
||||
}
|
||||
|
||||
// 批量更新阈值
|
||||
message UpdateAllNodeIPAddressThresholdsRequest {
|
||||
int64 nodeIPAddressId = 1;
|
||||
bytes nodeIPAddressThresholdsJSON = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user