luchunliang commented on code in PR #4938:
URL: https://github.com/apache/inlong/pull/4938#discussion_r916468495


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/DataProxyController.java:
##########
@@ -80,4 +82,73 @@ public String getAllConfig(@RequestParam String clusterName, 
@RequestParam(requi
         return clusterService.getAllConfig(clusterName, md5);
     }
 
+    /**
+     * changeClusterTag
+     */
+    @RequestMapping(value = "/changeClusterTag", method = RequestMethod.POST)
+    @ApiOperation(value = "Change cluster tag and topic of a inlong group id.")
+    public Response<String> changeClusterTag(@RequestBody InlongGroupEntity 
groupInfo) {
+        String inlongGroupId = groupInfo.getInlongGroupId();
+        String clusterTag = groupInfo.getInlongClusterTag();
+        String topic = groupInfo.getMqResource();
+        if (StringUtils.isEmpty(inlongGroupId) || 
StringUtils.isEmpty(clusterTag) || StringUtils.isEmpty(topic)) {
+            throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);
+        }
+        // select
+        InlongGroupEntity oldGroup = 
inlongGroupMapper.selectByGroupId(inlongGroupId);
+        if (oldGroup == null) {
+            throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);
+        }
+        // parse ext_params
+        String extParams = oldGroup.getExtParams();
+        if (StringUtils.isEmpty(extParams)) {
+            extParams = "{}";
+        }
+        // parse json
+        Gson gson = new Gson();
+        JsonObject extParamsObj = gson.fromJson(extParams, JsonObject.class);
+        // change cluster tag
+        extParamsObj.addProperty(KEY_SECOND_CLUSTER_TAG, 
oldGroup.getInlongClusterTag());
+        extParamsObj.addProperty(KEY_SECOND_TOPIC, oldGroup.getMqResource());
+        oldGroup.setInlongClusterTag(clusterTag);
+        oldGroup.setMqResource(topic);
+        String newExtParams = extParamsObj.toString();
+        oldGroup.setExtParams(newExtParams);
+        // update
+        inlongGroupMapper.updateByIdentifierSelective(oldGroup);
+        return Response.success(groupInfo.getInlongGroupId());
+    }
+
+    /**
+     * removeSecondClusterTag
+     */
+    @RequestMapping(value = "/removeSecondClusterTag", method = 
RequestMethod.POST)
+    @ApiOperation(value = "remove second cluster tag and topic of a inlong 
group id.")
+    public Response<String> removeSecondClusterTag(@RequestBody 
InlongGroupEntity groupInfo) {
+        String inlongGroupId = groupInfo.getInlongGroupId();

Review Comment:
   The specific operation change to DataProxyConfigRepository.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to