Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.streampark.console.core.service.FlinkClusterService;
import org.apache.streampark.console.core.util.ServiceHelper;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import com.baomidou.mybatisplus.core.metadata.IPage;
Expand All @@ -48,30 +49,35 @@ public class FlinkClusterController {
private FlinkClusterService flinkClusterService;

@PostMapping("page")
@RequiresPermissions(value = {"cluster:create", "cluster:update"}, logical = Logical.OR)
public RestResponse findPage(FlinkCluster flinkCluster, RestRequest restRequest) {
IPage<FlinkCluster> flinkClusters = flinkClusterService.findPage(flinkCluster, restRequest);
return RestResponse.success(flinkClusters);
}

@PostMapping("alive")
@RequiresPermissions(value = {"cluster:create", "cluster:update", "app:add", "app:update"}, logical = Logical.OR)
public RestResponse listAvailableCluster() {
List<FlinkCluster> flinkClusters = flinkClusterService.listAvailableCluster();
return RestResponse.success(flinkClusters);
}

@PostMapping("list")
@RequiresPermissions(value = {"cluster:create", "cluster:update", "app:add", "app:update"}, logical = Logical.OR)
public RestResponse list() {
List<FlinkCluster> flinkClusters = flinkClusterService.list();
return RestResponse.success(flinkClusters);
}

@PostMapping("remote_url")
@RequiresPermissions(value = {"cluster:create", "cluster:update"}, logical = Logical.OR)
public RestResponse remoteUrl(Long id) {
FlinkCluster cluster = flinkClusterService.getById(id);
return RestResponse.success(cluster.getAddress());
}

@PostMapping("check")
@RequiresPermissions(value = {"cluster:create", "cluster:update"}, logical = Logical.OR)
public RestResponse check(FlinkCluster cluster) {
ResponseResult checkResult = flinkClusterService.check(cluster);
return RestResponse.success(checkResult);
Expand All @@ -93,19 +99,22 @@ public RestResponse update(FlinkCluster cluster) {
}

@PostMapping("get")
@RequiresPermissions(value = {"cluster:create", "cluster:update"}, logical = Logical.OR)
public RestResponse get(Long id) throws InternalException {
FlinkCluster cluster = flinkClusterService.getById(id);
return RestResponse.success(cluster);
}

@PostMapping("start")
@RequiresPermissions("cluster:update")
public RestResponse start(FlinkCluster cluster) {
flinkClusterService.updateClusterState(cluster.getId(), ClusterState.STARTING);
flinkClusterService.start(cluster);
return RestResponse.success();
}

@PostMapping("shutdown")
@RequiresPermissions("cluster:update")
public RestResponse shutdown(FlinkCluster cluster) {
if (flinkClusterService.allowShutdownCluster(cluster)) {
flinkClusterService.updateClusterState(cluster.getId(), ClusterState.CANCELLING);
Expand All @@ -115,6 +124,7 @@ public RestResponse shutdown(FlinkCluster cluster) {
}

@PostMapping("delete")
@RequiresPermissions("cluster:update")
public RestResponse delete(FlinkCluster cluster) {
flinkClusterService.remove(cluster.getId());
return RestResponse.success();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.streampark.console.core.entity.Variable;
import org.apache.streampark.console.core.service.VariableService;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import com.baomidou.mybatisplus.core.metadata.IPage;
Expand Down Expand Up @@ -75,6 +76,7 @@ public RestResponse page(RestRequest restRequest, Variable variable) {
* @return
*/
@PostMapping("list")
@RequiresPermissions("variable:view")
public RestResponse variableList(@RequestParam Long teamId, String keyword) {
List<Variable> variableList = variableService.listByTeamId(teamId, keyword);
for (Variable v : variableList) {
Expand Down Expand Up @@ -119,6 +121,7 @@ public RestResponse deleteVariable(@Valid Variable variable) {
}

@PostMapping("check/code")
@RequiresPermissions(value = {"variable:view", "variable:add", "variable:update"}, logical = Logical.OR)
public RestResponse checkVariableCode(
@RequestParam Long teamId,
@NotBlank(message = "{required}") String variableCode) {
Expand Down
Loading