mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 21:33:25 +08:00 
			
		
		
		
	增加修改节点停用/启用状态API
This commit is contained in:
		@@ -5756,6 +5756,17 @@
 | 
			
		||||
            "node"
 | 
			
		||||
          ],
 | 
			
		||||
          "isDeprecated": false
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "name": "updateNodeIsOn",
 | 
			
		||||
          "requestMessageName": "UpdateNodeIsOnRequest",
 | 
			
		||||
          "responseMessageName": "RPCSuccess",
 | 
			
		||||
          "code": "rpc updateNodeIsOn(UpdateNodeIsOnRequest) returns (RPCSuccess);",
 | 
			
		||||
          "doc": "修改节点的启用状态",
 | 
			
		||||
          "roles": [
 | 
			
		||||
            "admin"
 | 
			
		||||
          ],
 | 
			
		||||
          "isDeprecated": false
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      "filename": "service_node.proto",
 | 
			
		||||
@@ -23118,6 +23129,11 @@
 | 
			
		||||
      "code": "message UpdateNodeIsInstalledRequest {\n\tint64 nodeId = 1;\n\tbool isInstalled = 2;\n}",
 | 
			
		||||
      "doc": "修改节点安装状态"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "UpdateNodeIsOnRequest",
 | 
			
		||||
      "code": "message UpdateNodeIsOnRequest {\n\tint64 nodeId = 1; // 节点ID\n\tbool isOn = 2; // 是否启用\n}",
 | 
			
		||||
      "doc": "修改节点的启用状态"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "UpdateNodeLoginRequest",
 | 
			
		||||
      "code": "message UpdateNodeLoginRequest {\n\tint64 nodeId = 1;\n\tNodeLogin nodeLogin = 2;\n}",
 | 
			
		||||
 
 | 
			
		||||
