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

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


The following commit(s) were added to refs/heads/master by this push:
     new e0a564b0b2 [INLONG-10277][Manager] Support calling API to refresh 
cluster config (#10278)
e0a564b0b2 is described below

commit e0a564b0b2847f8442f8e6beeb2b1f7d6a29596a
Author: fuweng11 <[email protected]>
AuthorDate: Tue May 28 19:25:13 2024 +0800

    [INLONG-10277][Manager] Support calling API to refresh cluster config 
(#10278)
---
 .../client/api/inner/ClientFactoryTest.java        |  2 +-
 .../inlong/manager/common/consts/SinkType.java     |  4 +-
 .../pojo/sink/es/ElasticsearchFieldInfo.java       |  2 +-
 .../manager/pojo/sink/es/ElasticsearchSink.java    |  4 +-
 .../pojo/sink/es/ElasticsearchSinkRequest.java     |  2 +-
 .../sort/node/provider/ElasticsearchProvider.java  |  2 +-
 .../service/cluster/ClusterConfigService.java}     | 25 +------
 .../service/cluster/ClusterConfigServiceImpl.java  | 87 ++++++++++++++++++++++
 .../listener/queue/ClusterConfigListener.java      | 64 +---------------
 .../sink/es/ElasticsearchResourceOperator.java     |  2 +-
 .../service/sink/es/ElasticsearchSinkOperator.java |  4 +-
 .../service/sink/ElasticsearchSinkServiceTest.java |  2 +-
 .../web/controller/ClusterConfigController.java    | 53 +++++++++++++
 13 files changed, 159 insertions(+), 94 deletions(-)

diff --git 
a/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/inner/ClientFactoryTest.java
 
b/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/inner/ClientFactoryTest.java
index be4aa14413..d2ea01e325 100644
--- 
a/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/inner/ClientFactoryTest.java
+++ 
b/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/inner/ClientFactoryTest.java
@@ -625,7 +625,7 @@ class ClientFactoryTest {
                         .build(),
                 ElasticsearchSink.builder()
                         .id(2)
-                        .sinkType(SinkType.ELASTICSEARCH)
+                        .sinkType(SinkType.ES)
                         .hosts("http://127.0.0.1:9200";)
                         .flushInterval(2)
                         .build(),
diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
index 7c4ac6f997..554651ac8c 100644
--- 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
@@ -42,7 +42,7 @@ public class SinkType extends StreamType {
     public static final String HBASE = "HBASE";
 
     @SupportSortType(sortType = SortType.SORT_STANDALONE)
-    public static final String ELASTICSEARCH = "ES";
+    public static final String ES = "ES";
 
     @SupportSortType(sortType = SortType.SORT_FLINK)
     public static final String HDFS = "HDFS";
@@ -86,7 +86,7 @@ public class SinkType extends StreamType {
 
     static {
         SINK_TO_CLUSTER.put(CLS, ClusterType.SORT_CLS);
-        SINK_TO_CLUSTER.put(ELASTICSEARCH, ClusterType.SORT_ES);
+        SINK_TO_CLUSTER.put(ES, ClusterType.SORT_ES);
         SINK_TO_CLUSTER.put(PULSAR, ClusterType.SORT_PULSAR);
         SINK_TO_CLUSTER.put(KAFKA, ClusterType.SORT_KAFKA);
     }
diff --git 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchFieldInfo.java
 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchFieldInfo.java
index 9bab934487..863c0d337f 100644
--- 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchFieldInfo.java
+++ 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchFieldInfo.java
@@ -36,7 +36,7 @@ import javax.validation.constraints.NotNull;
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-@JsonTypeDefine(value = SinkType.ELASTICSEARCH)
+@JsonTypeDefine(value = SinkType.ES)
 public class ElasticsearchFieldInfo extends SinkField {
 
     @ApiModelProperty("Elasticsearch Analyzer")
diff --git 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSink.java
 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSink.java
index a99c148790..531ebac099 100644
--- 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSink.java
+++ 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSink.java
@@ -38,7 +38,7 @@ import lombok.experimental.SuperBuilder;
 @EqualsAndHashCode(callSuper = true)
 @ApiModel(value = "Elasticsearch sink info")
 @SuperBuilder
-@JsonTypeDefine(value = SinkType.ELASTICSEARCH)
+@JsonTypeDefine(value = SinkType.ES)
 public class ElasticsearchSink extends StreamSink {
 
     @ApiModelProperty("Host of the Elasticsearch server")
@@ -97,7 +97,7 @@ public class ElasticsearchSink extends StreamSink {
     private String separator;
 
     public ElasticsearchSink() {
-        this.setSinkType(SinkType.ELASTICSEARCH);
+        this.setSinkType(SinkType.ES);
     }
 
     @Override
diff --git 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
index 0f8d756c5a..d6043c4af0 100644
--- 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
+++ 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
@@ -34,7 +34,7 @@ import lombok.ToString;
 @ToString(callSuper = true)
 @EqualsAndHashCode(callSuper = true)
 @ApiModel(value = "Elasticsearch sink request")
-@JsonTypeDefine(value = SinkType.ELASTICSEARCH)
+@JsonTypeDefine(value = SinkType.ES)
 public class ElasticsearchSinkRequest extends SinkRequest {
 
     @ApiModelProperty("indexNamePattern")
diff --git 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sort/node/provider/ElasticsearchProvider.java
 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sort/node/provider/ElasticsearchProvider.java
index 80861cbc59..30360cf21d 100644
--- 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sort/node/provider/ElasticsearchProvider.java
+++ 
b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sort/node/provider/ElasticsearchProvider.java
@@ -39,7 +39,7 @@ public class ElasticsearchProvider implements 
LoadNodeProvider {
 
     @Override
     public Boolean accept(String sinkType) {
-        return SinkType.ELASTICSEARCH.equals(sinkType);
+        return SinkType.ES.equals(sinkType);
     }
 
     @Override
diff --git 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/ClusterConfigService.java
similarity index 52%
copy from 
inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
copy to 
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/ClusterConfigService.java
index 0f8d756c5a..acdbbd5e8a 100644
--- 
a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/es/ElasticsearchSinkRequest.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/ClusterConfigService.java
@@ -15,29 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.inlong.manager.pojo.sink.es;
-
-import org.apache.inlong.manager.common.consts.SinkType;
-import org.apache.inlong.manager.common.util.JsonTypeDefine;
-import org.apache.inlong.manager.pojo.sink.SinkRequest;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
+package org.apache.inlong.manager.service.cluster;
 
 /**
- * Elasticsearch sink request.
+ * Cluster config service layer interface
  */
-@Data
-@ToString(callSuper = true)
-@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "Elasticsearch sink request")
-@JsonTypeDefine(value = SinkType.ELASTICSEARCH)
-public class ElasticsearchSinkRequest extends SinkRequest {
-
-    @ApiModelProperty("indexNamePattern")
-    private String indexNamePattern;
+public interface ClusterConfigService {
 
+    boolean refresh(String clusterTag, String operator);
 }
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/ClusterConfigServiceImpl.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/ClusterConfigServiceImpl.java
new file mode 100644
index 0000000000..ae72ce50cd
--- /dev/null
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/ClusterConfigServiceImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.cluster;
+
+import org.apache.inlong.common.pojo.sort.mq.PulsarClusterConfig;
+import org.apache.inlong.manager.common.enums.ClusterType;
+import org.apache.inlong.manager.common.exceptions.WorkflowListenerException;
+import org.apache.inlong.manager.common.util.CommonBeanUtils;
+import org.apache.inlong.manager.dao.entity.ClusterConfigEntity;
+import org.apache.inlong.manager.dao.mapper.ClusterConfigEntityMapper;
+import org.apache.inlong.manager.pojo.cluster.ClusterInfo;
+import org.apache.inlong.manager.pojo.cluster.pulsar.PulsarClusterInfo;
+
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Cluster config service layer implementation
+ */
+@Service
+public class ClusterConfigServiceImpl implements ClusterConfigService {
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(ClusterConfigServiceImpl.class);
+
+    @Autowired
+    private ClusterConfigEntityMapper clusterConfigEntityMapper;
+    @Autowired
+    private InlongClusterService clusterService;
+
+    @Override
+    public boolean refresh(String clusterTag, String operator) {
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            List<ClusterInfo> clusterInfos = 
clusterService.listByTagAndType(clusterTag, ClusterType.PULSAR);
+            List<PulsarClusterConfig> list = new ArrayList<>();
+            ClusterConfigEntity existEntity = 
clusterConfigEntityMapper.selectByClusterTag(clusterTag);
+            for (ClusterInfo clusterInfo : clusterInfos) {
+                PulsarClusterInfo pulsarCluster = (PulsarClusterInfo) 
clusterInfo;
+                PulsarClusterConfig pulsarClusterConfig = 
CommonBeanUtils.copyProperties(pulsarCluster,
+                        PulsarClusterConfig::new);
+                pulsarClusterConfig.setVersion(pulsarCluster.getVersion());
+                pulsarClusterConfig.setClusterName(pulsarCluster.getName());
+                pulsarClusterConfig.setServiceUrl(pulsarCluster.getUrl());
+                list.add(pulsarClusterConfig);
+            }
+            ClusterConfigEntity clusterConfigEntity = existEntity == null ? 
new ClusterConfigEntity() : existEntity;
+            
clusterConfigEntity.setConfigParams(objectMapper.writeValueAsString(list));
+            clusterConfigEntity.setClusterTag(clusterTag);
+            clusterConfigEntity.setClusterType(ClusterType.PULSAR);
+            clusterConfigEntity.setModifier(operator);
+            if (existEntity == null) {
+                clusterConfigEntity.setCreator(operator);
+                clusterConfigEntityMapper.insert(clusterConfigEntity);
+            } else {
+                
clusterConfigEntityMapper.updateByIdSelective(clusterConfigEntity);
+            }
+        } catch (Exception e) {
+            String errMsg =
+                    String.format("push cluster config failed for cluster 
Tag=%s", clusterTag);
+            LOGGER.error(errMsg, e);
+            throw new WorkflowListenerException(errMsg);
+        }
+        return true;
+    }
+
+}
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/listener/queue/ClusterConfigListener.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/listener/queue/ClusterConfigListener.java
index c14398b98f..34599ed261 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/listener/queue/ClusterConfigListener.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/listener/queue/ClusterConfigListener.java
@@ -17,30 +17,19 @@
 
 package org.apache.inlong.manager.service.listener.queue;
 
-import org.apache.inlong.common.pojo.sort.mq.PulsarClusterConfig;
-import org.apache.inlong.manager.common.enums.ClusterType;
 import org.apache.inlong.manager.common.enums.TaskEvent;
 import org.apache.inlong.manager.common.exceptions.WorkflowListenerException;
-import org.apache.inlong.manager.common.util.CommonBeanUtils;
-import org.apache.inlong.manager.dao.entity.ClusterConfigEntity;
-import org.apache.inlong.manager.dao.mapper.ClusterConfigEntityMapper;
-import org.apache.inlong.manager.pojo.cluster.ClusterInfo;
-import org.apache.inlong.manager.pojo.cluster.pulsar.PulsarClusterInfo;
 import 
org.apache.inlong.manager.pojo.workflow.form.process.ClusterResourceProcessForm;
 import org.apache.inlong.manager.pojo.workflow.form.process.ProcessForm;
-import org.apache.inlong.manager.service.cluster.InlongClusterService;
+import org.apache.inlong.manager.service.cluster.ClusterConfigService;
 import org.apache.inlong.manager.workflow.WorkflowContext;
 import org.apache.inlong.manager.workflow.event.ListenerResult;
 import org.apache.inlong.manager.workflow.event.task.ClusterOperateListener;
 
 import lombok.extern.slf4j.Slf4j;
-import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Create cluster config listener for cluster tag
  */
@@ -49,9 +38,7 @@ import java.util.List;
 public class ClusterConfigListener implements ClusterOperateListener {
 
     @Autowired
-    private InlongClusterService clusterService;
-    @Autowired
-    private ClusterConfigEntityMapper clusterConfigEntityMapper;
+    private ClusterConfigService clusterConfigService;
 
     @Override
     public TaskEvent event() {
@@ -68,54 +55,9 @@ public class ClusterConfigListener implements 
ClusterOperateListener {
     public ListenerResult listen(WorkflowContext context) throws 
WorkflowListenerException {
         ClusterResourceProcessForm clusterProcessForm = 
(ClusterResourceProcessForm) context.getProcessForm();
         log.info("begin to execute ClusterConfigListener for clusterTag={}", 
clusterProcessForm.getInlongClusterTag());
-        ObjectMapper objectMapper = new ObjectMapper();
         String clusterTag = clusterProcessForm.getInlongClusterTag();
         String operator = context.getOperator();
-        try {
-            List<ClusterInfo> clusterInfos = 
clusterService.listByTagAndType(clusterTag, ClusterType.PULSAR);
-            List<PulsarClusterConfig> list = new ArrayList<>();
-            ClusterConfigEntity clusterConfigEntity = 
clusterConfigEntityMapper.selectByClusterTag(clusterTag);
-            if (clusterConfigEntity == null) {
-                clusterConfigEntity = new ClusterConfigEntity();
-                for (ClusterInfo clusterInfo : clusterInfos) {
-                    PulsarClusterInfo pulsarCluster = (PulsarClusterInfo) 
clusterInfo;
-
-                    PulsarClusterConfig pulsarClusterConfig =
-                            CommonBeanUtils.copyProperties(pulsarCluster, 
PulsarClusterConfig::new);
-                    pulsarClusterConfig.setVersion(pulsarCluster.getVersion());
-                    
pulsarClusterConfig.setClusterName(pulsarCluster.getName());
-                    pulsarClusterConfig.setServiceUrl(pulsarCluster.getUrl());
-                    list.add(pulsarClusterConfig);
-                }
-                
clusterConfigEntity.setConfigParams(objectMapper.writeValueAsString(list));
-                clusterConfigEntity.setClusterTag(clusterTag);
-                clusterConfigEntity.setClusterType(ClusterType.PULSAR);
-                clusterConfigEntity.setModifier(operator);
-                clusterConfigEntity.setCreator(operator);
-                clusterConfigEntity.setVersion(0);
-                clusterConfigEntityMapper.insert(clusterConfigEntity);
-            } else {
-                for (ClusterInfo clusterInfo : clusterInfos) {
-                    PulsarClusterInfo pulsarCluster = (PulsarClusterInfo) 
clusterInfo;
-
-                    PulsarClusterConfig pulsarClusterConfig =
-                            CommonBeanUtils.copyProperties(pulsarCluster, 
PulsarClusterConfig::new);
-                    
pulsarClusterConfig.setClusterName(pulsarCluster.getName());
-                    pulsarClusterConfig.setVersion(pulsarCluster.getVersion());
-                    list.add(pulsarClusterConfig);
-                }
-                
clusterConfigEntity.setConfigParams(objectMapper.writeValueAsString(list));
-                clusterConfigEntity.setClusterTag(clusterTag);
-                clusterConfigEntity.setClusterType(ClusterType.PULSAR);
-                clusterConfigEntity.setModifier(operator);
-                
clusterConfigEntityMapper.updateByIdSelective(clusterConfigEntity);
-            }
-        } catch (Exception e) {
-            String errMsg = String.format("push cluster config failed for 
cluster Tag=%s", clusterTag);
-            log.error(errMsg, e);
-            throw new WorkflowListenerException(errMsg);
-        }
-
+        clusterConfigService.refresh(clusterTag, operator);
         log.info("success to execute ClusterConfigListener for clusterTag={}",
                 clusterProcessForm.getInlongClusterTag());
         return ListenerResult.success("success");
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/es/ElasticsearchResourceOperator.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/es/ElasticsearchResourceOperator.java
index 73054344bc..e81ba70e47 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/es/ElasticsearchResourceOperator.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/es/ElasticsearchResourceOperator.java
@@ -37,7 +37,7 @@ public class ElasticsearchResourceOperator extends 
AbstractStandaloneSinkResourc
 
     @Override
     public Boolean accept(String sinkType) {
-        return SinkType.ELASTICSEARCH.equals(sinkType);
+        return SinkType.ES.equals(sinkType);
     }
 
     @Override
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/es/ElasticsearchSinkOperator.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/es/ElasticsearchSinkOperator.java
index b5ea6cc127..659b934f8a 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/es/ElasticsearchSinkOperator.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/es/ElasticsearchSinkOperator.java
@@ -69,12 +69,12 @@ public class ElasticsearchSinkOperator extends 
AbstractSinkOperator {
 
     @Override
     public Boolean accept(String sinkType) {
-        return SinkType.ELASTICSEARCH.equals(sinkType);
+        return SinkType.ES.equals(sinkType);
     }
 
     @Override
     protected String getSinkType() {
-        return SinkType.ELASTICSEARCH;
+        return SinkType.ES;
     }
 
     @Override
diff --git 
a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/sink/ElasticsearchSinkServiceTest.java
 
b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/sink/ElasticsearchSinkServiceTest.java
index 964f216c9c..7a40e78541 100644
--- 
a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/sink/ElasticsearchSinkServiceTest.java
+++ 
b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/sink/ElasticsearchSinkServiceTest.java
@@ -59,7 +59,7 @@ public class ElasticsearchSinkServiceTest extends 
ServiceBaseTest {
         ElasticsearchSinkRequest sinkInfo = new ElasticsearchSinkRequest();
         sinkInfo.setInlongGroupId(globalGroupId);
         sinkInfo.setInlongStreamId(globalStreamId);
-        sinkInfo.setSinkType(SinkType.ELASTICSEARCH);
+        sinkInfo.setSinkType(SinkType.ES);
 
         sinkInfo.setDataNodeName(dataNodeName);
 
diff --git 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterConfigController.java
 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterConfigController.java
new file mode 100644
index 0000000000..5be9c72995
--- /dev/null
+++ 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/ClusterConfigController.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.web.controller;
+
+import org.apache.inlong.manager.pojo.common.Response;
+import org.apache.inlong.manager.pojo.user.LoginUserUtils;
+import org.apache.inlong.manager.pojo.user.UserRoleCode;
+import org.apache.inlong.manager.service.cluster.ClusterConfigService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Cluster config controller
+ */
+@RestController
+@RequestMapping("/api")
+@Api(tags = "Cluster-Config-API")
+public class ClusterConfigController {
+
+    @Autowired
+    private ClusterConfigService clusterConfigService;
+
+    @PostMapping(value = "/clusterConfig/refresh/{clusterTag}")
+    @ApiOperation(value = "Refresh cluster config")
+    @RequiresRoles(value = UserRoleCode.INLONG_ADMIN)
+    public Response<Boolean> refresh(@PathVariable String clusterTag) {
+        String currentUser = LoginUserUtils.getLoginUser().getName();
+        return Response.success(clusterConfigService.refresh(clusterTag, 
currentUser));
+    }
+
+}

Reply via email to