Pch5SwitchCtrl.java 2.23 KB
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.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * pch5切换
 *
 * @author craig.qin 2018-3-6
 */
@Controller
@RequestMapping("/pch5Switch")
public class Pch5SwitchCtrl {

    @Autowired
    HttpRestClient httpRestClient;

    @RequestMapping(value = "/toPch5Switch")
    public ModelAndView toPch5Switch() {
        ModelAndView mdv = new ModelAndView("pch5Switch/pch5switch");
        return mdv;
    }

    /**
     * 解析当前配置,绘图用
     *
     */
    @RequestMapping(value = "/getElbStatus")
    @ResponseBody
    public BaseResponse getElbStatus() {
        return  httpRestClient.defaultGet( "/pch5Switch/getElbStatus", BaseResponse.class, null);
    }

    /**
     * 可用区切换
     *
     */
    @RequestMapping(value = "/switchArea",method = RequestMethod.POST)
    @ResponseBody
    public BaseResponse switchArea(String area) {
        return  httpRestClient.defaultGet( "/pch5Switch/switchArea?area="+area, BaseResponse.class, null);
    }

    /**
     * az2切换
     *
     */
    @RequestMapping(value = "/switchAz2",method = RequestMethod.POST)
    @ResponseBody
    public BaseResponse switchAz2(String onlineOrGray) {
        return  httpRestClient.defaultGet( "/pch5Switch/switchAz2?onlineOrGray="+onlineOrGray, BaseResponse.class, null);
    }

    /**
     * az2-node host文件查询
     *
     */
    @RequestMapping(value = "/getAz2NodeHosts")
    @ResponseBody
    public BaseResponse getAz2NodeHosts() {
        return  httpRestClient.defaultGet( "/pch5Switch/getAz2NodeHosts", BaseResponse.class);
    }

    /**
     * 最近发布记录(success)
     *
     */
    @RequestMapping(value = "/getAzProjectLatestReleaseHistory")
    @ResponseBody
    public BaseResponse getAzProjectLatestReleaseHistory() {
        return  httpRestClient.defaultGet( "/pch5Switch/getAzProjectLatestReleaseHistory", BaseResponse.class);
    }

}