Parcourir la source

删除无用代码

reghao il y a 6 mois
Parent
commit
565b5aae50

+ 0 - 32
mgr/src/main/java/cn/reghao/devops/mgr/machine/controller/ClusterController.java

@@ -1,32 +0,0 @@
-package cn.reghao.devops.mgr.machine.controller;
-
-import cn.reghao.devops.mgr.machine.model.dto.KeepalivedState;
-import cn.reghao.devops.mgr.machine.service.KeepalivedService;
-import cn.reghao.jutil.jdk.result.WebResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author reghao
- * @date 2024-01-04 15:34:39
- */
-@Api(tags = "机器接口")
-@RestController
-@RequestMapping("/api/cluster")
-public class ClusterController {
-    private final KeepalivedService keepalivedService;
-
-    public ClusterController(KeepalivedService keepalivedService) {
-        this.keepalivedService = keepalivedService;
-    }
-
-    @ApiOperation(value = "keepalived 通知", notes = "N")
-    @PostMapping(value = "/notify/keepalived", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String notify(@Validated KeepalivedState keepalivedState) {
-        keepalivedService.stateNotify(keepalivedState);
-        return WebResult.success();
-    }
-}

+ 0 - 41
mgr/src/main/java/cn/reghao/devops/mgr/machine/service/KeepalivedService.java

@@ -1,41 +0,0 @@
-package cn.reghao.devops.mgr.machine.service;
-
-import cn.reghao.devops.mgr.admin.service.NotifyService;
-import cn.reghao.devops.mgr.admin.service.notifier.ding.DingMsg;
-import cn.reghao.devops.mgr.machine.model.dto.KeepalivedState;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-/**
- * @author reghao
- * @date 2024-01-05 09:09:46
- */
-@Slf4j
-@Service
-public class KeepalivedService {
-    private final NotifyService notifyService;
-
-    public KeepalivedService(NotifyService notifyService) {
-        this.notifyService = notifyService;
-    }
-
-    public void stateNotify(KeepalivedState keepalivedState) {
-        String host = keepalivedState.getHost();
-        String state = keepalivedState.getState();
-        String realServer = keepalivedState.getRealServer();
-
-        String title;
-        String text;
-        if (realServer == null) {
-            title = "keepalived 事件通知";
-            text = String.format("keepalived 节点 %s 切换为 %s", host, state);
-        } else {
-            title = "keepalived-realserver 事件通知";
-            text = String.format("keepalived 节点 %s 检测到 RealServer %s 状态为 %s", host, realServer, state);
-        }
-
-        log.info(text);
-        DingMsg dingMsg = new DingMsg(title, text);
-        notifyService.notify(dingMsg);
-    }
-}