mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 12:20:27 +08:00
实现基础的智能调度
This commit is contained in:
166
build/rpc.json
166
build/rpc.json
@@ -5576,11 +5576,106 @@
|
||||
"node"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "findNodeScheduleInfo",
|
||||
"requestMessageName": "FindNodeScheduleInfoRequest",
|
||||
"responseMessageName": "FindNodeScheduleInfoResponse",
|
||||
"code": "rpc findNodeScheduleInfo(FindNodeScheduleInfoRequest) returns (FindNodeScheduleInfoResponse);",
|
||||
"doc": "查找节点调度信息",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "updateNodeScheduleInfo",
|
||||
"requestMessageName": "UpdateNodeScheduleInfoRequest",
|
||||
"responseMessageName": "RPCSuccess",
|
||||
"code": "rpc updateNodeScheduleInfo(UpdateNodeScheduleInfoRequest) returns (RPCSuccess);",
|
||||
"doc": "修改节点调度信息",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "resetNodeActionStatus",
|
||||
"requestMessageName": "ResetNodeActionStatusRequest",
|
||||
"responseMessageName": "RPCSuccess",
|
||||
"code": "rpc resetNodeActionStatus(ResetNodeActionStatusRequest) returns (RPCSuccess);",
|
||||
"doc": "重置节点动作状态",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
}
|
||||
],
|
||||
"filename": "service_node.proto",
|
||||
"doc": "边缘节点管理服务"
|
||||
},
|
||||
{
|
||||
"name": "NodeActionService",
|
||||
"methods": [
|
||||
{
|
||||
"name": "createNodeAction",
|
||||
"requestMessageName": "CreateNodeActionRequest",
|
||||
"responseMessageName": "CreateNodeActionResponse",
|
||||
"code": "rpc createNodeAction(CreateNodeActionRequest) returns (CreateNodeActionResponse);",
|
||||
"doc": "添加动作",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "deleteNodeAction",
|
||||
"requestMessageName": "DeleteNodeActionRequest",
|
||||
"responseMessageName": "RPCSuccess",
|
||||
"code": "rpc deleteNodeAction(DeleteNodeActionRequest) returns (RPCSuccess);",
|
||||
"doc": "删除动作",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "updateNodeAction",
|
||||
"requestMessageName": "UpdateNodeActionRequest",
|
||||
"responseMessageName": "RPCSuccess",
|
||||
"code": "rpc updateNodeAction(UpdateNodeActionRequest) returns (RPCSuccess);",
|
||||
"doc": "修改动作",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "findAllNodeActions",
|
||||
"requestMessageName": "FindAllNodeActionsRequest",
|
||||
"responseMessageName": "FindAllNodeActionsResponse",
|
||||
"code": "rpc findAllNodeActions(FindAllNodeActionsRequest) returns (FindAllNodeActionsResponse);",
|
||||
"doc": "列出某个节点的所有动作",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
},
|
||||
{
|
||||
"name": "findNodeAction",
|
||||
"requestMessageName": "FindNodeActionRequest",
|
||||
"responseMessageName": "FindNodeActionResponse",
|
||||
"code": "rpc findNodeAction(FindNodeActionRequest) returns (FindNodeActionResponse);",
|
||||
"doc": "查找单个节点动作",
|
||||
"roles": [
|
||||
"admin"
|
||||
],
|
||||
"isDeprecated": false
|
||||
}
|
||||
],
|
||||
"filename": "service_node_action.proto",
|
||||
"doc": "节点动作服务"
|
||||
},
|
||||
{
|
||||
"name": "NodeClusterService",
|
||||
"methods": [
|
||||
@@ -14828,6 +14923,16 @@
|
||||
"code": "message CreateNSUserPlanResponse {\n\tint64 nsUserPlanId = 1;\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "CreateNodeActionRequest",
|
||||
"code": "message CreateNodeActionRequest {\n\tint64 nodeId = 1; // 节点ID\n\tstring role = 2; // 节点角色\n\tbytes condsJSON = 3; // 条件设置\n\tbytes actionJSON = 4; // 动作设置\n\tbytes durationJSON = 5; // 持续时间\n}",
|
||||
"doc": "添加动作"
|
||||
},
|
||||
{
|
||||
"name": "CreateNodeActionResponse",
|
||||
"code": "message CreateNodeActionResponse {\n\tint64 nodeActionId = 1;\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "CreateNodeClusterFirewallActionRequest",
|
||||
"code": "message CreateNodeClusterFirewallActionRequest {\n\tint64 nodeClusterId = 1;\n\tstring name = 2;\n\tstring eventLevel = 3;\n\tstring type = 4;\n\tbytes paramsJSON = 5;\n}",
|
||||
@@ -15513,6 +15618,11 @@
|
||||
"code": "message DeleteNSUserPlanRequest{\n\tint64 nsUserPlanId = 1;\n}",
|
||||
"doc": "删除用户套餐"
|
||||
},
|
||||
{
|
||||
"name": "DeleteNodeActionRequest",
|
||||
"code": "message DeleteNodeActionRequest {\n\tint64 nodeActionId = 1;\n}",
|
||||
"doc": "删除动作"
|
||||
},
|
||||
{
|
||||
"name": "DeleteNodeClusterFirewallActionRequest",
|
||||
"code": "message DeleteNodeClusterFirewallActionRequest {\n\tint64 nodeClusterFirewallActionId = 1;\n}",
|
||||
@@ -16788,6 +16898,16 @@
|
||||
"code": "message FindAllNSRoutesResponse {\n\trepeated NSRoute nsRoutes = 1;\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "FindAllNodeActionsRequest",
|
||||
"code": "message FindAllNodeActionsRequest {\n\tint64 nodeId = 1; // 节点ID\n\tstring role = 2; // 节点角色\n}",
|
||||
"doc": "列出某个节点的所有动作"
|
||||
},
|
||||
{
|
||||
"name": "FindAllNodeActionsResponse",
|
||||
"code": "message FindAllNodeActionsResponse {\n\trepeated NodeAction nodeActions = 1; // 动作列表\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "FindAllNodeClusterMetricItemsRequest",
|
||||
"code": "message FindAllNodeClusterMetricItemsRequest {\n\tint64 nodeClusterId = 1;\n\tstring category = 2;\n}",
|
||||
@@ -17670,7 +17790,7 @@
|
||||
},
|
||||
{
|
||||
"name": "FindEnabledNodeConfigInfoResponse",
|
||||
"code": "message FindEnabledNodeConfigInfoResponse {\n\tbool hasDNSInfo = 1;\n\tbool hasCacheInfo = 2;\n\tbool hasThresholds = 3;\n\tbool hasSSH = 4;\n\tbool hasSystemSettings = 5;\n\tbool hasDDoSProtection = 6;\n}",
|
||||
"code": "message FindEnabledNodeConfigInfoResponse {\n\tbool hasDNSInfo = 1; // 是否有DNS设置\n\tbool hasCacheInfo = 2; // 是否有缓存设置\n\tbool hasThresholds = 3; // 是否有阈值设置\n\tbool hasSSH = 4; // 是否有SSH设置\n\tbool hasSystemSettings = 5; // 是否有系统设置\n\tbool hasDDoSProtection = 6; // 是否有DDoS防护设置\n\tbool hasScheduleSettings = 7; // 是否有调度设置\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
@@ -18723,6 +18843,16 @@
|
||||
"code": "message FindNodeAPIConfigResponse {\n\tbytes apiNodeAddrsJSON = 1;\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "FindNodeActionRequest",
|
||||
"code": "message FindNodeActionRequest {\n\tint64 nodeActionId = 1; // 动作ID\n}",
|
||||
"doc": "查找单个节点动作"
|
||||
},
|
||||
{
|
||||
"name": "FindNodeActionResponse",
|
||||
"code": "message FindNodeActionResponse {\n\tNodeAction nodeAction = 1;\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "FindNodeClusterDDoSProtectionRequest",
|
||||
"code": "message FindNodeClusterDDoSProtectionRequest {\n\tint64 nodeClusterId = 1;\n}",
|
||||
@@ -18828,6 +18958,16 @@
|
||||
"code": "message FindNodeLoginSuggestPortsResponse {\n\trepeated int32 ports = 1;\n\trepeated int32 availablePorts = 2;\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "FindNodeScheduleInfoRequest",
|
||||
"code": "message FindNodeScheduleInfoRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
||||
"doc": "查找节点调度信息"
|
||||
},
|
||||
{
|
||||
"name": "FindNodeScheduleInfoResponse",
|
||||
"code": "message FindNodeScheduleInfoResponse {\n\tScheduleInfo scheduleInfo = 1; // 调度信息\n\n\n\tmessage ScheduleInfo {\n\t\tstring offlineDay = 1; // 下线日期,格式YYYYMMDD\n\t\tbool isBackupForCluster = 2; // 是否为集群备份节点\n\t\tbool isBackupForGroup = 3; // 是否为分组备份节点\n\t\trepeated string backupIPs = 4; // 备用IP\n\t\tbytes actionStatusJSON = 5; // 动作状态\n\t}\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "FindNodeTasksRequest",
|
||||
"code": "message FindNodeTasksRequest {\n\tint64 version = 1; // 上一次执行的版本\n}",
|
||||
@@ -20370,9 +20510,14 @@
|
||||
},
|
||||
{
|
||||
"name": "Node",
|
||||
"code": "message Node {\n\tint64 id = 1;\n\tstring name = 2;\n\tbytes statusJSON = 3;\n\tstring installDir = 4;\n\tbool isInstalled = 5;\n\tstring code = 6;\n\tstring uniqueId = 7;\n\tstring secret = 8;\n\tint64 version = 9;\n\tint64 latestVersion = 10;\n\trepeated int64 connectedAPINodeIds = 11;\n\tint32 maxCPU = 12;\n\tbool isOn = 13;\n\tbool isUp = 14;\n\trepeated DNSRoute dnsRoutes = 15;\n\tbool isActive = 16;\n\tSizeCapacity maxCacheDiskCapacity = 17;\n\tSizeCapacity maxCacheMemoryCapacity = 18;\n\tstring cacheDiskDir = 19;\n\tbytes cacheDiskSubDirsJSON = 23;\n\tint32 level = 20;\n\trepeated string lnAddrs = 21; // Ln访问地址\n\tbool enableIPLists = 22;\n\tbytes apiNodeAddrsJSON = 24;\n\n\tNodeCluster nodeCluster = 32; // 主集群\n\tNodeLogin nodeLogin = 33;\n\tNodeInstallStatus installStatus = 34;\n\trepeated NodeIPAddress ipAddresses = 35;\n\tNodeGroup nodeGroup = 36;\n\tNodeRegion nodeRegion = 37;\n\trepeated NodeCluster secondaryNodeClusters = 38; // 从集群\n}",
|
||||
"code": "message Node {\n\tint64 id = 1;\n\tstring name = 2;\n\tbytes statusJSON = 3;\n\tstring installDir = 4;\n\tbool isInstalled = 5;\n\tstring code = 6;\n\tstring uniqueId = 7;\n\tstring secret = 8;\n\tint64 version = 9;\n\tint64 latestVersion = 10;\n\trepeated int64 connectedAPINodeIds = 11;\n\tint32 maxCPU = 12;\n\tbool isOn = 13;\n\tbool isUp = 14;\n\trepeated DNSRoute dnsRoutes = 15;\n\tbool isActive = 16;\n\tSizeCapacity maxCacheDiskCapacity = 17;\n\tSizeCapacity maxCacheMemoryCapacity = 18;\n\tstring cacheDiskDir = 19;\n\tbytes cacheDiskSubDirsJSON = 23;\n\tint32 level = 20;\n\trepeated string lnAddrs = 21; // Ln访问地址\n\tbool enableIPLists = 22;\n\tbytes apiNodeAddrsJSON = 24;\n\tstring offlineDay = 25; // 下线日期\n\tbool isBackupForCluster = 26; // 是否为集群备用节点\n\tbool isBackupForGroup = 27; // 是否为分组备用节点\n\n\tNodeCluster nodeCluster = 32; // 主集群\n\tNodeLogin nodeLogin = 33;\n\tNodeInstallStatus installStatus = 34;\n\trepeated NodeIPAddress ipAddresses = 35;\n\tNodeGroup nodeGroup = 36;\n\tNodeRegion nodeRegion = 37;\n\trepeated NodeCluster secondaryNodeClusters = 38; // 从集群\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
"name": "NodeAction",
|
||||
"code": "message NodeAction {\n\tint64 id = 1;\n\tint64 nodeId = 2;\n\tstring role = 3;\n\tbool isOn = 4; // 是否启用\n\tbytes condsJSON = 5; // 条件定义\n\tbytes actionJSON = 6; // 动作定义\n\tbytes durationJSON = 7; // 持续时间\n}",
|
||||
"doc": "节点动作"
|
||||
},
|
||||
{
|
||||
"name": "NodeCluster",
|
||||
"code": "message NodeCluster {\n\tint64 id = 1;\n\tstring name = 2;\n\tint64 createdAt = 3;\n\tint64 nodeGrantId = 4;\n\tstring installDir = 5;\n\tstring uniqueId = 6;\n\tstring secret = 7;\n\tstring dnsName = 8;\n\tint64 dnsDomainId = 9;\n\tstring dnsDefaultRoute = 22; // DNS默认线路\n\tint64 httpCachePolicyId = 10;\n\tint64 httpFirewallPolicyId = 11;\n\tbool isOn = 12;\n\tstring timeZone = 13;\n\tint32 nodeMaxThreads = 14;\n\tbool autoOpenPorts = 16;\n\tbool isPinned = 17;\n\tbytes clockJSON = 18;\n\tbool autoRemoteStart = 19;\n\tbool autoInstallNftables = 20;\n\tbytes sshParamsJSON = 21;\n}",
|
||||
@@ -20390,7 +20535,7 @@
|
||||
},
|
||||
{
|
||||
"name": "NodeDNSInfo",
|
||||
"code": "message NodeDNSInfo {\n\tint64 id = 1;\n\tstring name = 2;\n\tstring ipAddr = 3;\n\tint64 nodeIPAddressId = 9;\n\trepeated DNSRoute routes = 4;\n\tint64 nodeClusterId = 5;\n\tint64 dnsDomainId = 6;\n\tstring dnsDomainName = 7;\n\tstring nodeClusterDNSName = 8;\n}",
|
||||
"code": "message NodeDNSInfo {\n\tint64 id = 1;\n\tstring name = 2;\n\tstring ipAddr = 3;\n\tint64 nodeIPAddressId = 9;\n\trepeated DNSRoute routes = 4;\n\tint64 nodeClusterId = 5;\n\tint64 dnsDomainId = 6;\n\tstring dnsDomainName = 7;\n\tstring nodeClusterDNSName = 8;\n\tbool isBackupForCluster = 10; // 是否为集群备份节点\n\tbool isBackupForGroup = 11; // 是否为分组备份节点\n\tbool isOffline = 12; // 是否下线\n}",
|
||||
"doc": ""
|
||||
},
|
||||
{
|
||||
@@ -20673,6 +20818,11 @@
|
||||
"code": "message ResetHTTPCacheTaskRequest {\n\tint64 httpCacheTaskId = 1;\n}",
|
||||
"doc": "重置任务状态"
|
||||
},
|
||||
{
|
||||
"name": "ResetNodeActionStatusRequest",
|
||||
"code": "message ResetNodeActionStatusRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
||||
"doc": "重置节点动作状态"
|
||||
},
|
||||
{
|
||||
"name": "ResetSSLCertsWithOCSPErrorRequest",
|
||||
"code": "message ResetSSLCertsWithOCSPErrorRequest {\n\trepeated int64 sslCertIds = 1;\n}",
|
||||
@@ -21628,6 +21778,11 @@
|
||||
"code": "message UpdateNodeAPIConfigRequest {\n\tint64 nodeId = 1;\n\tbytes apiNodeAddrsJSON = 2;\n}",
|
||||
"doc": "修改某个节点的API相关配置"
|
||||
},
|
||||
{
|
||||
"name": "UpdateNodeActionRequest",
|
||||
"code": "message UpdateNodeActionRequest {\n\tint64 nodeActionId = 1; // 动作ID\n\tbytes condsJSON = 2;\n\tbytes actionJSON = 3;\n\tbytes durationJSON = 4; // 持续时间\n\tbool isOn = 5; // 是否启用\n}",
|
||||
"doc": "修改动作"
|
||||
},
|
||||
{
|
||||
"name": "UpdateNodeCacheRequest",
|
||||
"code": "message UpdateNodeCacheRequest {\n\tint64 nodeId = 1; // 节点ID\n\tSizeCapacity maxCacheDiskCapacity = 2; // 磁盘容量限制\n\tSizeCapacity maxCacheMemoryCapacity = 3; // 内存容量限制\n\tstring cacheDiskDir = 4; // 磁盘缓存目录\n\tbytes cacheDiskSubDirsJSON = 5; // 磁盘缓存子目录\n}",
|
||||
@@ -21798,6 +21953,11 @@
|
||||
"code": "message UpdateNodeRequest {\n\tint64 nodeId = 1;\n\tstring name = 2;\n\tint64 nodeClusterId = 3;\n\trepeated int64 secondaryNodeClusterIds = 13;\n\tbool isOn = 6;\n\tint64 nodeGroupId = 7;\n\tint64 nodeRegionId = 10;\n\tint32 level = 14;\n\trepeated string lnAddrs = 15; // Ln节点访问地址\n\tbool enableIPLists = 16; // 是否启用IP名单\n}",
|
||||
"doc": "修改节点"
|
||||
},
|
||||
{
|
||||
"name": "UpdateNodeScheduleInfoRequest",
|
||||
"code": "message UpdateNodeScheduleInfoRequest {\n\tint64 nodeId = 1; // 节点ID\n\tstring offlineDay = 2; // 下线日期,格式YYYYMMDD\n\tbool isBackupForCluster = 3; // 是否为集群备份节点\n\tbool isBackupForGroup = 4; // 是否为分组备份节点\n\trepeated string backupIPs = 5; // 备用IP\n}",
|
||||
"doc": "修改节点调度信息"
|
||||
},
|
||||
{
|
||||
"name": "UpdateNodeStatusRequest",
|
||||
"code": "message UpdateNodeStatusRequest {\n\tint64 nodeId = 1;\n\tbytes statusJSON = 2;\n}",
|
||||
|
||||
423
pkg/nodeconfigs/node_actions.go
Normal file
423
pkg/nodeconfigs/node_actions.go
Normal file
@@ -0,0 +1,423 @@
|
||||
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
//go:build plus
|
||||
|
||||
package nodeconfigs
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
)
|
||||
|
||||
type NodeActionParam = string
|
||||
|
||||
const (
|
||||
NodeActionParamDailyTrafficOut NodeActionParam = "dailyTrafficOut" // 节点日出口流量
|
||||
NodeActionParamMonthlyTrafficOut NodeActionParam = "monthlyTrafficOut" // 节点月出口流量
|
||||
|
||||
// NodeActionParamTotalTraffic NodeActionParam = "totalTraffic" // 节点总流量 TODO 需要实现
|
||||
|
||||
NodeActionParamBandwidthIn NodeActionParam = "bandwidthIn" // 节点入口带宽
|
||||
NodeActionParamBandwidthOut NodeActionParam = "bandwidthOut" // 节点出口带宽
|
||||
NodeActionParamCPUUsage NodeActionParam = "cpuUsage" // 节点CPU用量,百分比制,0-100
|
||||
NodeActionParamMemoryUsage NodeActionParam = "memoryUsage" // 节点内存用量,百分比制,0-100
|
||||
NodeActionParamLoad NodeActionParam = "load" // 当前节点负载
|
||||
|
||||
// NodeActionParamConnectivity NodeActionParam = "connectivity" // 节点连通性 TODO 需要实现
|
||||
|
||||
NodeActionParamHealthCheckFailure NodeActionParam = "heathCheckFailure" // 节点健康检查失败
|
||||
)
|
||||
|
||||
type NodeActionParamDefinition struct {
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Description string `json:"description"`
|
||||
Operators []NodeActionOperator `json:"operators"`
|
||||
ValueName string `json:"valueName"`
|
||||
ValueType string `json:"valueType"`
|
||||
}
|
||||
|
||||
func FindAllNodeActionParamDefinitions() []*NodeActionParamDefinition {
|
||||
return []*NodeActionParamDefinition{
|
||||
{
|
||||
Code: NodeActionParamBandwidthOut,
|
||||
Name: "节点出口带宽",
|
||||
Description: "当前节点当前时间点的出口平均带宽(从节点发送到客户端)。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "对比带宽",
|
||||
ValueType: "bandwidth",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamBandwidthIn,
|
||||
Name: "节点入口带宽",
|
||||
Description: "当前节点当前时间点的入口平均带宽(从客户端发送到节点)。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "对比带宽",
|
||||
ValueType: "bandwidth",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamMonthlyTrafficOut,
|
||||
Name: "节点当月流量",
|
||||
Description: "当前节点在当月的出口流量。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "对比流量",
|
||||
ValueType: "traffic",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamDailyTrafficOut,
|
||||
Name: "节点当日流量",
|
||||
Description: "当前节点在当天的出口流量。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "对比流量",
|
||||
ValueType: "traffic",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamCPUUsage,
|
||||
Name: "节点CPU利用率",
|
||||
Description: "节点当前CPU利用率,取值范围为0-100。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "CPU利用率",
|
||||
ValueType: "cpu",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamMemoryUsage,
|
||||
Name: "节点内存利用率",
|
||||
Description: "节点当前内存利用率,取值范围为0-100。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "内存利用率",
|
||||
ValueType: "memory",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamLoad,
|
||||
Name: "节点负载",
|
||||
Description: "节点当前负载,取值范围为0-∞,通常超过10表示系统负载较重。",
|
||||
Operators: allNodeActionNumberOperators,
|
||||
ValueName: "系统负载",
|
||||
ValueType: "load",
|
||||
},
|
||||
{
|
||||
Code: NodeActionParamHealthCheckFailure,
|
||||
Name: "健康检查失败",
|
||||
Description: "当前节点任一IP健康检查失败。",
|
||||
Operators: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type NodeActionOperator = string
|
||||
|
||||
const (
|
||||
NodeActionOperatorGt NodeActionOperator = "gt"
|
||||
NodeActionOperatorGte NodeActionOperator = "gte"
|
||||
NodeActionOperatorLt NodeActionOperator = "lt"
|
||||
NodeActionOperatorLte NodeActionOperator = "lte"
|
||||
NodeActionOperatorEq NodeActionOperator = "eq"
|
||||
)
|
||||
|
||||
var allNodeActionNumberOperators = []NodeActionOperator{NodeActionOperatorGt, NodeActionOperatorGte, NodeActionOperatorLt, NodeActionOperatorLte, NodeActionOperatorEq}
|
||||
|
||||
func FindAllNodeActionOperatorDefinitions() []*shared.Definition {
|
||||
return []*shared.Definition{
|
||||
{
|
||||
Code: NodeActionOperatorGt,
|
||||
Name: "大于(>)",
|
||||
},
|
||||
{
|
||||
Code: NodeActionOperatorGte,
|
||||
Name: "大于等于(≥)",
|
||||
},
|
||||
{
|
||||
Code: NodeActionOperatorLt,
|
||||
Name: "小于(<)",
|
||||
},
|
||||
{
|
||||
Code: NodeActionOperatorLte,
|
||||
Name: "小于等于(≤)",
|
||||
},
|
||||
{
|
||||
Code: NodeActionOperatorEq,
|
||||
Name: "等于(=)",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NodeActionCondConnector 条件之间关系
|
||||
type NodeActionCondConnector = string
|
||||
|
||||
const (
|
||||
NodeActionCondConnectorAnd NodeActionCondConnector = "and"
|
||||
NodeActionCondConnectorOr NodeActionCondConnector = "or"
|
||||
)
|
||||
|
||||
type NodeActionCond struct {
|
||||
Param NodeActionParam `json:"param"` // 参数名
|
||||
Operator NodeActionOperator `json:"operator"` // 操作符
|
||||
Value any `json:"value"` // 对比值
|
||||
}
|
||||
|
||||
func (this *NodeActionCond) Match(value any) bool {
|
||||
var paramDef *NodeActionParamDefinition
|
||||
for _, paramDef2 := range FindAllNodeActionParamDefinitions() {
|
||||
if paramDef2.Code == this.Param {
|
||||
paramDef = paramDef2
|
||||
break
|
||||
}
|
||||
}
|
||||
if paramDef == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
switch paramDef.ValueType {
|
||||
case "bandwidth":
|
||||
if value != nil && !this.isScalar(value) {
|
||||
var value1Map = maps.NewMap(value)
|
||||
value = this.toBandwidthBits(value1Map)
|
||||
}
|
||||
var value2Map = maps.NewMap(this.Value)
|
||||
return this.compare(value, this.toBandwidthBits(value2Map))
|
||||
case "traffic":
|
||||
if value != nil && !this.isScalar(value) {
|
||||
var value1Map = maps.NewMap(value)
|
||||
value = this.toTrafficBytes(value1Map)
|
||||
}
|
||||
var value2Map = maps.NewMap(this.Value)
|
||||
return this.compare(value, this.toTrafficBytes(value2Map))
|
||||
case "cpu":
|
||||
return this.compare(value, this.Value)
|
||||
case "memory":
|
||||
return this.compare(value, this.Value)
|
||||
case "load":
|
||||
return this.compare(value, this.Value)
|
||||
case "":
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *NodeActionCond) compare(value1, value2 any) bool {
|
||||
switch this.Operator {
|
||||
case NodeActionOperatorGt:
|
||||
return types.Int64(value1) > types.Int64(value2)
|
||||
case NodeActionOperatorGte:
|
||||
return types.Int64(value1) >= types.Int64(value2)
|
||||
case NodeActionOperatorLt:
|
||||
return types.Int64(value1) < types.Int64(value2)
|
||||
case NodeActionOperatorLte:
|
||||
return types.Int64(value1) <= types.Int64(value2)
|
||||
case NodeActionOperatorEq:
|
||||
return types.Int64(value1) == types.Int64(value2)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *NodeActionCond) toBandwidthBits(m maps.Map) int64 {
|
||||
var count = m.GetInt64("count")
|
||||
var unit = m.GetString("unit")
|
||||
if count <= 0 {
|
||||
return 0
|
||||
}
|
||||
switch unit {
|
||||
case "b":
|
||||
return count
|
||||
case "kb":
|
||||
return count << 10
|
||||
case "mb":
|
||||
return count << 20
|
||||
case "gb":
|
||||
return count << 30
|
||||
case "tb":
|
||||
return count << 40
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *NodeActionCond) toTrafficBytes(m maps.Map) int64 {
|
||||
var count = m.GetInt64("count")
|
||||
var unit = m.GetString("unit")
|
||||
if count <= 0 {
|
||||
return 0
|
||||
}
|
||||
switch unit {
|
||||
case "b":
|
||||
return count
|
||||
case "kb":
|
||||
return count << 10
|
||||
case "mb":
|
||||
return count << 20
|
||||
case "gb":
|
||||
return count << 30
|
||||
case "tb":
|
||||
return count << 40
|
||||
case "pb":
|
||||
return count << 50
|
||||
case "eb":
|
||||
return count << 60
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *NodeActionCond) isScalar(value any) bool {
|
||||
if value == nil {
|
||||
return false
|
||||
}
|
||||
switch value.(type) {
|
||||
case int, int8, int16, int32, int64, uint, uint8, uint16, uint64, float32, float64, string, bool:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type NodeActionCondsConfig struct {
|
||||
Conds []*NodeActionCond `json:"conds"`
|
||||
Connector NodeActionCondConnector `json:"connector"`
|
||||
}
|
||||
|
||||
func NewNodeActionCondsConfig() *NodeActionCondsConfig {
|
||||
return &NodeActionCondsConfig{
|
||||
Connector: NodeActionCondConnectorAnd,
|
||||
}
|
||||
}
|
||||
|
||||
func (this *NodeActionCondsConfig) Match(valueGetter func(param NodeActionParam) (value any, err error)) (bool, error) {
|
||||
if len(this.Conds) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
for index, cond := range this.Conds {
|
||||
value, err := valueGetter(cond.Param)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
var b = cond.Match(value)
|
||||
if !b {
|
||||
if this.Connector == NodeActionCondConnectorAnd {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// 如果是最后一个OR条件,则直接返回false
|
||||
if index == len(this.Conds)-1 {
|
||||
return false, nil
|
||||
}
|
||||
} else {
|
||||
if this.Connector == NodeActionCondConnectorOr {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// 如果是最后一个AND条件,则直接返回true
|
||||
if index == len(this.Conds)-1 {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// NodeActionCode 动作代号
|
||||
type NodeActionCode = string
|
||||
|
||||
const (
|
||||
NodeActionCodeUp NodeActionCode = "up" // 上线
|
||||
NodeActionCodeDown NodeActionCode = "down" // 下线
|
||||
NodeActionCodeSwitchToBackupNodesInCluster NodeActionCode = "switchToBackupNodesInCluster" // 切换到集群备用节点
|
||||
NodeActionCodeSwitchToBackupNodesInGroup NodeActionCode = "switchToBackupNodesInGroup" // 切换到分组备用节点
|
||||
NodeActionCodeSwitchToBackupIP NodeActionCode = "switchToBackupIP" // 切换到备用IP
|
||||
NodeActionCodeEnableBackupNodesInCluster NodeActionCode = "enableBackupNodesInCluster" // 启用集群备用节点
|
||||
NodeActionCodeEnableBackupNodesInGroup NodeActionCode = "enableBackupNodesInGroup" // 启用分组备用节点
|
||||
NodeActionCodeEnableBackupIP NodeActionCode = "enableBackupIP" // 启用备用IP
|
||||
NodeActionCodeWebHook NodeActionCode = "webHook" // WebHook
|
||||
)
|
||||
|
||||
func FindAllNodeActionDefinitions() []*shared.Definition {
|
||||
return []*shared.Definition{
|
||||
{
|
||||
Code: NodeActionCodeUp,
|
||||
Name: "上线当前节点",
|
||||
Description: "将当前节点状态设置为在线。",
|
||||
},
|
||||
{
|
||||
Code: NodeActionCodeDown,
|
||||
Name: "下线当前节点",
|
||||
Description: "将当前节点状态设置为离线。",
|
||||
},
|
||||
{
|
||||
Code: NodeActionCodeSwitchToBackupNodesInCluster,
|
||||
Name: "切换到集群备用节点",
|
||||
Description: "下线当前节点并启用节点所在集群备用节点。",
|
||||
},
|
||||
{
|
||||
Code: NodeActionCodeSwitchToBackupNodesInGroup,
|
||||
Name: "切换到分组备用节点",
|
||||
Description: "下线当前节点并启用节点所在分组备用节点。",
|
||||
},
|
||||
{
|
||||
Code: NodeActionCodeSwitchToBackupIP,
|
||||
Name: "切换到备用IP",
|
||||
Description: "将当前节点的IP切换到当前节点配置的备用IP",
|
||||
},
|
||||
|
||||
{
|
||||
Code: NodeActionCodeEnableBackupNodesInCluster,
|
||||
Name: "启用集群备用节点",
|
||||
Description: "保持当前节点并启用节点所在集群备用节点。",
|
||||
},
|
||||
{
|
||||
Code: NodeActionCodeEnableBackupNodesInGroup,
|
||||
Name: "启用分组备用节点",
|
||||
Description: "保持当前节点并启用节点所在分组备用节点。",
|
||||
},
|
||||
{
|
||||
Code: NodeActionCodeEnableBackupIP,
|
||||
Name: "启用备用IP",
|
||||
Description: "保持当前节点的IP并启用当前节点配置的备用IP",
|
||||
},
|
||||
|
||||
{
|
||||
Code: NodeActionCodeWebHook,
|
||||
Name: "WebHook",
|
||||
Description: "通过WebHook发送通知到URL",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func FindNodeActionDefinition(code NodeActionCode) *shared.Definition {
|
||||
for _, def := range FindAllNodeActionDefinitions() {
|
||||
if def.Code == code {
|
||||
return def
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindNodeActionName(code NodeActionCode) string {
|
||||
var def = FindNodeActionDefinition(code)
|
||||
if def != nil {
|
||||
return def.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// NodeActionConfig 动作配置
|
||||
type NodeActionConfig struct {
|
||||
Code NodeActionCode `json:"code"` // 动作代号
|
||||
Params any `json:"params"` // 动作参数
|
||||
}
|
||||
|
||||
func NewNodeActionConfig() *NodeActionConfig {
|
||||
return &NodeActionConfig{}
|
||||
}
|
||||
|
||||
type NodeActionCodeWebHookParams struct {
|
||||
URL string `json:"url"` // URL路径
|
||||
}
|
||||
|
||||
// NodeActionStatus 动作状态
|
||||
type NodeActionStatus struct {
|
||||
ActionId int64 `json:"actionId"` // 动作ID
|
||||
CreatedAt int64 `json:"createdAt"` // 状态创建时间
|
||||
Conds *NodeActionCondsConfig `json:"conds"` // 动作条件
|
||||
Action *NodeActionConfig `json:"action"` // 动作配置
|
||||
ExpiresAt int64 `json:"expiresAt"` // 过期时间
|
||||
}
|
||||
@@ -10,11 +10,14 @@ import (
|
||||
type NodeValueItem = string
|
||||
|
||||
const (
|
||||
NodeValueItemCPU NodeValueItem = "cpu" // CPU
|
||||
NodeValueItemMemory NodeValueItem = "memory" // 内存
|
||||
NodeValueItemLoad NodeValueItem = "load" // 负载
|
||||
NodeValueItemTrafficIn NodeValueItem = "trafficIn" // 上行流量
|
||||
NodeValueItemTrafficOut NodeValueItem = "trafficOut" // 下行流量
|
||||
NodeValueItemCPU NodeValueItem = "cpu" // CPU
|
||||
NodeValueItemMemory NodeValueItem = "memory" // 内存
|
||||
NodeValueItemLoad NodeValueItem = "load" // 负载
|
||||
|
||||
NodeValueItemTrafficIn NodeValueItem = "trafficIn" // 业务上行流量
|
||||
NodeValueItemTrafficOut NodeValueItem = "trafficOut" // 业务下行流量
|
||||
NodeValueItemAllTraffic NodeValueItem = "allTraffic" // 所有流量
|
||||
|
||||
NodeValueItemConnections NodeValueItem = "connections" // 连接数
|
||||
NodeValueItemRequests NodeValueItem = "requests" // 请求访问量
|
||||
NodeValueItemAttackRequests NodeValueItem = "attackRequests" // 攻击请求访问量
|
||||
|
||||
@@ -54,7 +54,10 @@ type Node struct {
|
||||
LnAddrs []string `protobuf:"bytes,21,rep,name=lnAddrs,proto3" json:"lnAddrs,omitempty"` // Ln访问地址
|
||||
EnableIPLists bool `protobuf:"varint,22,opt,name=enableIPLists,proto3" json:"enableIPLists,omitempty"`
|
||||
ApiNodeAddrsJSON []byte `protobuf:"bytes,24,opt,name=apiNodeAddrsJSON,proto3" json:"apiNodeAddrsJSON,omitempty"`
|
||||
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
||||
OfflineDay string `protobuf:"bytes,25,opt,name=offlineDay,proto3" json:"offlineDay,omitempty"` // 下线日期
|
||||
IsBackupForCluster bool `protobuf:"varint,26,opt,name=isBackupForCluster,proto3" json:"isBackupForCluster,omitempty"` // 是否为集群备用节点
|
||||
IsBackupForGroup bool `protobuf:"varint,27,opt,name=isBackupForGroup,proto3" json:"isBackupForGroup,omitempty"` // 是否为分组备用节点
|
||||
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
||||
NodeLogin *NodeLogin `protobuf:"bytes,33,opt,name=nodeLogin,proto3" json:"nodeLogin,omitempty"`
|
||||
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
||||
IpAddresses []*NodeIPAddress `protobuf:"bytes,35,rep,name=ipAddresses,proto3" json:"ipAddresses,omitempty"`
|
||||
@@ -263,6 +266,27 @@ func (x *Node) GetApiNodeAddrsJSON() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Node) GetOfflineDay() string {
|
||||
if x != nil {
|
||||
return x.OfflineDay
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetIsBackupForCluster() bool {
|
||||
if x != nil {
|
||||
return x.IsBackupForCluster
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Node) GetIsBackupForGroup() bool {
|
||||
if x != nil {
|
||||
return x.IsBackupForGroup
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Node) GetNodeCluster() *NodeCluster {
|
||||
if x != nil {
|
||||
return x.NodeCluster
|
||||
@@ -420,7 +444,7 @@ var file_models_model_node_proto_rawDesc = []byte{
|
||||
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
|
||||
0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69,
|
||||
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x09, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
|
||||
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaa, 0x0a, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a,
|
||||
@@ -472,41 +496,49 @@ var file_models_model_node_proto_rawDesc = []byte{
|
||||
0x49, 0x50, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x61, 0x70, 0x69, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x41, 0x64, 0x64, 0x72, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x18, 0x20, 0x01, 0x28,
|
||||
0x0c, 0x52, 0x10, 0x61, 0x70, 0x69, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x64, 0x64, 0x72, 0x73, 0x4a,
|
||||
0x53, 0x4f, 0x4e, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f,
|
||||
0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f,
|
||||
0x67, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x12, 0x33, 0x0a, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18,
|
||||
0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49,
|
||||
0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x12, 0x2e, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x25, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x52, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x09, 0x42, 0x61,
|
||||
0x73, 0x69, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
||||
0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
||||
0x73, 0x55, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
|
||||
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04,
|
||||
0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x53, 0x4f, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61,
|
||||
0x79, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65,
|
||||
0x44, 0x61, 0x79, 0x12, 0x2e, 0x0a, 0x12, 0x69, 0x73, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46,
|
||||
0x6f, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x12, 0x69, 0x73, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x6f, 0x72, 0x43, 0x6c, 0x75, 0x73,
|
||||
0x74, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x73, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46,
|
||||
0x6f, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x69,
|
||||
0x73, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x6f, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12,
|
||||
0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
|
||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x18,
|
||||
0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c,
|
||||
0x6f, 0x67, 0x69, 0x6e, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12,
|
||||
0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x69,
|
||||
0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x33, 0x0a, 0x0b,
|
||||
0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x23, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65,
|
||||
0x73, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x24,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x2e,
|
||||
0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x25, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x45,
|
||||
0x0a, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x15,
|
||||
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
||||
0x73, 0x55, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
||||
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
206
pkg/rpc/pb/model_node_action.pb.go
Normal file
206
pkg/rpc/pb/model_node_action.pb.go
Normal file
@@ -0,0 +1,206 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.19.4
|
||||
// source: models/model_node_action.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 NodeAction struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
NodeId int64 `protobuf:"varint,2,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
|
||||
Role string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"`
|
||||
IsOn bool `protobuf:"varint,4,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用
|
||||
CondsJSON []byte `protobuf:"bytes,5,opt,name=condsJSON,proto3" json:"condsJSON,omitempty"` // 条件定义
|
||||
ActionJSON []byte `protobuf:"bytes,6,opt,name=actionJSON,proto3" json:"actionJSON,omitempty"` // 动作定义
|
||||
DurationJSON []byte `protobuf:"bytes,7,opt,name=durationJSON,proto3" json:"durationJSON,omitempty"` // 持续时间
|
||||
}
|
||||
|
||||
func (x *NodeAction) Reset() {
|
||||
*x = NodeAction{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_models_model_node_action_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeAction) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeAction) ProtoMessage() {}
|
||||
|
||||
func (x *NodeAction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_models_model_node_action_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 NodeAction.ProtoReflect.Descriptor instead.
|
||||
func (*NodeAction) Descriptor() ([]byte, []int) {
|
||||
return file_models_model_node_action_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetNodeId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetRole() string {
|
||||
if x != nil {
|
||||
return x.Role
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetIsOn() bool {
|
||||
if x != nil {
|
||||
return x.IsOn
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetCondsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.CondsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetActionJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ActionJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NodeAction) GetDurationJSON() []byte {
|
||||
if x != nil {
|
||||
return x.DurationJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_models_model_node_action_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_models_model_node_action_proto_rawDesc = []byte{
|
||||
0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x02, 0x70, 0x62, 0x22, 0xbe, 0x01, 0x0a, 0x0a, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 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, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72,
|
||||
0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
||||
0x73, 0x4f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 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_action_proto_rawDescOnce sync.Once
|
||||
file_models_model_node_action_proto_rawDescData = file_models_model_node_action_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_models_model_node_action_proto_rawDescGZIP() []byte {
|
||||
file_models_model_node_action_proto_rawDescOnce.Do(func() {
|
||||
file_models_model_node_action_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_node_action_proto_rawDescData)
|
||||
})
|
||||
return file_models_model_node_action_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_models_model_node_action_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_models_model_node_action_proto_goTypes = []interface{}{
|
||||
(*NodeAction)(nil), // 0: pb.NodeAction
|
||||
}
|
||||
var file_models_model_node_action_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_action_proto_init() }
|
||||
func file_models_model_node_action_proto_init() {
|
||||
if File_models_model_node_action_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_models_model_node_action_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeAction); 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_action_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_models_model_node_action_proto_goTypes,
|
||||
DependencyIndexes: file_models_model_node_action_proto_depIdxs,
|
||||
MessageInfos: file_models_model_node_action_proto_msgTypes,
|
||||
}.Build()
|
||||
File_models_model_node_action_proto = out.File
|
||||
file_models_model_node_action_proto_rawDesc = nil
|
||||
file_models_model_node_action_proto_goTypes = nil
|
||||
file_models_model_node_action_proto_depIdxs = nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
971
pkg/rpc/pb/service_node_action.pb.go
Normal file
971
pkg/rpc/pb/service_node_action.pb.go
Normal file
@@ -0,0 +1,971 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.19.4
|
||||
// source: service_node_action.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
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 CreateNodeActionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"` // 节点ID
|
||||
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` // 节点角色
|
||||
CondsJSON []byte `protobuf:"bytes,3,opt,name=condsJSON,proto3" json:"condsJSON,omitempty"` // 条件设置
|
||||
ActionJSON []byte `protobuf:"bytes,4,opt,name=actionJSON,proto3" json:"actionJSON,omitempty"` // 动作设置
|
||||
DurationJSON []byte `protobuf:"bytes,5,opt,name=durationJSON,proto3" json:"durationJSON,omitempty"` // 持续时间
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) Reset() {
|
||||
*x = CreateNodeActionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateNodeActionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateNodeActionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_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 CreateNodeActionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateNodeActionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) GetNodeId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) GetRole() string {
|
||||
if x != nil {
|
||||
return x.Role
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) GetCondsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.CondsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) GetActionJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ActionJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionRequest) GetDurationJSON() []byte {
|
||||
if x != nil {
|
||||
return x.DurationJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateNodeActionResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeActionId int64 `protobuf:"varint,1,opt,name=nodeActionId,proto3" json:"nodeActionId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionResponse) Reset() {
|
||||
*x = CreateNodeActionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateNodeActionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateNodeActionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[1]
|
||||
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 CreateNodeActionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateNodeActionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateNodeActionResponse) GetNodeActionId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeActionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 删除动作
|
||||
type DeleteNodeActionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeActionId int64 `protobuf:"varint,1,opt,name=nodeActionId,proto3" json:"nodeActionId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteNodeActionRequest) Reset() {
|
||||
*x = DeleteNodeActionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteNodeActionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteNodeActionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteNodeActionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[2]
|
||||
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 DeleteNodeActionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteNodeActionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DeleteNodeActionRequest) GetNodeActionId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeActionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 修改动作
|
||||
type UpdateNodeActionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeActionId int64 `protobuf:"varint,1,opt,name=nodeActionId,proto3" json:"nodeActionId,omitempty"` // 动作ID
|
||||
CondsJSON []byte `protobuf:"bytes,2,opt,name=condsJSON,proto3" json:"condsJSON,omitempty"`
|
||||
ActionJSON []byte `protobuf:"bytes,3,opt,name=actionJSON,proto3" json:"actionJSON,omitempty"`
|
||||
DurationJSON []byte `protobuf:"bytes,4,opt,name=durationJSON,proto3" json:"durationJSON,omitempty"` // 持续时间
|
||||
IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) Reset() {
|
||||
*x = UpdateNodeActionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateNodeActionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateNodeActionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[3]
|
||||
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 UpdateNodeActionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateNodeActionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) GetNodeActionId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeActionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) GetCondsJSON() []byte {
|
||||
if x != nil {
|
||||
return x.CondsJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) GetActionJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ActionJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) GetDurationJSON() []byte {
|
||||
if x != nil {
|
||||
return x.DurationJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateNodeActionRequest) GetIsOn() bool {
|
||||
if x != nil {
|
||||
return x.IsOn
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 列出某个节点的所有动作
|
||||
type FindAllNodeActionsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"` // 节点ID
|
||||
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` // 节点角色
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsRequest) Reset() {
|
||||
*x = FindAllNodeActionsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindAllNodeActionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FindAllNodeActionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindAllNodeActionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FindAllNodeActionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsRequest) GetNodeId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsRequest) GetRole() string {
|
||||
if x != nil {
|
||||
return x.Role
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type FindAllNodeActionsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeActions []*NodeAction `protobuf:"bytes,1,rep,name=nodeActions,proto3" json:"nodeActions,omitempty"` // 动作列表
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsResponse) Reset() {
|
||||
*x = FindAllNodeActionsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindAllNodeActionsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FindAllNodeActionsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindAllNodeActionsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FindAllNodeActionsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *FindAllNodeActionsResponse) GetNodeActions() []*NodeAction {
|
||||
if x != nil {
|
||||
return x.NodeActions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 查找单个节点动作
|
||||
type FindNodeActionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeActionId int64 `protobuf:"varint,1,opt,name=nodeActionId,proto3" json:"nodeActionId,omitempty"` // 动作ID
|
||||
}
|
||||
|
||||
func (x *FindNodeActionRequest) Reset() {
|
||||
*x = FindNodeActionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindNodeActionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindNodeActionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FindNodeActionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[6]
|
||||
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 FindNodeActionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FindNodeActionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *FindNodeActionRequest) GetNodeActionId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeActionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FindNodeActionResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeAction *NodeAction `protobuf:"bytes,1,opt,name=nodeAction,proto3" json:"nodeAction,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindNodeActionResponse) Reset() {
|
||||
*x = FindNodeActionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_action_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindNodeActionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindNodeActionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FindNodeActionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_action_proto_msgTypes[7]
|
||||
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 FindNodeActionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FindNodeActionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_action_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *FindNodeActionResponse) GetNodeAction() *NodeAction {
|
||||
if x != nil {
|
||||
return x.NodeAction
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_service_node_action_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_node_action_proto_rawDesc = []byte{
|
||||
0x0a, 0x19, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x61,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a,
|
||||
0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f,
|
||||
0x64, 0x65, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 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, 0xa7, 0x01, 0x0a, 0x17, 0x43,
|
||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 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, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f,
|
||||
0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e,
|
||||
0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e,
|
||||
0x12, 0x22, 0x0a, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x3e, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x22, 0x0a, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x22, 0xb3, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x22, 0x0a, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53, 0x4f, 0x4e,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f,
|
||||
0x4e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x22, 0x47, 0x0a, 0x19, 0x46, 0x69, 0x6e,
|
||||
0x64, 0x41, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 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, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f,
|
||||
0x6c, 0x65, 0x22, 0x4e, 0x0a, 0x1a, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x30, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x41,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x22, 0x3b, 0x0a, 0x15, 0x46, 0x69, 0x6e, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22,
|
||||
0x48, 0x0a, 0x16, 0x46, 0x69, 0x6e, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x0a, 0x6e, 0x6f, 0x64,
|
||||
0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x82, 0x03, 0x0a, 0x11, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x4d, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f,
|
||||
0x0a, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12,
|
||||
0x3f, 0x0a, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x12, 0x53, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x41,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64,
|
||||
0x41, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41,
|
||||
0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0e, 0x66, 0x69, 0x6e, 0x64, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e,
|
||||
0x64, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_service_node_action_proto_rawDescOnce sync.Once
|
||||
file_service_node_action_proto_rawDescData = file_service_node_action_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_service_node_action_proto_rawDescGZIP() []byte {
|
||||
file_service_node_action_proto_rawDescOnce.Do(func() {
|
||||
file_service_node_action_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_node_action_proto_rawDescData)
|
||||
})
|
||||
return file_service_node_action_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_node_action_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_service_node_action_proto_goTypes = []interface{}{
|
||||
(*CreateNodeActionRequest)(nil), // 0: pb.CreateNodeActionRequest
|
||||
(*CreateNodeActionResponse)(nil), // 1: pb.CreateNodeActionResponse
|
||||
(*DeleteNodeActionRequest)(nil), // 2: pb.DeleteNodeActionRequest
|
||||
(*UpdateNodeActionRequest)(nil), // 3: pb.UpdateNodeActionRequest
|
||||
(*FindAllNodeActionsRequest)(nil), // 4: pb.FindAllNodeActionsRequest
|
||||
(*FindAllNodeActionsResponse)(nil), // 5: pb.FindAllNodeActionsResponse
|
||||
(*FindNodeActionRequest)(nil), // 6: pb.FindNodeActionRequest
|
||||
(*FindNodeActionResponse)(nil), // 7: pb.FindNodeActionResponse
|
||||
(*NodeAction)(nil), // 8: pb.NodeAction
|
||||
(*RPCSuccess)(nil), // 9: pb.RPCSuccess
|
||||
}
|
||||
var file_service_node_action_proto_depIdxs = []int32{
|
||||
8, // 0: pb.FindAllNodeActionsResponse.nodeActions:type_name -> pb.NodeAction
|
||||
8, // 1: pb.FindNodeActionResponse.nodeAction:type_name -> pb.NodeAction
|
||||
0, // 2: pb.NodeActionService.createNodeAction:input_type -> pb.CreateNodeActionRequest
|
||||
2, // 3: pb.NodeActionService.deleteNodeAction:input_type -> pb.DeleteNodeActionRequest
|
||||
3, // 4: pb.NodeActionService.updateNodeAction:input_type -> pb.UpdateNodeActionRequest
|
||||
4, // 5: pb.NodeActionService.findAllNodeActions:input_type -> pb.FindAllNodeActionsRequest
|
||||
6, // 6: pb.NodeActionService.findNodeAction:input_type -> pb.FindNodeActionRequest
|
||||
1, // 7: pb.NodeActionService.createNodeAction:output_type -> pb.CreateNodeActionResponse
|
||||
9, // 8: pb.NodeActionService.deleteNodeAction:output_type -> pb.RPCSuccess
|
||||
9, // 9: pb.NodeActionService.updateNodeAction:output_type -> pb.RPCSuccess
|
||||
5, // 10: pb.NodeActionService.findAllNodeActions:output_type -> pb.FindAllNodeActionsResponse
|
||||
7, // 11: pb.NodeActionService.findNodeAction:output_type -> pb.FindNodeActionResponse
|
||||
7, // [7:12] is the sub-list for method output_type
|
||||
2, // [2:7] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_node_action_proto_init() }
|
||||
func file_service_node_action_proto_init() {
|
||||
if File_service_node_action_proto != nil {
|
||||
return
|
||||
}
|
||||
file_models_model_node_action_proto_init()
|
||||
file_models_rpc_messages_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_service_node_action_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateNodeActionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateNodeActionResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteNodeActionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateNodeActionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindAllNodeActionsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindAllNodeActionsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindNodeActionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_action_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindNodeActionResponse); 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_service_node_action_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_service_node_action_proto_goTypes,
|
||||
DependencyIndexes: file_service_node_action_proto_depIdxs,
|
||||
MessageInfos: file_service_node_action_proto_msgTypes,
|
||||
}.Build()
|
||||
File_service_node_action_proto = out.File
|
||||
file_service_node_action_proto_rawDesc = nil
|
||||
file_service_node_action_proto_goTypes = nil
|
||||
file_service_node_action_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// NodeActionServiceClient is the client API for NodeActionService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type NodeActionServiceClient interface {
|
||||
// 添加动作
|
||||
CreateNodeAction(ctx context.Context, in *CreateNodeActionRequest, opts ...grpc.CallOption) (*CreateNodeActionResponse, error)
|
||||
// 删除动作
|
||||
DeleteNodeAction(ctx context.Context, in *DeleteNodeActionRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||
// 修改动作
|
||||
UpdateNodeAction(ctx context.Context, in *UpdateNodeActionRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||
// 列出某个节点的所有动作
|
||||
FindAllNodeActions(ctx context.Context, in *FindAllNodeActionsRequest, opts ...grpc.CallOption) (*FindAllNodeActionsResponse, error)
|
||||
// 查找单个节点动作
|
||||
FindNodeAction(ctx context.Context, in *FindNodeActionRequest, opts ...grpc.CallOption) (*FindNodeActionResponse, error)
|
||||
}
|
||||
|
||||
type nodeActionServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewNodeActionServiceClient(cc grpc.ClientConnInterface) NodeActionServiceClient {
|
||||
return &nodeActionServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *nodeActionServiceClient) CreateNodeAction(ctx context.Context, in *CreateNodeActionRequest, opts ...grpc.CallOption) (*CreateNodeActionResponse, error) {
|
||||
out := new(CreateNodeActionResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeActionService/createNodeAction", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeActionServiceClient) DeleteNodeAction(ctx context.Context, in *DeleteNodeActionRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
|
||||
out := new(RPCSuccess)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeActionService/deleteNodeAction", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeActionServiceClient) UpdateNodeAction(ctx context.Context, in *UpdateNodeActionRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
|
||||
out := new(RPCSuccess)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeActionService/updateNodeAction", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeActionServiceClient) FindAllNodeActions(ctx context.Context, in *FindAllNodeActionsRequest, opts ...grpc.CallOption) (*FindAllNodeActionsResponse, error) {
|
||||
out := new(FindAllNodeActionsResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeActionService/findAllNodeActions", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeActionServiceClient) FindNodeAction(ctx context.Context, in *FindNodeActionRequest, opts ...grpc.CallOption) (*FindNodeActionResponse, error) {
|
||||
out := new(FindNodeActionResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeActionService/findNodeAction", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NodeActionServiceServer is the server API for NodeActionService service.
|
||||
type NodeActionServiceServer interface {
|
||||
// 添加动作
|
||||
CreateNodeAction(context.Context, *CreateNodeActionRequest) (*CreateNodeActionResponse, error)
|
||||
// 删除动作
|
||||
DeleteNodeAction(context.Context, *DeleteNodeActionRequest) (*RPCSuccess, error)
|
||||
// 修改动作
|
||||
UpdateNodeAction(context.Context, *UpdateNodeActionRequest) (*RPCSuccess, error)
|
||||
// 列出某个节点的所有动作
|
||||
FindAllNodeActions(context.Context, *FindAllNodeActionsRequest) (*FindAllNodeActionsResponse, error)
|
||||
// 查找单个节点动作
|
||||
FindNodeAction(context.Context, *FindNodeActionRequest) (*FindNodeActionResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedNodeActionServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedNodeActionServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedNodeActionServiceServer) CreateNodeAction(context.Context, *CreateNodeActionRequest) (*CreateNodeActionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateNodeAction not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeActionServiceServer) DeleteNodeAction(context.Context, *DeleteNodeActionRequest) (*RPCSuccess, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteNodeAction not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeActionServiceServer) UpdateNodeAction(context.Context, *UpdateNodeActionRequest) (*RPCSuccess, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeAction not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeActionServiceServer) FindAllNodeActions(context.Context, *FindAllNodeActionsRequest) (*FindAllNodeActionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindAllNodeActions not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeActionServiceServer) FindNodeAction(context.Context, *FindNodeActionRequest) (*FindNodeActionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindNodeAction not implemented")
|
||||
}
|
||||
|
||||
func RegisterNodeActionServiceServer(s *grpc.Server, srv NodeActionServiceServer) {
|
||||
s.RegisterService(&_NodeActionService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _NodeActionService_CreateNodeAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateNodeActionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeActionServiceServer).CreateNodeAction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeActionService/CreateNodeAction",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeActionServiceServer).CreateNodeAction(ctx, req.(*CreateNodeActionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeActionService_DeleteNodeAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteNodeActionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeActionServiceServer).DeleteNodeAction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeActionService/DeleteNodeAction",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeActionServiceServer).DeleteNodeAction(ctx, req.(*DeleteNodeActionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeActionService_UpdateNodeAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateNodeActionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeActionServiceServer).UpdateNodeAction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeActionService/UpdateNodeAction",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeActionServiceServer).UpdateNodeAction(ctx, req.(*UpdateNodeActionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeActionService_FindAllNodeActions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FindAllNodeActionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeActionServiceServer).FindAllNodeActions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeActionService/FindAllNodeActions",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeActionServiceServer).FindAllNodeActions(ctx, req.(*FindAllNodeActionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeActionService_FindNodeAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FindNodeActionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeActionServiceServer).FindNodeAction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeActionService/FindNodeAction",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeActionServiceServer).FindNodeAction(ctx, req.(*FindNodeActionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _NodeActionService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.NodeActionService",
|
||||
HandlerType: (*NodeActionServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "createNodeAction",
|
||||
Handler: _NodeActionService_CreateNodeAction_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "deleteNodeAction",
|
||||
Handler: _NodeActionService_DeleteNodeAction_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "updateNodeAction",
|
||||
Handler: _NodeActionService_UpdateNodeAction_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "findAllNodeActions",
|
||||
Handler: _NodeActionService_FindAllNodeActions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "findNodeAction",
|
||||
Handler: _NodeActionService_FindNodeAction_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_node_action.proto",
|
||||
}
|
||||
@@ -37,6 +37,9 @@ message Node {
|
||||
repeated string lnAddrs = 21; // Ln访问地址
|
||||
bool enableIPLists = 22;
|
||||
bytes apiNodeAddrsJSON = 24;
|
||||
string offlineDay = 25; // 下线日期
|
||||
bool isBackupForCluster = 26; // 是否为集群备用节点
|
||||
bool isBackupForGroup = 27; // 是否为分组备用节点
|
||||
|
||||
NodeCluster nodeCluster = 32; // 主集群
|
||||
NodeLogin nodeLogin = 33;
|
||||
|
||||
15
pkg/rpc/protos/models/model_node_action.proto
Normal file
15
pkg/rpc/protos/models/model_node_action.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// 节点动作
|
||||
message NodeAction {
|
||||
int64 id = 1;
|
||||
int64 nodeId = 2;
|
||||
string role = 3;
|
||||
bool isOn = 4; // 是否启用
|
||||
bytes condsJSON = 5; // 条件定义
|
||||
bytes actionJSON = 6; // 动作定义
|
||||
bytes durationJSON = 7; // 持续时间
|
||||
}
|
||||
@@ -172,6 +172,15 @@ service NodeService {
|
||||
|
||||
// 查找节点的UAM策略
|
||||
rpc findNodeUAMPolicies(FindNodeUAMPoliciesRequest) returns (FindNodeUAMPoliciesResponse);
|
||||
|
||||
// 查找节点调度信息
|
||||
rpc findNodeScheduleInfo(FindNodeScheduleInfoRequest) returns (FindNodeScheduleInfoResponse);
|
||||
|
||||
// 修改节点调度信息
|
||||
rpc updateNodeScheduleInfo(UpdateNodeScheduleInfoRequest) returns (RPCSuccess);
|
||||
|
||||
// 重置节点动作状态
|
||||
rpc resetNodeActionStatus(ResetNodeActionStatusRequest) returns (RPCSuccess);
|
||||
}
|
||||
|
||||
// 创建节点
|
||||
@@ -471,6 +480,9 @@ message NodeDNSInfo {
|
||||
int64 dnsDomainId = 6;
|
||||
string dnsDomainName = 7;
|
||||
string nodeClusterDNSName = 8;
|
||||
bool isBackupForCluster = 10; // 是否为集群备份节点
|
||||
bool isBackupForGroup = 11; // 是否为分组备份节点
|
||||
bool isOffline = 12; // 是否下线
|
||||
}
|
||||
|
||||
// 查找单个节点的域名解析信息
|
||||
@@ -609,12 +621,13 @@ message FindEnabledNodeConfigInfoRequest {
|
||||
}
|
||||
|
||||
message FindEnabledNodeConfigInfoResponse {
|
||||
bool hasDNSInfo = 1;
|
||||
bool hasCacheInfo = 2;
|
||||
bool hasThresholds = 3;
|
||||
bool hasSSH = 4;
|
||||
bool hasSystemSettings = 5;
|
||||
bool hasDDoSProtection = 6;
|
||||
bool hasDNSInfo = 1; // 是否有DNS设置
|
||||
bool hasCacheInfo = 2; // 是否有缓存设置
|
||||
bool hasThresholds = 3; // 是否有阈值设置
|
||||
bool hasSSH = 4; // 是否有SSH设置
|
||||
bool hasSystemSettings = 5; // 是否有系统设置
|
||||
bool hasDDoSProtection = 6; // 是否有DDoS防护设置
|
||||
bool hasScheduleSettings = 7; // 是否有调度设置
|
||||
}
|
||||
|
||||
// 查找节点区域信息数量
|
||||
@@ -674,4 +687,35 @@ message FindNodeUAMPoliciesResponse {
|
||||
int64 nodeClusterId = 1; // 集群ID
|
||||
bytes uamPolicyJSON = 2; // UAM策略配置
|
||||
}
|
||||
}
|
||||
|
||||
// 查找节点调度信息
|
||||
message FindNodeScheduleInfoRequest {
|
||||
int64 nodeId = 1; // 节点ID
|
||||
}
|
||||
|
||||
message FindNodeScheduleInfoResponse {
|
||||
ScheduleInfo scheduleInfo = 1; // 调度信息
|
||||
|
||||
message ScheduleInfo {
|
||||
string offlineDay = 1; // 下线日期,格式YYYYMMDD
|
||||
bool isBackupForCluster = 2; // 是否为集群备份节点
|
||||
bool isBackupForGroup = 3; // 是否为分组备份节点
|
||||
repeated string backupIPs = 4; // 备用IP
|
||||
bytes actionStatusJSON = 5; // 动作状态
|
||||
}
|
||||
}
|
||||
|
||||
// 修改节点调度信息
|
||||
message UpdateNodeScheduleInfoRequest {
|
||||
int64 nodeId = 1; // 节点ID
|
||||
string offlineDay = 2; // 下线日期,格式YYYYMMDD
|
||||
bool isBackupForCluster = 3; // 是否为集群备份节点
|
||||
bool isBackupForGroup = 4; // 是否为分组备份节点
|
||||
repeated string backupIPs = 5; // 备用IP
|
||||
}
|
||||
|
||||
// 重置节点动作状态
|
||||
message ResetNodeActionStatusRequest {
|
||||
int64 nodeId = 1; // 节点ID
|
||||
}
|
||||
71
pkg/rpc/protos/service_node_action.proto
Normal file
71
pkg/rpc/protos/service_node_action.proto
Normal file
@@ -0,0 +1,71 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_node_action.proto";
|
||||
import "models/rpc_messages.proto";
|
||||
|
||||
// 节点动作服务
|
||||
service NodeActionService {
|
||||
// 添加动作
|
||||
rpc createNodeAction(CreateNodeActionRequest) returns (CreateNodeActionResponse);
|
||||
|
||||
// 删除动作
|
||||
rpc deleteNodeAction(DeleteNodeActionRequest) returns (RPCSuccess);
|
||||
|
||||
// 修改动作
|
||||
rpc updateNodeAction(UpdateNodeActionRequest) returns (RPCSuccess);
|
||||
|
||||
// 列出某个节点的所有动作
|
||||
rpc findAllNodeActions(FindAllNodeActionsRequest) returns (FindAllNodeActionsResponse);
|
||||
|
||||
// 查找单个节点动作
|
||||
rpc findNodeAction(FindNodeActionRequest) returns (FindNodeActionResponse);
|
||||
}
|
||||
|
||||
// 添加动作
|
||||
message CreateNodeActionRequest {
|
||||
int64 nodeId = 1; // 节点ID
|
||||
string role = 2; // 节点角色
|
||||
bytes condsJSON = 3; // 条件设置
|
||||
bytes actionJSON = 4; // 动作设置
|
||||
bytes durationJSON = 5; // 持续时间
|
||||
}
|
||||
|
||||
message CreateNodeActionResponse {
|
||||
int64 nodeActionId = 1;
|
||||
}
|
||||
|
||||
// 删除动作
|
||||
message DeleteNodeActionRequest {
|
||||
int64 nodeActionId = 1;
|
||||
}
|
||||
|
||||
// 修改动作
|
||||
message UpdateNodeActionRequest {
|
||||
int64 nodeActionId = 1; // 动作ID
|
||||
bytes condsJSON = 2;
|
||||
bytes actionJSON = 3;
|
||||
bytes durationJSON = 4; // 持续时间
|
||||
bool isOn = 5; // 是否启用
|
||||
}
|
||||
|
||||
// 列出某个节点的所有动作
|
||||
message FindAllNodeActionsRequest {
|
||||
int64 nodeId = 1; // 节点ID
|
||||
string role = 2; // 节点角色
|
||||
}
|
||||
|
||||
message FindAllNodeActionsResponse {
|
||||
repeated NodeAction nodeActions = 1; // 动作列表
|
||||
}
|
||||
|
||||
// 查找单个节点动作
|
||||
message FindNodeActionRequest {
|
||||
int64 nodeActionId = 1; // 动作ID
|
||||
}
|
||||
|
||||
message FindNodeActionResponse {
|
||||
NodeAction nodeAction = 1;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package shared
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -41,6 +42,45 @@ func (this *TimeDuration) Duration() time.Duration {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *TimeDuration) Seconds() int64 {
|
||||
switch this.Unit {
|
||||
case TimeDurationUnitMS:
|
||||
return this.Count / 1000
|
||||
case TimeDurationUnitSecond:
|
||||
return this.Count
|
||||
case TimeDurationUnitMinute:
|
||||
return this.Count * 60
|
||||
case TimeDurationUnitHour:
|
||||
return this.Count * 3600
|
||||
case TimeDurationUnitDay:
|
||||
return this.Count * 3600 * 24
|
||||
case TimeDurationUnitWeek:
|
||||
return this.Count * 3600 * 24 * 7
|
||||
default:
|
||||
return this.Count
|
||||
}
|
||||
}
|
||||
|
||||
func (this *TimeDuration) Description() string {
|
||||
var countString = types.String(this.Count)
|
||||
switch this.Unit {
|
||||
case TimeDurationUnitMS:
|
||||
return countString + "毫秒"
|
||||
case TimeDurationUnitSecond:
|
||||
return countString + "秒"
|
||||
case TimeDurationUnitMinute:
|
||||
return countString + "分钟"
|
||||
case TimeDurationUnitHour:
|
||||
return countString + "小时"
|
||||
case TimeDurationUnitDay:
|
||||
return countString + "天"
|
||||
case TimeDurationUnitWeek:
|
||||
return countString + "周"
|
||||
default:
|
||||
return countString + "秒"
|
||||
}
|
||||
}
|
||||
|
||||
func (this *TimeDuration) AsJSON() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user