You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2024/01/04 11:06:09 UTC

(inlong) branch master updated: [INLONG-9524][Manager] Manager client support migrate group tenant, switch cluster tag (#9529)

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 0cd0cc7ba9 [INLONG-9524][Manager] Manager client support migrate group tenant, switch cluster tag  (#9529)
0cd0cc7ba9 is described below

commit 0cd0cc7ba957f0ad6e23819d08e7f40520ea80bc
Author: castor <58...@users.noreply.github.com>
AuthorDate: Thu Jan 4 19:06:04 2024 +0800

    [INLONG-9524][Manager] Manager client support migrate group tenant, switch cluster tag  (#9529)
    
    Co-authored-by: castorqin <qh...@qq.com>
---
 .../client/api/inner/client/InlongClusterClient.java       | 14 ++++++++++++++
 .../manager/client/api/inner/client/InlongGroupClient.java | 13 +++++++++++++
 .../client/api/inner/client/InlongTenantClient.java        | 13 +++++++++++++
 .../manager/client/api/service/InlongClusterApi.java       |  4 ++++
 .../inlong/manager/client/api/service/InlongGroupApi.java  |  6 ++++++
 .../inlong/manager/client/api/service/InlongTenantApi.java |  3 +++
 6 files changed, 53 insertions(+)

diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongClusterClient.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongClusterClient.java
index a4558b43ad..abad7b8a81 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongClusterClient.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongClusterClient.java
@@ -31,6 +31,7 @@ import org.apache.inlong.manager.pojo.cluster.ClusterRequest;
 import org.apache.inlong.manager.pojo.cluster.ClusterTagPageRequest;
 import org.apache.inlong.manager.pojo.cluster.ClusterTagRequest;
 import org.apache.inlong.manager.pojo.cluster.ClusterTagResponse;
+import org.apache.inlong.manager.pojo.cluster.TenantClusterTagPageRequest;
 import org.apache.inlong.manager.pojo.common.PageResult;
 import org.apache.inlong.manager.pojo.common.Response;
 import org.apache.inlong.manager.pojo.common.UpdateResult;
@@ -86,6 +87,19 @@ public class InlongClusterClient {
         return response.getData();
     }
 
+    /**
+     * Paging query cluster tags according to conditions.
+     *
+     * @param request page request conditions
+     * @return cluster tag list
+     */
+    public PageResult<ClusterTagResponse> listTagByTenantRole(TenantClusterTagPageRequest request) {
+        Response<PageResult<ClusterTagResponse>> response = ClientUtils.executeHttpCall(
+                inlongClusterApi.listTagByTenantRole(request));
+        ClientUtils.assertRespSuccess(response);
+        return response.getData();
+    }
+
     /**
      * Update cluster tag.
      *
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongGroupClient.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongGroupClient.java
index 890ed86a60..c7462fd0b2 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongGroupClient.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongGroupClient.java
@@ -286,4 +286,17 @@ public class InlongGroupClient {
         }
         throw new RuntimeException(response.getErrMsg());
     }
+
+    public Boolean startTagSwitch(String groupId, String clusterTag) {
+        Response<Boolean> response = ClientUtils.executeHttpCall(inlongGroupApi.startTagSwitch(groupId, clusterTag));
+        ClientUtils.assertRespSuccess(response);
+        return response.getData();
+    }
+
+    public Boolean finishTagSwitch(String groupId) {
+        Response<Boolean> response = ClientUtils.executeHttpCall(inlongGroupApi.finishTagSwitch(groupId));
+        ClientUtils.assertRespSuccess(response);
+        return response.getData();
+    }
+
 }
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongTenantClient.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongTenantClient.java
index 14546cba9e..488cbf0ce3 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongTenantClient.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/InlongTenantClient.java
@@ -86,4 +86,17 @@ public class InlongTenantClient {
         ClientUtils.assertRespSuccess(updateResult);
         return updateResult.getData();
     }
+
+    /**
+     * Migrate group to another tenant
+     *
+     * @param inlongGroupId inlong group id
+     * @param tenant target tenant
+     * @return true/false
+     */
+    public Boolean migrate(String inlongGroupId, String tenant) {
+        Response<Boolean> migrateResult = ClientUtils.executeHttpCall(inlongTenantApi.migrate(inlongGroupId, tenant));
+        ClientUtils.assertRespSuccess(migrateResult);
+        return migrateResult.getData();
+    }
 }
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongClusterApi.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongClusterApi.java
index 5be602cc3b..373af6b8d3 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongClusterApi.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongClusterApi.java
@@ -26,6 +26,7 @@ import org.apache.inlong.manager.pojo.cluster.ClusterRequest;
 import org.apache.inlong.manager.pojo.cluster.ClusterTagPageRequest;
 import org.apache.inlong.manager.pojo.cluster.ClusterTagRequest;
 import org.apache.inlong.manager.pojo.cluster.ClusterTagResponse;
+import org.apache.inlong.manager.pojo.cluster.TenantClusterTagPageRequest;
 import org.apache.inlong.manager.pojo.common.PageResult;
 import org.apache.inlong.manager.pojo.common.Response;
 import org.apache.inlong.manager.pojo.common.UpdateResult;
@@ -51,6 +52,9 @@ public interface InlongClusterApi {
     @POST("cluster/tag/list")
     Call<Response<PageResult<ClusterTagResponse>>> listTag(@Body ClusterTagPageRequest request);
 
+    @POST("cluster/tag/listTagByTenantRole")
+    Call<Response<PageResult<ClusterTagResponse>>> listTagByTenantRole(@Body TenantClusterTagPageRequest request);
+
     @POST("cluster/tag/update")
     Call<Response<Boolean>> updateTag(@Body ClusterTagRequest request);
 
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongGroupApi.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongGroupApi.java
index 6a4639b348..9f9df342b2 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongGroupApi.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongGroupApi.java
@@ -85,4 +85,10 @@ public interface InlongGroupApi {
 
     @GET("group/listTopics")
     Call<Response<List<InlongGroupTopicInfo>>> listTopics(@Body InlongGroupTopicRequest request);
+
+    @GET("group/switch/start/{groupId}/{clusterTag}")
+    Call<Response<Boolean>> startTagSwitch(@Path("groupId") String groupId, @Path("clusterTag") String clusterTag);
+
+    @GET("group/switch/finish/{groupId}")
+    Call<Response<Boolean>> finishTagSwitch(@Path("groupId") String groupId);
 }
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongTenantApi.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongTenantApi.java
index f56a6301cb..a7aa25d94b 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongTenantApi.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongTenantApi.java
@@ -43,4 +43,7 @@ public interface InlongTenantApi {
     @GET("tenant/get/{name}")
     Call<Response<InlongTenantInfo>> get(@Path("name") String name);
 
+    @GET("tenant/migrate/{group}/{tenant}")
+    Call<Response<Boolean>> migrate(@Path("group") String group, @Path("tenant") String tenant);
+
 }