Skip to content

Commit

Permalink
[INLONG-11415][Manager] Support querying cluster node operation recor…
Browse files Browse the repository at this point in the history
…ds (#11418)
  • Loading branch information
fuweng11 authored Oct 28, 2024
1 parent dda0897 commit 6273f5c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public enum OperationTarget {

CLUSTER,

CLUSTER_NODE,

CLUSTER_TAG,

TRANSFORM,

INLONG_ROLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<if test="request.operationTarget != null and request.operationTarget != ''">
and operation_target = #{request.operationTarget, jdbcType=VARCHAR}
</if>
<if test="request.ip != null and request.ip != ''">
and body -&gt; '$[0].ip' = #{request.ip, jdbcType=VARCHAR}
</if>
<if test="request.port != null and request.port != ''">
and body -&gt; '$[0].port' = #{request.port, jdbcType=VARCHAR}
</if>
<if test="request.keyword != null and request.keyword != ''">
and (
inlong_group_id like CONCAT('%', #{request.keyword}, '%')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public class OperationLogRequest extends PageRequest {
@ApiModelProperty("Operation target")
private String operationTarget;

@ApiModelProperty("Ip")
private String ip;

@ApiModelProperty("Port")
private String port;

@ApiModelProperty(value = "keyword")
private String keyword;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class InlongClusterController {

@PostMapping(value = "/cluster/tag/save")
@ApiOperation(value = "Save cluster tag")
@OperationLog(operation = OperationType.CREATE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.CREATE, operationTarget = OperationTarget.CLUSTER_TAG)
@RequiresRoles(value = UserRoleCode.INLONG_ADMIN)
public Response<Integer> saveTag(@Validated(SaveValidation.class) @RequestBody ClusterTagRequest request) {
String currentUser = LoginUserUtils.getLoginUser().getName();
Expand All @@ -103,7 +103,7 @@ public Response<PageResult<ClusterTagResponse>> listTag(@RequestBody ClusterTagP
}

@PostMapping(value = "/cluster/tag/update")
@OperationLog(operation = OperationType.UPDATE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.UPDATE, operationTarget = OperationTarget.CLUSTER_TAG)
@ApiOperation(value = "Update cluster tag")
@RequiresRoles(value = UserRoleCode.INLONG_ADMIN)
public Response<Boolean> updateTag(@Validated(UpdateValidation.class) @RequestBody ClusterTagRequest request) {
Expand All @@ -113,7 +113,7 @@ public Response<Boolean> updateTag(@Validated(UpdateValidation.class) @RequestBo

@DeleteMapping(value = "/cluster/tag/delete/{id}")
@ApiOperation(value = "Delete cluster tag by id")
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER_TAG)
@ApiImplicitParam(name = "id", value = "Cluster tag ID", dataTypeClass = Integer.class, required = true)
@RequiresRoles(value = UserRoleCode.INLONG_ADMIN)
public Response<Boolean> deleteTag(@PathVariable Integer id) {
Expand All @@ -122,7 +122,7 @@ public Response<Boolean> deleteTag(@PathVariable Integer id) {

@PostMapping(value = "/cluster/tenant/tag/save")
@ApiOperation(value = "Save tenant cluster tag")
@OperationLog(operation = OperationType.CREATE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.CREATE, operationTarget = OperationTarget.CLUSTER_TAG)
@RequiresRoles(value = UserRoleCode.INLONG_ADMIN)
public Response<Integer> saveTenantTag(
@Validated(SaveValidation.class) @RequestBody TenantClusterTagRequest request) {
Expand Down Expand Up @@ -152,7 +152,7 @@ public Response<PageResult<ClusterInfo>> listByTenantRole(

@DeleteMapping(value = "/cluster/tenant/tag/delete/{id}")
@ApiOperation(value = "Delete tenant cluster tag by id")
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER_TAG)
@ApiImplicitParam(name = "id", value = "Cluster tag ID", dataTypeClass = Integer.class, required = true)
@RequiresRoles(value = UserRoleCode.INLONG_ADMIN)
public Response<Boolean> deleteTenantTag(@PathVariable Integer id) {
Expand Down Expand Up @@ -237,7 +237,7 @@ public Response<Boolean> deleteByKey(@RequestParam String name, @RequestParam St

@PostMapping(value = "/cluster/node/save")
@ApiOperation(value = "Save cluster node")
@OperationLog(operation = OperationType.CREATE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.CREATE, operationTarget = OperationTarget.CLUSTER_NODE)
public Response<Integer> saveNode(@Validated @RequestBody ClusterNodeRequest request) {
String currentUser = LoginUserUtils.getLoginUser().getName();
request.setCurrentUser(currentUser);
Expand Down Expand Up @@ -273,7 +273,7 @@ public Response<List<ClusterNodeResponse>> listByGroupId(@RequestParam String in
}

@RequestMapping(value = "/cluster/node/update", method = RequestMethod.POST)
@OperationLog(operation = OperationType.UPDATE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.UPDATE, operationTarget = OperationTarget.CLUSTER_NODE)
@ApiOperation(value = "Update cluster node")
public Response<Boolean> updateNode(@Validated(UpdateValidation.class) @RequestBody ClusterNodeRequest request) {
String username = LoginUserUtils.getLoginUser().getName();
Expand All @@ -283,15 +283,15 @@ public Response<Boolean> updateNode(@Validated(UpdateValidation.class) @RequestB

@RequestMapping(value = "/cluster/node/delete/{id}", method = RequestMethod.DELETE)
@ApiOperation(value = "Delete cluster node")
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER_NODE)
@ApiImplicitParam(name = "id", value = "Cluster node ID", dataTypeClass = Integer.class, required = true)
public Response<Boolean> deleteNode(@PathVariable Integer id) {
return Response.success(clusterService.deleteNode(id, LoginUserUtils.getLoginUser().getName()));
}

@RequestMapping(value = "/cluster/node/unload/{id}", method = RequestMethod.DELETE)
@ApiOperation(value = "Delete cluster node")
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER)
@OperationLog(operation = OperationType.DELETE, operationTarget = OperationTarget.CLUSTER_NODE)
@ApiImplicitParam(name = "id", value = "Cluster node ID", dataTypeClass = Integer.class, required = true)
public Response<Boolean> unloadNode(@PathVariable Integer id) {
return Response.success(clusterService.unloadNode(id, LoginUserUtils.getLoginUser().getName()));
Expand Down

0 comments on commit 6273f5c

Please sign in to comment.