Skip to content

Commit

Permalink
[INLONG-9062][Manager] Add default values for stream related interfac…
Browse files Browse the repository at this point in the history
…e parameters (#9063)
  • Loading branch information
fuweng11 authored Oct 18, 2023
1 parent b61dc53 commit 88495b9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,13 @@ public List<InlongStreamInfo> listStreamInfo(String inlongGroupId) {
*
* @param groupId inlong group id
* @param streamId inlong stream id
* @param sync Create stream in synchronous/asynchronous way.
* @return whether succeed
*/
public boolean startProcess(String groupId, String streamId) {
public boolean startProcess(String groupId, String streamId, boolean sync) {
Preconditions.expectNotBlank(groupId, ErrorCodeEnum.GROUP_ID_IS_EMPTY);
Preconditions.expectNotBlank(streamId, ErrorCodeEnum.STREAM_ID_IS_EMPTY);
Response<Boolean> response = ClientUtils.executeHttpCall(inlongStreamApi.startProcess(groupId, streamId));
Response<Boolean> response = ClientUtils.executeHttpCall(inlongStreamApi.startProcess(groupId, streamId, sync));
ClientUtils.assertRespSuccess(response);
return response.getData();
}
Expand All @@ -179,12 +180,14 @@ public boolean startProcess(String groupId, String streamId) {
*
* @param groupId inlong group id
* @param streamId inlong stream id
* @param sync Suspend stream in synchronous/asynchronous way.
* @return whether succeed
*/
public boolean suspendProcess(String groupId, String streamId) {
public boolean suspendProcess(String groupId, String streamId, boolean sync) {
Preconditions.expectNotBlank(groupId, ErrorCodeEnum.GROUP_ID_IS_EMPTY);
Preconditions.expectNotBlank(streamId, ErrorCodeEnum.STREAM_ID_IS_EMPTY);
Response<Boolean> response = ClientUtils.executeHttpCall(inlongStreamApi.suspendProcess(groupId, streamId));
Response<Boolean> response =
ClientUtils.executeHttpCall(inlongStreamApi.suspendProcess(groupId, streamId, sync));
ClientUtils.assertRespSuccess(response);
return response.getData();
}
Expand All @@ -194,12 +197,14 @@ public boolean suspendProcess(String groupId, String streamId) {
*
* @param groupId inlong group id
* @param streamId inlong stream id
* @param sync Restart stream in synchronous/asynchronous way.
* @return whether succeed
*/
public boolean restartProcess(String groupId, String streamId) {
public boolean restartProcess(String groupId, String streamId, boolean sync) {
Preconditions.expectNotBlank(groupId, ErrorCodeEnum.GROUP_ID_IS_EMPTY);
Preconditions.expectNotBlank(streamId, ErrorCodeEnum.STREAM_ID_IS_EMPTY);
Response<Boolean> response = ClientUtils.executeHttpCall(inlongStreamApi.restartProcess(groupId, streamId));
Response<Boolean> response =
ClientUtils.executeHttpCall(inlongStreamApi.restartProcess(groupId, streamId, sync));
ClientUtils.assertRespSuccess(response);
return response.getData();
}
Expand All @@ -209,12 +214,14 @@ public boolean restartProcess(String groupId, String streamId) {
*
* @param groupId inlong group id
* @param streamId inlong stream id
* @param sync Delete stream in synchronous/asynchronous way.
* @return whether succeed
*/
public boolean deleteProcess(String groupId, String streamId) {
public boolean deleteProcess(String groupId, String streamId, boolean sync) {
Preconditions.expectNotBlank(groupId, ErrorCodeEnum.GROUP_ID_IS_EMPTY);
Preconditions.expectNotBlank(streamId, ErrorCodeEnum.STREAM_ID_IS_EMPTY);
Response<Boolean> response = ClientUtils.executeHttpCall(inlongStreamApi.deleteProcess(groupId, streamId));
Response<Boolean> response =
ClientUtils.executeHttpCall(inlongStreamApi.deleteProcess(groupId, streamId, sync));
ClientUtils.assertRespSuccess(response);
return response.getData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,20 @@ Call<Response<InlongStreamInfo>> getStream(@Query("groupId") String groupId,
Call<Response<PageResult<InlongStreamInfo>>> listStream(@Body InlongStreamPageRequest request);

@POST("stream/startProcess/{groupId}/{streamId}")
Call<Response<Boolean>> startProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
Call<Response<Boolean>> startProcess(@Path("groupId") String groupId, @Path("streamId") String streamId,
@Query("sync") boolean sync);

@POST("stream/suspendProcess/{groupId}/{streamId}")
Call<Response<Boolean>> suspendProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
Call<Response<Boolean>> suspendProcess(@Path("groupId") String groupId, @Path("streamId") String streamId,
@Query("sync") boolean sync);

@POST("stream/restartProcess/{groupId}/{streamId}")
Call<Response<Boolean>> restartProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
Call<Response<Boolean>> restartProcess(@Path("groupId") String groupId, @Path("streamId") String streamId,
@Query("sync") boolean sync);

@POST("stream/deleteProcess/{groupId}/{streamId}")
Call<Response<Boolean>> deleteProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
Call<Response<Boolean>> deleteProcess(@Path("groupId") String groupId, @Path("streamId") String streamId,
@Query("sync") boolean sync);

@DELETE("stream/delete")
Call<Response<Boolean>> delete(@Query("groupId") String groupId, @Query("streamId") String streamId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public Response<Boolean> update(@Validated(UpdateValidation.class) @RequestBody
@ApiImplicitParam(name = "streamId", dataTypeClass = String.class, required = true)
})
public Response<Boolean> startProcess(@PathVariable String groupId, @PathVariable String streamId,
@RequestParam boolean sync) {
@RequestParam(required = false, defaultValue = "false") boolean sync) {
String operator = LoginUserUtils.getLoginUser().getName();
return Response.success(streamProcessOperation.startProcess(groupId, streamId, operator, sync));
}
Expand All @@ -159,7 +159,7 @@ public Response<Boolean> startProcess(@PathVariable String groupId, @PathVariabl
@ApiImplicitParam(name = "streamId", dataTypeClass = String.class, required = true)
})
public Response<Boolean> suspendProcess(@PathVariable String groupId, @PathVariable String streamId,
@RequestParam boolean sync) {
@RequestParam(required = false, defaultValue = "false") boolean sync) {
String operator = LoginUserUtils.getLoginUser().getName();
return Response.success(streamProcessOperation.suspendProcess(groupId, streamId, operator, sync));
}
Expand All @@ -171,7 +171,7 @@ public Response<Boolean> suspendProcess(@PathVariable String groupId, @PathVaria
@ApiImplicitParam(name = "streamId", dataTypeClass = String.class, required = true)
})
public Response<Boolean> restartProcess(@PathVariable String groupId, @PathVariable String streamId,
@RequestParam boolean sync) {
@RequestParam(required = false, defaultValue = "false") boolean sync) {
String operator = LoginUserUtils.getLoginUser().getName();
return Response.success(streamProcessOperation.restartProcess(groupId, streamId, operator, sync));
}
Expand All @@ -183,7 +183,7 @@ public Response<Boolean> restartProcess(@PathVariable String groupId, @PathVaria
@ApiImplicitParam(name = "streamId", dataTypeClass = String.class, required = true)
})
public Response<Boolean> deleteProcess(@PathVariable String groupId, @PathVariable String streamId,
@RequestParam boolean sync) {
@RequestParam(required = false, defaultValue = "false") boolean sync) {
String operator = LoginUserUtils.getLoginUser().getName();
return Response.success(streamProcessOperation.deleteProcess(groupId, streamId, operator, sync));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public Response<Boolean> delete(@RequestParam String groupId, @RequestParam Stri
@ApiImplicitParam(name = "streamId", dataTypeClass = String.class, required = true)
})
public Response<Boolean> startProcess(@PathVariable String groupId, @PathVariable String streamId,
@RequestParam boolean sync) {
@RequestParam(required = false, defaultValue = "false") boolean sync) {
String operator = LoginUserUtils.getLoginUser().getName();
return Response.success(streamProcessOperation.startProcess(groupId, streamId, operator, sync));
}
Expand Down

0 comments on commit 88495b9

Please sign in to comment.