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 06b793e604 [INLONG-9017][Manager] Add stop interface in stream source 
API (#9018)
06b793e604 is described below

commit 06b793e604a92913e354017c68c7812459ee293c
Author: fuweng11 <[email protected]>
AuthorDate: Sat Oct 7 14:30:58 2023 +0800

    [INLONG-9017][Manager] Add stop interface in stream source API (#9018)
---
 .../api/inner/client/StreamSourceClient.java       | 22 +++++++++++++++++++++-
 .../client/api/service/StreamSourceApi.java        |  6 ++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git 
a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/StreamSourceClient.java
 
b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/StreamSourceClient.java
index a81a76b309..88a1ed7cc3 100644
--- 
a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/StreamSourceClient.java
+++ 
b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/StreamSourceClient.java
@@ -99,12 +99,32 @@ public class StreamSourceClient {
      * Delete data source information by id.
      */
     public boolean deleteSource(int id) {
-        Preconditions.expectTrue(id > 0, "sourceId is illegal");
+        Preconditions.expectTrue(id > 0, String.format("sourceId is excepted 
bigger than 0 but got %d", id));
         Response<Boolean> response = 
ClientUtils.executeHttpCall(streamSourceApi.deleteSource(id));
         ClientUtils.assertRespSuccess(response);
         return response.getData();
     }
 
+    /**
+     * Stop data source information by id.
+     */
+    public boolean stopSource(int id) {
+        Preconditions.expectTrue(id > 0, String.format("sourceId is excepted 
bigger than 0 but got %d", id));
+        Response<Boolean> response = 
ClientUtils.executeHttpCall(streamSourceApi.stopSource(id));
+        ClientUtils.assertRespSuccess(response);
+        return response.getData();
+    }
+
+    /**
+     * Restart data source information by id.
+     */
+    public boolean restartSource(int id) {
+        Preconditions.expectTrue(id > 0, "sourceId is illegal");
+        Response<Boolean> response = 
ClientUtils.executeHttpCall(streamSourceApi.restartSource(id));
+        ClientUtils.assertRespSuccess(response);
+        return response.getData();
+    }
+
     /**
      * Force deletes the stream source by groupId and streamId
      *
diff --git 
a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/StreamSourceApi.java
 
b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/StreamSourceApi.java
index b4982b3714..d383e30d86 100644
--- 
a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/StreamSourceApi.java
+++ 
b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/StreamSourceApi.java
@@ -45,6 +45,12 @@ public interface StreamSourceApi {
     @DELETE("source/delete/{id}")
     Call<Response<Boolean>> deleteSource(@Path("id") Integer sourceId);
 
+    @POST("source/stop/{id}")
+    Call<Response<Boolean>> stopSource(@Path("id") Integer sourceId);
+
+    @POST("source/restart/{id}")
+    Call<Response<Boolean>> restartSource(@Path("id") Integer sourceId);
+
     @DELETE("source/forceDelete")
     Call<Response<Boolean>> forceDelete(@Query("inlongGroupId") String groupId,
             @Query("inlongStreamId") String streamId);

Reply via email to