Search in sources :

Example 1 with ConfigModel

use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.

the class ChangeConfig method stopAlertSystem.

@RequestMapping(value = "/config/alert_system/stop", method = RequestMethod.POST)
public void stopAlertSystem(HttpServletRequest request, @RequestBody(required = false) ConfigModel configModel) throws DalException {
    ConfigModel config = configModel(request, configModel);
    configService.stopAlertSystem(config, consoleConfig.getConfigDefaultRestoreHours());
}
Also used : ConfigModel(com.ctrip.xpipe.redis.console.model.ConfigModel)

Example 2 with ConfigModel

use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.

the class ChangeConfig method stopSentinelAutoProcess.

@RequestMapping(value = "/config/sentinel_auto_process/stop", method = RequestMethod.POST)
public void stopSentinelAutoProcess(HttpServletRequest request, @RequestBody(required = false) ConfigModel configModel) throws DalException {
    ConfigModel config = configModel(request, configModel);
    configService.stopSentinelAutoProcess(config, consoleConfig.getConfigDefaultRestoreHours());
}
Also used : ConfigModel(com.ctrip.xpipe.redis.console.model.ConfigModel)

Example 3 with ConfigModel

use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.

the class ChangeConfig method configModel.

private ConfigModel configModel(HttpServletRequest request, ConfigModel configModel) {
    String sourceIp = request.getHeader("X-FORWARDED-FOR");
    if (sourceIp == null) {
        sourceIp = request.getRemoteAddr();
    }
    ConfigModel config = new ConfigModel().setUpdateIP(sourceIp).setUpdateUser(request.getRemoteUser());
    if (configModel != null && configModel.getUpdateUser() != null)
        config.setUpdateUser(configModel.getUpdateUser());
    return config;
}
Also used : ConfigModel(com.ctrip.xpipe.redis.console.model.ConfigModel)

Example 4 with ConfigModel

use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.

the class ChangeConfig method stopAlertSystem.

@RequestMapping(value = "/config/alert_system/stop/{hours}", method = RequestMethod.POST)
public void stopAlertSystem(HttpServletRequest request, @PathVariable int hours, @RequestBody(required = false) ConfigModel configModel) throws DalException {
    ConfigModel config = configModel(request, configModel);
    int defaultHours = consoleConfig.getConfigDefaultRestoreHours();
    hours = hours > defaultHours || hours < 1 ? defaultHours : hours;
    configService.stopAlertSystem(config, hours);
}
Also used : ConfigModel(com.ctrip.xpipe.redis.console.model.ConfigModel)

Example 5 with ConfigModel

use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.

the class ChangeConfig method startSentinelAutoProcess.

@RequestMapping(value = "/config/sentinel_auto_process/start", method = RequestMethod.POST)
public void startSentinelAutoProcess(HttpServletRequest request, @RequestBody(required = false) ConfigModel configModel) throws DalException {
    ConfigModel config = configModel(request, configModel);
    configService.startSentinelAutoProcess(config);
}
Also used : ConfigModel(com.ctrip.xpipe.redis.console.model.ConfigModel)

Aggregations

ConfigModel (com.ctrip.xpipe.redis.console.model.ConfigModel)17 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)5 Test (org.junit.Test)5 ConfigTbl (com.ctrip.xpipe.redis.console.model.ConfigTbl)4 Date (java.util.Date)3 RetMessage (com.ctrip.xpipe.redis.console.controller.api.RetMessage)2 DalException (org.unidal.dal.jdbc.DalException)2 UserInfo (com.ctrip.xpipe.api.sso.UserInfo)1