Search in sources :

Example 1 with EnvViewType

use of com.orion.ops.consts.env.EnvViewType in project orion-ops by lijiahangmax.

the class ApplicationEnvController method view.

/**
 * 视图
 */
@RequestMapping("/view")
public String view(@RequestBody ApplicationEnvRequest request) {
    Valid.notNull(request.getAppId());
    Valid.notNull(request.getProfileId());
    EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
    request.setLimit(Const.N_100000);
    // 查询列表
    Map<String, String> env = Maps.newLinkedMap();
    applicationEnvService.listAppEnv(request).forEach(e -> env.put(e.getKey(), e.getValue()));
    return viewType.toValue(env);
}
Also used : EnvViewType(com.orion.ops.consts.env.EnvViewType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with EnvViewType

use of com.orion.ops.consts.env.EnvViewType in project orion-ops by lijiahangmax.

the class SystemEnvController method viewSave.

/**
 * 视图保存
 */
@RequestMapping("/view-save")
@EventLog(EventType.SAVE_SYSTEM_ENV)
public Integer viewSave(@RequestBody SystemEnvRequest request) {
    String value = Valid.notBlank(request.getValue());
    EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
    try {
        MutableLinkedHashMap<String, String> result = viewType.toMap(value);
        systemEnvService.saveEnv(result);
        return result.size();
    } catch (Exception e) {
        throw Exceptions.argument(MessageConst.PARSE_ERROR, e);
    }
}
Also used : EnvViewType(com.orion.ops.consts.env.EnvViewType) EventLog(com.orion.ops.annotation.EventLog) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with EnvViewType

use of com.orion.ops.consts.env.EnvViewType in project orion-ops by lijiahangmax.

the class MachineEnvController method view.

/**
 * 视图
 */
@RequestMapping("/view")
public String view(@RequestBody MachineEnvRequest request) {
    Valid.notNull(request.getMachineId());
    EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
    request.setLimit(Const.N_100000);
    // 查询列表
    Map<String, String> env = Maps.newLinkedMap();
    machineEnvService.listEnv(request).forEach(e -> env.put(e.getKey(), e.getValue()));
    return viewType.toValue(env);
}
Also used : EnvViewType(com.orion.ops.consts.env.EnvViewType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with EnvViewType

use of com.orion.ops.consts.env.EnvViewType in project orion-ops by lijiahangmax.

the class MachineEnvController method viewSave.

/**
 * 视图保存
 */
@RequestMapping("/view-save")
public Integer viewSave(@RequestBody MachineEnvRequest request) {
    Long machineId = Valid.notNull(request.getMachineId());
    String value = Valid.notBlank(request.getValue());
    EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
    try {
        MutableLinkedHashMap<String, String> result = viewType.toMap(value);
        machineEnvService.saveEnv(machineId, result);
        return result.size();
    } catch (Exception e) {
        throw Exceptions.argument(MessageConst.PARSE_ERROR, e);
    }
}
Also used : EnvViewType(com.orion.ops.consts.env.EnvViewType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with EnvViewType

use of com.orion.ops.consts.env.EnvViewType in project orion-ops by lijiahangmax.

the class SystemEnvController method view.

/**
 * 视图
 */
@RequestMapping("/view")
public String view(@RequestBody SystemEnvRequest request) {
    EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
    request.setLimit(Const.N_100000);
    // 查询列表
    Map<String, String> env = Maps.newLinkedMap();
    systemEnvService.listEnv(request).forEach(e -> env.put(e.getKey(), e.getValue()));
    return viewType.toValue(env);
}
Also used : EnvViewType(com.orion.ops.consts.env.EnvViewType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EnvViewType (com.orion.ops.consts.env.EnvViewType)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 EventLog (com.orion.ops.annotation.EventLog)1