GrayNginxSwitchCtrl.java
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.ui.ctrl;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashMap;
import java.util.Map;
/**
* 灰度的nginx切换
*
* @author craig.qin 2018-1-10
*/
@Controller
@RequestMapping("/grayNginxSwitch")
public class GrayNginxSwitchCtrl {
@Autowired
HttpRestClient httpRestClient;
@RequestMapping(value = "/toGrayNginxSwitch")
public ModelAndView toGrayNginxSwitch() {
ModelAndView mdv = new ModelAndView("switch/switch_nginx_gray");
return mdv;
}
/**
* 展示配置文件信息
*
*/
@RequestMapping(value = "/viewGrayNginxCurrentConf")
@ResponseBody
public BaseResponse viewGrayNginxCurrentConf() {
return httpRestClient.defaultGet( "/grayNginxSwitch/viewGrayNginxCurrentConf", BaseResponse.class, null);
}
/**
* 解析当前配置,绘图用
*
*/
@RequestMapping(value = "/getGrayNginxStatus")
@ResponseBody
public BaseResponse getGrayNginxStatus() {
return httpRestClient.defaultGet( "/grayNginxSwitch/getGrayNginxStatus", BaseResponse.class, null);
}
/**
* 切换结果预览
*
*/
@RequestMapping(value = "/viewGrayNginxToChangeConf")
@ResponseBody
public BaseResponse viewGrayNginxToChangeConf(String onlineOrGray) {
Map<String, String> map=new HashMap<>();
map.put("onlineOrGray",onlineOrGray);
return httpRestClient.defaultGet( "/grayNginxSwitch/viewGrayNginxToChangeConf", BaseResponse.class, map);
}
/**
* 确定切换
*
*/
@RequestMapping(value = "/switchGrayNginx")
@ResponseBody
public BaseResponse switchGrayNginx(String confContent) {
return httpRestClient.defaultPost("/grayNginxSwitch/switchGrayNginx",confContent,BaseResponse.class);
}
}