mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-12-19 07:26:35 +08:00
节点IP可以设置阈值
This commit is contained in:
13
pkg/nodeconfigs/node_ip_addr.go
Normal file
13
pkg/nodeconfigs/node_ip_addr.go
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
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"`
|
||||
CanAccess bool `json:"canAccess"`
|
||||
}
|
||||
@@ -306,3 +306,12 @@ 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"`
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ 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() {
|
||||
@@ -109,6 +110,13 @@ 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
|
||||
@@ -167,6 +175,7 @@ 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() {
|
||||
@@ -236,6 +245,13 @@ 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
|
||||
@@ -679,7 +695,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, 0x8a, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x74, 0x6f, 0x22, 0xb2, 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,
|
||||
@@ -687,20 +703,25 @@ 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, 0x22,
|
||||
0x3b, 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, 0x1c,
|
||||
0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x22, 0x90, 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, 0x1c, 0x0a, 0x09, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
|
||||
0x61, 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,
|
||||
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, 0x3b, 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, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x49, 0x64, 0x22, 0xb8, 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, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 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,
|
||||
0x58, 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, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64,
|
||||
|
||||
@@ -36,6 +36,7 @@ message CreateNodeIPAddressRequest {
|
||||
string name = 3;
|
||||
string ip = 4;
|
||||
bool canAccess = 5;
|
||||
bytes thresholdsJSON = 6;
|
||||
}
|
||||
|
||||
message CreateNodeIPAddressResponse {
|
||||
@@ -49,6 +50,7 @@ message UpdateNodeIPAddressRequest {
|
||||
string ip = 3;
|
||||
bool canAccess = 4;
|
||||
bool isOn = 5;
|
||||
bytes thresholdsJSON = 6;
|
||||
}
|
||||
|
||||
// 修改IP地址所属节点
|
||||
|
||||
Reference in New Issue
Block a user