|
|
|
@ -15,39 +15,29 @@
|
|
|
|
|
*/
|
|
|
|
|
package com.alibaba.csp.sentinel.dashboard.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.auth.AuthAction;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.client.CommandNotFoundException;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.auth.AuthService;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType;
|
|
|
|
|
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
|
|
|
|
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.domain.Result;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.repository.rule.RuleRepository;
|
|
|
|
|
import com.alibaba.csp.sentinel.dashboard.util.VersionUtils;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
|
|
|
|
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Eric Zhao
|
|
|
|
@ -119,7 +109,7 @@ public class ParamFlowRuleController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/rule")
|
|
|
|
|
@AuthAction(AuthService.PrivilegeType.WRITE_RULE)
|
|
|
|
|
@AuthAction(PrivilegeType.WRITE_RULE)
|
|
|
|
|
public Result<ParamFlowRuleEntity> apiAddParamFlowRule(@RequestBody ParamFlowRuleEntity entity) {
|
|
|
|
|
Result<ParamFlowRuleEntity> checkResult = checkEntityInternal(entity);
|
|
|
|
|
if (checkResult != null) {
|
|
|
|
@ -188,7 +178,7 @@ public class ParamFlowRuleController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping("/rule/{id}")
|
|
|
|
|
@AuthAction(AuthService.PrivilegeType.WRITE_RULE)
|
|
|
|
|
@AuthAction(PrivilegeType.WRITE_RULE)
|
|
|
|
|
public Result<ParamFlowRuleEntity> apiUpdateParamFlowRule(@PathVariable("id") Long id,
|
|
|
|
|
@RequestBody ParamFlowRuleEntity entity) {
|
|
|
|
|
if (id == null || id <= 0) {
|
|
|
|
|