This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new ecd25c3  [INLONG-2969][Manager] Fix interface of open API cluster 
(#2970)
ecd25c3 is described below

commit ecd25c3b098d791e234d31e8fca7b28f66677109
Author: healchow <[email protected]>
AuthorDate: Mon Mar 7 16:52:43 2022 +0800

    [INLONG-2969][Manager] Fix interface of open API cluster (#2970)
---
 .../manager/web/controller/ClusterController.java  |  5 ++-
 ...rController.java => OpenClusterController.java} | 51 +++-------------------
 2 files changed, 8 insertions(+), 48 deletions(-)

diff --git 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterController.java
 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterController.java
index 5ec249a..95eb2ae 100644
--- 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterController.java
+++ 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterController.java
@@ -32,6 +32,7 @@ import 
org.apache.inlong.manager.service.core.DataProxyClusterService;
 import org.apache.inlong.manager.service.core.ThirdPartyClusterService;
 import org.apache.inlong.manager.service.core.operationlog.OperationLog;
 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;
@@ -55,7 +56,7 @@ public class ClusterController {
     @Autowired
     private DataProxyClusterService dataProxyClusterService;
 
-    @RequestMapping(value = "/save", method = RequestMethod.GET)
+    @PostMapping(value = "/save")
     @ApiOperation(value = "Save cluster info")
     @OperationLog(operation = OperationType.CREATE)
     public Response<Integer> save(@RequestBody ClusterInfo clusterInfo) {
@@ -84,7 +85,7 @@ public class ClusterController {
         return Response.success(thirdPartyClusterService.update(clusterInfo, 
username));
     }
 
-    @RequestMapping(value = "/delete/{id}", method = {RequestMethod.POST, 
RequestMethod.DELETE})
+    @DeleteMapping(value = "/delete/{id}")
     @ApiOperation(value = "Delete cluster info by id")
     @OperationLog(operation = OperationType.DELETE)
     @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = 
Integer.class, required = true)
diff --git 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/ClusterController.java
 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
similarity index 58%
rename from 
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/ClusterController.java
rename to 
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
index d95c1f4..5428c6c 100644
--- 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/ClusterController.java
+++ 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
@@ -17,7 +17,6 @@
 
 package org.apache.inlong.manager.web.controller.openapi;
 
-import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
@@ -25,19 +24,17 @@ import org.apache.inlong.manager.common.beans.Response;
 import org.apache.inlong.manager.common.enums.OperationType;
 import org.apache.inlong.manager.common.pojo.cluster.ClusterInfo;
 import org.apache.inlong.manager.common.pojo.cluster.ClusterRequest;
-import org.apache.inlong.manager.common.pojo.cluster.DataProxyClusterInfo;
-import 
org.apache.inlong.manager.common.pojo.cluster.DataProxyClusterPageRequest;
 import org.apache.inlong.manager.common.util.LoginUserUtils;
 import org.apache.inlong.manager.service.core.DataProxyClusterService;
 import org.apache.inlong.manager.service.core.ThirdPartyClusterService;
 import org.apache.inlong.manager.service.core.operationlog.OperationLog;
 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.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -46,16 +43,16 @@ import java.util.List;
  * Cluster controller
  */
 @RestController
-@RequestMapping("/cluster")
+@RequestMapping("/openapi/cluster")
 @Api(tags = "Cluster Config")
-public class ClusterController {
+public class OpenClusterController {
 
     @Autowired
     private ThirdPartyClusterService thirdPartyClusterService;
     @Autowired
     private DataProxyClusterService dataProxyClusterService;
 
-    @RequestMapping(value = "/save", method = RequestMethod.GET)
+    @PostMapping(value = "/save")
     @ApiOperation(value = "Save cluster info")
     @OperationLog(operation = OperationType.CREATE)
     public Response<Integer> save(@RequestBody ClusterInfo clusterInfo) {
@@ -84,7 +81,7 @@ public class ClusterController {
         return Response.success(thirdPartyClusterService.update(clusterInfo, 
username));
     }
 
-    @RequestMapping(value = "/delete/{id}", method = {RequestMethod.POST, 
RequestMethod.DELETE})
+    @DeleteMapping(value = "/delete/{id}")
     @ApiOperation(value = "Delete cluster info by id")
     @OperationLog(operation = OperationType.DELETE)
     @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = 
Integer.class, required = true)
@@ -92,42 +89,4 @@ public class ClusterController {
         return Response.success(thirdPartyClusterService.delete(id, 
LoginUserUtils.getLoginUserDetail().getUserName()));
     }
 
-    @RequestMapping(value = "/dataproxy/save", method = RequestMethod.POST)
-    @OperationLog(operation = OperationType.CREATE)
-    @ApiOperation(value = "Save cluster information of the DataProxy")
-    public Response<Integer> saveDataProxy(@RequestBody DataProxyClusterInfo 
clusterInfo) {
-        String currentUser = LoginUserUtils.getLoginUserDetail().getUserName();
-        return Response.success(dataProxyClusterService.save(clusterInfo, 
currentUser));
-    }
-
-    @RequestMapping(value = "/dataproxy/get/{id}", method = RequestMethod.GET)
-    @ApiOperation(value = "Query cluster information of the DataProxy")
-    @ApiImplicitParam(name = "id", value = "DataProxy cluster ID", 
dataTypeClass = Integer.class, required = true)
-    public Response<DataProxyClusterInfo> getDataProxy(@PathVariable Integer 
id) {
-        return Response.success(dataProxyClusterService.get(id));
-    }
-
-    @RequestMapping(value = "/dataproxy/list", method = RequestMethod.GET)
-    @ApiOperation(value = "Query the list of DataProxy clusters based on 
conditions")
-    public Response<PageInfo<DataProxyClusterInfo>> 
listDataProxyByCondition(DataProxyClusterPageRequest request) {
-        
request.setCurrentUser(LoginUserUtils.getLoginUserDetail().getUserName());
-        return 
Response.success(dataProxyClusterService.listByCondition(request));
-    }
-
-    @RequestMapping(value = "/dataproxy/update", method = RequestMethod.POST)
-    @OperationLog(operation = OperationType.UPDATE)
-    @ApiOperation(value = "Modify cluster information of the DataProxy")
-    public Response<Boolean> updateDataProxy(@RequestBody DataProxyClusterInfo 
clusterInfo) {
-        String username = LoginUserUtils.getLoginUserDetail().getUserName();
-        return Response.success(dataProxyClusterService.update(clusterInfo, 
username));
-    }
-
-    @RequestMapping(value = "/dataproxy/delete/{id}", method = 
RequestMethod.DELETE)
-    @ApiOperation(value = "Delete cluster information of the dataproxy")
-    @OperationLog(operation = OperationType.DELETE)
-    @ApiImplicitParam(name = "id", value = "DataProxy cluster id", 
dataTypeClass = Integer.class, required = true)
-    public Response<Boolean> deleteDataProxy(@PathVariable Integer id) {
-        return Response.success(dataProxyClusterService.delete(id, 
LoginUserUtils.getLoginUserDetail().getUserName()));
-    }
-
 }

Reply via email to