@@ -269,6 +269,8 @@ const (
 | 
			
		||||
	Node_LogUpNode                                              langs.MessageCode = "node@log_up_node"                                                    // 手动上线节点 %d
 | 
			
		||||
	Node_LogUpdateNode                                          langs.MessageCode = "node@log_update_node"                                                // 修改节点 %d 基本信息
 | 
			
		||||
	Node_LogUpdateNodeInstallationStatus                        langs.MessageCode = "node@log_update_node_installation_status"                            // 修改节点安装状态 %d
 | 
			
		||||
	Node_LogUpdateNodeOff                                       langs.MessageCode = "node@log_update_node_off"                                            // 停用节点 %d
 | 
			
		||||
	Node_LogUpdateNodeOn                                        langs.MessageCode = "node@log_update_node_on"                                             // 启用节点 %d
 | 
			
		||||
	Node_LogUpgradeNodeRemotely                                 langs.MessageCode = "node@log_upgrade_node_remotely"                                      // 远程升级节点 %d
 | 
			
		||||
	Node_UngroupedLabel                                         langs.MessageCode = "node@ungrouped_label"                                                // 未分组
 | 
			
		||||
	NodeAction_LogCopyNodeActionsToCluster                      langs.MessageCode = "node_action@log_copy_node_actions_to_cluster"                        // 复制节点 %d 调度动作到集群
 | 
			
		||||
 
 | 
			
		||||
@@ -270,6 +270,8 @@ func init() {
 | 
			
		||||
		"node@log_up_node":                                                    "",
 | 
			
		||||
		"node@log_update_node":                                                "",
 | 
			
		||||
		"node@log_update_node_installation_status":                            "",
 | 
			
		||||
		"node@log_update_node_off":                                            "",
 | 
			
		||||
		"node@log_update_node_on":                                             "",
 | 
			
		||||
		"node@log_upgrade_node_remotely":                                      "",
 | 
			
		||||
		"node@ungrouped_label":                                                "",
 | 
			
		||||
		"node_action@log_copy_node_actions_to_cluster":                        "",
 | 
			
		||||
 
 | 
			
		||||
@@ -270,6 +270,8 @@ func init() {
 | 
			
		||||
		"node@log_up_node":                                                    "手动上线节点 %d",
 | 
			
		||||
		"node@log_update_node":                                                "修改节点 %d 基本信息",
 | 
			
		||||
		"node@log_update_node_installation_status":                            "修改节点安装状态 %d",
 | 
			
		||||
		"node@log_update_node_off":                                            "停用节点 %d",
 | 
			
		||||
		"node@log_update_node_on":                                             "启用节点 %d",
 | 
			
		||||
		"node@log_upgrade_node_remotely":                                      "远程升级节点 %d",
 | 
			
		||||
		"node@ungrouped_label":                                                "未分组",
 | 
			
		||||
		"node_action@log_copy_node_actions_to_cluster":                        "复制节点 %d 调度动作到集群",
 | 
			
		||||
 
 | 
			
		||||
@@ -11,5 +11,7 @@
 | 
			
		||||
  "log_update_node": "修改节点 %d 基本信息",
 | 
			
		||||
  "log_update_node_installation_status": "修改节点安装状态 %d",
 | 
			
		||||
  "log_up_node": "手动上线节点 %d",
 | 
			
		||||
  "log_update_node_on": "启用节点 %d",
 | 
			
		||||
  "log_update_node_off": "停用节点 %d",
 | 
			
		||||
  "log_delete_node_from_cluster": "从集群 %d 中删除节点 %d"
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -84,6 +84,7 @@ const (
 | 
			
		||||
	NodeService_FindNodeTOAConfig_FullMethodName                          = "/pb.NodeService/findNodeTOAConfig"
 | 
			
		||||
	NodeService_FindNodeNetworkSecurityPolicy_FullMethodName              = "/pb.NodeService/findNodeNetworkSecurityPolicy"
 | 
			
		||||
	NodeService_FindNodeWebPPolicies_FullMethodName                       = "/pb.NodeService/findNodeWebPPolicies"
 | 
			
		||||
	NodeService_UpdateNodeIsOn_FullMethodName                             = "/pb.NodeService/updateNodeIsOn"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// NodeServiceClient is the client API for NodeService service.
 | 
			
		||||
@@ -220,6 +221,8 @@ type NodeServiceClient interface {
 | 
			
		||||
	FindNodeNetworkSecurityPolicy(ctx context.Context, in *FindNodeNetworkSecurityPolicyRequest, opts ...grpc.CallOption) (*FindNodeNetworkSecurityPolicyResponse, error)
 | 
			
		||||
	// 查找节点的WebP策略
 | 
			
		||||
	FindNodeWebPPolicies(ctx context.Context, in *FindNodeWebPPoliciesRequest, opts ...grpc.CallOption) (*FindNodeWebPPoliciesResponse, error)
 | 
			
		||||
	// 修改节点的启用状态
 | 
			
		||||
	UpdateNodeIsOn(ctx context.Context, in *UpdateNodeIsOnRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type nodeServiceClient struct {
 | 
			
		||||
@@ -837,6 +840,15 @@ func (c *nodeServiceClient) FindNodeWebPPolicies(ctx context.Context, in *FindNo
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *nodeServiceClient) UpdateNodeIsOn(ctx context.Context, in *UpdateNodeIsOnRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
 | 
			
		||||
	out := new(RPCSuccess)
 | 
			
		||||
	err := c.cc.Invoke(ctx, NodeService_UpdateNodeIsOn_FullMethodName, in, out, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NodeServiceServer is the server API for NodeService service.
 | 
			
		||||
// All implementations should embed UnimplementedNodeServiceServer
 | 
			
		||||
// for forward compatibility
 | 
			
		||||
@@ -971,6 +983,8 @@ type NodeServiceServer interface {
 | 
			
		||||
	FindNodeNetworkSecurityPolicy(context.Context, *FindNodeNetworkSecurityPolicyRequest) (*FindNodeNetworkSecurityPolicyResponse, error)
 | 
			
		||||
	// 查找节点的WebP策略
 | 
			
		||||
	FindNodeWebPPolicies(context.Context, *FindNodeWebPPoliciesRequest) (*FindNodeWebPPoliciesResponse, error)
 | 
			
		||||
	// 修改节点的启用状态
 | 
			
		||||
	UpdateNodeIsOn(context.Context, *UpdateNodeIsOnRequest) (*RPCSuccess, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedNodeServiceServer should be embedded to have forward compatible implementations.
 | 
			
		||||
@@ -1172,6 +1186,9 @@ func (UnimplementedNodeServiceServer) FindNodeNetworkSecurityPolicy(context.Cont
 | 
			
		||||
func (UnimplementedNodeServiceServer) FindNodeWebPPolicies(context.Context, *FindNodeWebPPoliciesRequest) (*FindNodeWebPPoliciesResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method FindNodeWebPPolicies not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (UnimplementedNodeServiceServer) UpdateNodeIsOn(context.Context, *UpdateNodeIsOnRequest) (*RPCSuccess, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeIsOn not implemented")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnsafeNodeServiceServer may be embedded to opt out of forward compatibility for this service.
 | 
			
		||||
// Use of this interface is not recommended, as added methods to NodeServiceServer will
 | 
			
		||||
@@ -2362,6 +2379,24 @@ func _NodeService_FindNodeWebPPolicies_Handler(srv interface{}, ctx context.Cont
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _NodeService_UpdateNodeIsOn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(UpdateNodeIsOnRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(NodeServiceServer).UpdateNodeIsOn(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: NodeService_UpdateNodeIsOn_FullMethodName,
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(NodeServiceServer).UpdateNodeIsOn(ctx, req.(*UpdateNodeIsOnRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NodeService_ServiceDesc is the grpc.ServiceDesc for NodeService service.
 | 
			
		||||
// It's only intended for direct use with grpc.RegisterService,
 | 
			
		||||
// and not to be introspected or modified (even as a copy)
 | 
			
		||||
@@ -2625,6 +2660,10 @@ var NodeService_ServiceDesc = grpc.ServiceDesc{
 | 
			
		||||
			MethodName: "findNodeWebPPolicies",
 | 
			
		||||
			Handler:    _NodeService_FindNodeWebPPolicies_Handler,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "updateNodeIsOn",
 | 
			
		||||
			Handler:    _NodeService_UpdateNodeIsOn_Handler,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	Streams: []grpc.StreamDesc{
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -208,6 +208,9 @@ service NodeService {
 | 
			
		||||
 | 
			
		||||
	// 查找节点的WebP策略
 | 
			
		||||
	rpc findNodeWebPPolicies(FindNodeWebPPoliciesRequest) returns (FindNodeWebPPoliciesResponse);
 | 
			
		||||
 | 
			
		||||
	// 修改节点的启用状态
 | 
			
		||||
	rpc updateNodeIsOn(UpdateNodeIsOnRequest) returns (RPCSuccess);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 创建节点
 | 
			
		||||
@@ -845,3 +848,9 @@ message FindNodeWebPPoliciesResponse {
 | 
			
		||||
		bytes webPPolicyJSON = 2; // WebP策略配置
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 修改节点的启用状态
 | 
			
		||||
message UpdateNodeIsOnRequest {
 | 
			
		||||
	int64 nodeId = 1; // 节点ID
 | 
			
		||||
	bool isOn = 2; // 是否启用
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user