private List preCheckMiddlewareConfig()

in ozhera-log/log-manager/src/main/java/org/apache/ozhera/log/manager/service/impl/MilogMiddlewareConfigServiceImpl.java [825:863]


    private List<String> preCheckMiddlewareConfig(MiddlewareAddParam param) {
        List<String> msg = Lists.newArrayList();
        if (null == param) {
            msg.add("addParam can not be null");
            return msg;
        }
        List<?> types = param.getTypes();
        if (CollectionUtils.isEmpty(types) || types.size() != 2) {
            msg.add("types can not be null");
            return msg;
        }
        param.setType(((Double) types.get(0)).intValue());
        param.setRegionEn((String) types.get(1));
        if (null == param.getType()) {
            msg.add("region can not be null");
        }
        if (StringUtils.isEmpty(param.getNameServer())) {
            msg.add("nameServer can not be null");
        }
        if (StringUtils.isEmpty(param.getServiceUrl()) && accurateTypes.contains(param.getType())) {
            msg.add("serviceUrl can not be null");
        }
        if (StringUtils.isEmpty(param.getAk()) && accurateTypes.contains(param.getType())) {
            msg.add("ak can not be null");
        }
        if (StringUtils.isEmpty(param.getSk()) && accurateTypes.contains(param.getType())) {
            msg.add("sk can not be null");
        }
        if (MiddlewareEnum.ROCKETMQ.getCode().equals(param.getType()) && StringUtils.isEmpty(param.getAuthorization())) {
            msg.add("authorization can not be null");
        }
        if (StringUtils.isEmpty(param.getOrgId()) && accurateTypes.contains(param.getType())) {
            msg.add("orgId can not be null");
        }
        if (MiddlewareEnum.ROCKETMQ.getCode().equals(param.getType()) && StringUtils.isEmpty(param.getTeamId())) {
            msg.add("teamId can not be null");
        }
        return msg;
    }