|
|
@@ -1,10 +1,13 @@
|
|
|
package cn.reghao.devops.manager.machine.controller;
|
|
|
|
|
|
+import cn.reghao.devops.manager.machine.model.dto.KeepalivedState;
|
|
|
+import cn.reghao.devops.manager.machine.service.ClusterService;
|
|
|
import cn.reghao.jutil.jdk.result.WebResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.MediaType;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
/**
|
|
|
@@ -16,10 +19,16 @@ import org.springframework.web.bind.annotation.*;
|
|
|
@RestController
|
|
|
@RequestMapping("/api/cluster")
|
|
|
public class ClusterController {
|
|
|
+ private final ClusterService clusterService;
|
|
|
+
|
|
|
+ public ClusterController(ClusterService clusterService) {
|
|
|
+ this.clusterService = clusterService;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "设置机器环境")
|
|
|
@PostMapping(value = "/notify/keepalived", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public String notify(@RequestParam("lvs") String lvs, @RequestParam("type") String type) {
|
|
|
- log.info("{} -> {}", lvs, type);
|
|
|
+ public String notify(@Validated KeepalivedState keepalivedState) {
|
|
|
+ clusterService.stateNotify(keepalivedState);
|
|
|
return WebResult.success();
|
|
|
}
|
|
|
}
|