You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2022/11/25 12:18:24 UTC
[incubator-streampark] branch dev updated: [Improve] Unified swagger api docs description (#2096)
This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 409891661 [Improve] Unified swagger api docs description (#2096)
409891661 is described below
commit 4098916612bf967a4ca390f3aa646c9dddfc22ad
Author: lvshaokang <lv...@hotmail.com>
AuthorDate: Fri Nov 25 20:18:18 2022 +0800
[Improve] Unified swagger api docs description (#2096)
* [Improve] Unified swagger api docs description
---
.../console/base/config/SwaggerConfig.java | 8 +++--
.../console/base/domain/ApiDocConstant.java | 2 +-
.../console/core/controller/AlertController.java | 14 ++++-----
.../ApplicationBuildPipelineController.java | 2 ++
.../core/controller/ApplicationController.java | 34 +++++++++++++---------
5 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SwaggerConfig.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SwaggerConfig.java
index 2a43798e6..27fdf36b6 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SwaggerConfig.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SwaggerConfig.java
@@ -43,6 +43,7 @@ import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.AuthorizationScope;
+import springfox.documentation.service.Contact;
import springfox.documentation.service.HttpAuthenticationScheme;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
@@ -88,8 +89,11 @@ public class SwaggerConfig implements WebMvcConfigurer {
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
- .title("StreamPark Api Docs")
- .description("StreamPark Api Docs")
+ .title("Apache StreamPark Api Docs")
+ .description("Apache StreamPark Api Docs")
+ .contact(new Contact("Apache StreamPark", "https://streampark.apache.org/", "dev@streampark.apache.org"))
+ .version("2.0.0")
+ .license("Apache-2.0 license")
.build();
}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/ApiDocConstant.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/ApiDocConstant.java
index e14c1914c..152286109 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/ApiDocConstant.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/ApiDocConstant.java
@@ -19,6 +19,6 @@ package org.apache.streampark.console.base.domain;
public class ApiDocConstant {
- public static final String FLINK_APP_OP_TAG = "[Flink application] operations";
+ public static final String FLINK_APP_OP_TAG = "FLINK_APPLICATION_OPERATION_TAG";
}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
index d683ffb4d..ef3621008 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
@@ -61,35 +61,35 @@ public class AlertController {
@Autowired
private AlertService alertService;
- @ApiOperation(value = "createAlertConfig")
+ @ApiOperation(value = "Create alert config")
@PostMapping(value = "/add")
public RestResponse createAlertConfig(@RequestBody AlertConfigWithParams params) {
boolean save = alertConfigService.save(AlertConfig.of(params));
return RestResponse.success(save);
}
- @ApiOperation(value = "existsAlertConfig")
+ @ApiOperation(value = "Exist alert config")
@PostMapping(value = "/exists")
public RestResponse existsAlertConfig(@RequestBody AlertConfigWithParams params) {
boolean exist = alertConfigService.exist(AlertConfig.of(params));
return RestResponse.success(exist);
}
- @ApiOperation(value = "updateAlertConfig")
+ @ApiOperation(value = "Update alert config")
@PostMapping(value = "/update")
public RestResponse updateAlertConfig(@RequestBody AlertConfigWithParams params) {
boolean update = alertConfigService.updateById(AlertConfig.of(params));
return RestResponse.success(update);
}
- @ApiOperation(value = "getAlertConfig")
+ @ApiOperation(value = "Get alert config")
@PostMapping("/get")
public RestResponse getAlertConfig(@RequestBody AlertConfigWithParams params) {
AlertConfig alertConfig = alertConfigService.getById(params.getId());
return RestResponse.success(AlertConfigWithParams.of(alertConfig));
}
- @ApiOperation(value = "listPageAlertConfigs")
+ @ApiOperation(value = "List alert configs(Pagination)")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageSize", value = "page size", required = true, example = "10", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "pageNum", value = "page num", required = true, example = "1", dataTypeClass = Integer.class),
@@ -102,14 +102,14 @@ public class AlertController {
return RestResponse.success(page);
}
- @ApiOperation(value = "listAlertConfigs")
+ @ApiOperation(value = "List alert configs")
@PostMapping(value = "/listWithOutPage")
public RestResponse listAlertConfigs() {
List<AlertConfig> page = alertConfigService.list();
return RestResponse.success(page);
}
- @ApiOperation(value = "deleteAlertConfig")
+ @ApiOperation(value = "Delete alert config")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "config id", required = true, paramType = "query", dataTypeClass = Long.class)
})
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationBuildPipelineController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationBuildPipelineController.java
index c24db2475..233baa1ac 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationBuildPipelineController.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationBuildPipelineController.java
@@ -29,6 +29,7 @@ import org.apache.streampark.console.core.service.FlinkSqlService;
import org.apache.streampark.flink.packer.pipeline.DockerResolvedSnapshot;
import org.apache.streampark.flink.packer.pipeline.PipelineType;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -44,6 +45,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
+@Api(tags = {"FLINK_APPLICATION_BUILD_PIPELINE_TAG"})
@Slf4j
@Validated
@RestController
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
index 4505b378d..a97a514ca 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
@@ -39,10 +39,10 @@ import org.apache.streampark.console.core.service.LoggerService;
import org.apache.streampark.flink.packer.pipeline.PipelineStatus;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@@ -63,6 +63,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+@Api(tags = {"FLINK_APPLICATION_TAG"})
@Slf4j
@Validated
@RestController
@@ -101,7 +102,7 @@ public class ApplicationController {
}
@ApiAccess
- @ApiOperation(value = "App Copy", notes = "App Copy", tags = ApiDocConstant.FLINK_APP_OP_TAG, consumes = "application/x-www-form-urlencoded")
+ @ApiOperation(value = "Copy application from the exist app", tags = ApiDocConstant.FLINK_APP_OP_TAG, consumes = "application/x-www-form-urlencoded")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "copy target app id", required = true, paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "jobName", value = "name of the copied application", required = true, paramType = "query", dataTypeClass = String.class, defaultValue = ""),
@@ -168,12 +169,12 @@ public class ApplicationController {
}
@ApiAccess
- @ApiOperation(value = "App Start", notes = "App Start", tags = ApiDocConstant.FLINK_APP_OP_TAG, consumes = "application/x-www-form-urlencoded")
+ @ApiOperation(value = "Start application", tags = ApiDocConstant.FLINK_APP_OP_TAG, consumes = "application/x-www-form-urlencoded")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "app Id", required = true, paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "savePointed", value = "restored app from the savepoint or latest checkpoint", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
@ApiImplicitParam(name = "savePoint", value = "savepoint or checkpoint path", required = true, paramType = "query", dataTypeClass = String.class, defaultValue = ""),
- @ApiImplicitParam(name = "flameGraph", value = "flame Graph support", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
+ @ApiImplicitParam(name = "flameGraph", value = "whether the flame graph support", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
@ApiImplicitParam(name = "allowNonRestored", value = "ignore savepoint then cannot be restored", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false")})
@PostMapping(value = "start", consumes = "application/x-www-form-urlencoded")
@RequiresPermissions("app:start")
@@ -189,10 +190,10 @@ public class ApplicationController {
}
@ApiAccess
- @ApiOperation(value = "App Cancel", notes = "App Cancel", tags = ApiDocConstant.FLINK_APP_OP_TAG, consumes = "application/x-www-form-urlencoded")
+ @ApiOperation(value = "Cancel application", tags = ApiDocConstant.FLINK_APP_OP_TAG, consumes = "application/x-www-form-urlencoded")
@ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "app Id", required = true, paramType = "query", dataTypeClass = Long.class),
- @ApiImplicitParam(name = "savePointed", value = "trigger savePoint before taking stopping", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
+ @ApiImplicitParam(name = "id", value = "app id", required = true, paramType = "query", dataTypeClass = Long.class),
+ @ApiImplicitParam(name = "savePointed", value = "whether trigger savepoint before taking stopping", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
@ApiImplicitParam(name = "savePoint", value = "savepoint path", paramType = "query", dataTypeClass = String.class, defaultValue = "hdfs:///tm/xxx"),
@ApiImplicitParam(name = "drain", value = "send max watermark before canceling", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false")})
@PostMapping(value = "cancel", consumes = "application/x-www-form-urlencoded")
@@ -336,13 +337,20 @@ public class ApplicationController {
}
}
- @ApiOperation(value = "APP detail")
+ @ApiOperation(value = "Read flink on k8s deploy log")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "namespace", value = "ks8 namespace"),
+ @ApiImplicitParam(name = "jobName", value = "job name"),
+ @ApiImplicitParam(name = "jobId", value = "job id"),
+ @ApiImplicitParam(name = "skipLineNum", value = "number of log lines skipped loading"),
+ @ApiImplicitParam(name = "limit", value = "number of log lines loaded at once")
+ })
@PostMapping(value = "/detail")
- public RestResponse detail(@ApiParam("K8s name spaces") @RequestParam(value = "namespace", required = false) String namespace,
- @ApiParam("Job name") @RequestParam(value = "jobName", required = false) String jobName,
- @ApiParam("Job id") @RequestParam(value = "jobId", required = false) String jobId,
- @ApiParam("Number of log lines skipped loading") @RequestParam(value = "skipLineNum", required = false) Integer skipLineNum,
- @ApiParam("Number of log lines loaded at once") @RequestParam(value = "limit", required = false) Integer limit) {
+ public RestResponse detail(@RequestParam(value = "namespace", required = false) String namespace,
+ @RequestParam(value = "jobName", required = false) String jobName,
+ @RequestParam(value = "jobId", required = false) String jobId,
+ @RequestParam(value = "skipLineNum", required = false) Integer skipLineNum,
+ @RequestParam(value = "limit", required = false) Integer limit) {
return RestResponse.success(MoreFutures.derefUsingDefaultTimeout(logService.queryLog(namespace, jobName, jobId, skipLineNum, limit)));
}