From 959e3053fce6521d2ce5fc8c75c653cc3368395e Mon Sep 17 00:00:00 2001 From: Guangdong Liu <804167098@qq.com> Date: Wed, 9 Oct 2024 19:51:08 +0800 Subject: [PATCH] [Improve][RestApi] Update context-path to / as default path (#7800) --- config/seatunnel.yaml | 2 - docs/en/seatunnel-engine/rest-api-v2.md | 38 ++++++++++++------- docs/zh/seatunnel-engine/rest-api-v2.md | 38 ++++++++++++------- .../engine/e2e/ClusterSeaTunnelContainer.java | 2 +- .../src/test/resources/cluster/seatunnel.yaml | 1 - 5 files changed, 49 insertions(+), 32 deletions(-) diff --git a/config/seatunnel.yaml b/config/seatunnel.yaml index 141363ab031..c3832394233 100644 --- a/config/seatunnel.yaml +++ b/config/seatunnel.yaml @@ -40,5 +40,3 @@ seatunnel: http: enable-http: true port: 8080 - context-path: /seatunnel - diff --git a/docs/en/seatunnel-engine/rest-api-v2.md b/docs/en/seatunnel-engine/rest-api-v2.md index 9f98ea0dda7..643b4e51d87 100644 --- a/docs/en/seatunnel-engine/rest-api-v2.md +++ b/docs/en/seatunnel-engine/rest-api-v2.md @@ -18,7 +18,17 @@ The v2 version of the api uses jetty support. It is the same as the interface sp seatunnel: engine: enable-http: true - jetty-port: 8080 + port: 8080 +``` + +Context-path can also be configured as follows: + +```yaml + +seatunnel: + engine: + enable-http: true + port: 8080 context-path: /seatunnel ``` @@ -27,7 +37,7 @@ seatunnel: ### Returns an overview over the Zeta engine cluster.
- GET /seatunnel/overview?tag1=value1&tag2=value2 (Returns an overview over the Zeta engine cluster.) + GET /overview?tag1=value1&tag2=value2 (Returns an overview over the Zeta engine cluster.) #### Parameters @@ -62,7 +72,7 @@ seatunnel: ### Returns An Overview And State Of All Jobs
- GET /seatunnel/running-jobs (Returns an overview over all jobs and their current state.) + GET /running-jobs (Returns an overview over all jobs and their current state.) #### Parameters @@ -101,7 +111,7 @@ seatunnel: ### Return Details Of A Job
- GET /seatunnel/job-info/:jobId (Return details of a job. ) + GET /job-info/:jobId (Return details of a job. ) #### Parameters @@ -155,10 +165,10 @@ When we can't get the job info, the response will be: ### Return Details Of A Job -This API has been deprecated, please use /seatunnel/job-info/:jobId instead +This API has been deprecated, please use /job-info/:jobId instead
- GET /seatunnel/running-job/:jobId (Return details of a job. ) + GET /running-job/:jobId (Return details of a job. ) #### Parameters @@ -227,7 +237,7 @@ When we can't get the job info, the response will be: ### Return All Finished Jobs Info
- GET /seatunnel/finished-jobs/:state (Return all finished Jobs Info.) + GET /finished-jobs/:state (Return all finished Jobs Info.) #### Parameters @@ -259,7 +269,7 @@ When we can't get the job info, the response will be: ### Returns System Monitoring Information
- GET /seatunnel/system-monitoring-information (Returns system monitoring information.) + GET /system-monitoring-information (Returns system monitoring information.) #### Parameters @@ -324,7 +334,7 @@ When we can't get the job info, the response will be: ### Submit A Job
-POST /seatunnel/submit-job (Returns jobId and jobName if job submitted successfully.) +POST /submit-job (Returns jobId and jobName if job submitted successfully.) #### Parameters @@ -382,7 +392,7 @@ When we can't get the job info, the response will be: ### Batch Submit Jobs
-POST /seatunnel/submit-jobs (Returns jobId and jobName if the job is successfully submitted.) +POST /submit-jobs (Returns jobId and jobName if the job is successfully submitted.) #### Parameters (add in the `params` field in the request body) @@ -482,7 +492,7 @@ When we can't get the job info, the response will be: ### Stop A Job
-POST /seatunnel/stop-job (Returns jobId if job stoped successfully.) +POST /stop-job (Returns jobId if job stoped successfully.) #### Body @@ -507,7 +517,7 @@ When we can't get the job info, the response will be: ### Batch Stop Jobs
-POST /seatunnel/stop-jobs (Returns jobId if the job is successfully stopped.) +POST /stop-jobs (Returns jobId if the job is successfully stopped.) #### Request Body @@ -543,7 +553,7 @@ When we can't get the job info, the response will be: ### Encrypt Config
-POST /seatunnel/encrypt-config (Returns the encrypted config if config is encrypted successfully.) +POST /encrypt-config (Returns the encrypted config if config is encrypted successfully.) For more information about customize encryption, please refer to the documentation [config-encryption-decryption](../connector-v2/Config-Encryption-Decryption.md). #### Body @@ -632,7 +642,7 @@ For more information about customize encryption, please refer to the documentati ### Update the tags of running node -
POST/seatunnel/update-tagsBecause the update can only target a specific node, the current node's `ip:port` needs to be used for the update(If the update is successful, return a success message) +
POST/update-tagsBecause the update can only target a specific node, the current node's `ip:port` needs to be used for the update(If the update is successful, return a success message) #### update node tags diff --git a/docs/zh/seatunnel-engine/rest-api-v2.md b/docs/zh/seatunnel-engine/rest-api-v2.md index dbfb2152ba0..cdd27595bfe 100644 --- a/docs/zh/seatunnel-engine/rest-api-v2.md +++ b/docs/zh/seatunnel-engine/rest-api-v2.md @@ -14,7 +14,17 @@ v2版本的api使用jetty支持,与v1版本的接口规范相同 ,可以通过 seatunnel: engine: enable-http: true - jetty-port: 8080 + port: 8080 +``` + +同时也可以配置context-path,配置如下: + +```yaml + +seatunnel: + engine: + enable-http: true + port: 8080 context-path: /seatunnel ``` @@ -23,7 +33,7 @@ seatunnel: ### 返回Zeta集群的概览
- GET /seatunnel/overview?tag1=value1&tag2=value2 (Returns an overview over the Zeta engine cluster.) + GET /overview?tag1=value1&tag2=value2 (Returns an overview over the Zeta engine cluster.) #### 参数 @@ -58,7 +68,7 @@ seatunnel: ### 返回所有作业及其当前状态的概览
- GET /seatunnel/running-jobs (返回所有作业及其当前状态的概览。) + GET /running-jobs (返回所有作业及其当前状态的概览。) #### 参数 @@ -97,7 +107,7 @@ seatunnel: ### 返回作业的详细信息
- GET /seatunnel/job-info/:jobId (返回作业的详细信息。) + GET /job-info/:jobId (返回作业的详细信息。) #### 参数 @@ -165,10 +175,10 @@ seatunnel: ### 返回作业的详细信息 -此API已经弃用,请使用/seatunnel/job-info/:jobId替代。 +此API已经弃用,请使用/job-info/:jobId替代。
- GET /seatunnel/running-job/:jobId (返回作业的详细信息。) + GET /running-job/:jobId (返回作业的详细信息。) #### 参数 @@ -223,7 +233,7 @@ seatunnel: ### 返回所有已完成的作业信息
- GET /seatunnel/finished-jobs/:state (返回所有已完成的作业信息。) + GET /finished-jobs/:state (返回所有已完成的作业信息。) #### 参数 @@ -255,7 +265,7 @@ seatunnel: ### 返回系统监控信息
- GET /seatunnel/system-monitoring-information (返回系统监控信息。) + GET /system-monitoring-information (返回系统监控信息。) #### 参数 @@ -320,7 +330,7 @@ seatunnel: ### 提交作业
-POST /seatunnel/submit-job (如果作业提交成功,返回jobId和jobName。) +POST /submit-job (如果作业提交成功,返回jobId和jobName。) #### 参数 @@ -379,7 +389,7 @@ seatunnel: ### 批量提交作业
-POST /seatunnel/submit-jobs (如果作业提交成功,返回jobId和jobName。) +POST /submit-jobs (如果作业提交成功,返回jobId和jobName。) #### 参数(在请求体中params字段中添加) @@ -481,7 +491,7 @@ seatunnel: ### 停止作业
-POST /seatunnel/stop-job (如果作业成功停止,返回jobId。) +POST /stop-job (如果作业成功停止,返回jobId。) #### 请求体 @@ -508,7 +518,7 @@ seatunnel: ### 批量停止作业
-POST /seatunnel/stop-jobs (如果作业成功停止,返回jobId。) +POST /stop-jobs (如果作业成功停止,返回jobId。) #### 请求体 @@ -545,7 +555,7 @@ seatunnel: ### 加密配置
-POST /seatunnel/encrypt-config (如果配置加密成功,则返回加密后的配置。) +POST /encrypt-config (如果配置加密成功,则返回加密后的配置。) 有关自定义加密的更多信息,请参阅文档[配置-加密-解密](../connector-v2/Config-Encryption-Decryption.md). #### 请求体 @@ -634,7 +644,7 @@ seatunnel: ### 更新运行节点的tags
-POST/seatunnel/update-tags因为更新只能针对于某个节点,因此需要用当前节点ip:port用于更新(如果更新成功,则返回"success"信息) +POST/update-tags因为更新只能针对于某个节点,因此需要用当前节点ip:port用于更新(如果更新成功,则返回"success"信息) #### 更新节点tags diff --git a/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/ClusterSeaTunnelContainer.java b/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/ClusterSeaTunnelContainer.java index 9c46d6711cb..804c77f340c 100644 --- a/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/ClusterSeaTunnelContainer.java +++ b/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/ClusterSeaTunnelContainer.java @@ -107,7 +107,7 @@ public void startUp() throws Exception { tasks.add( new Tuple3<>( server.getMappedPort(5801), RestConstant.CONTEXT_PATH, CUSTOM_JOB_ID_1)); - tasks.add(new Tuple3<>(server.getMappedPort(8080), "/seatunnel", CUSTOM_JOB_ID_2)); + tasks.add(new Tuple3<>(server.getMappedPort(8080), "", CUSTOM_JOB_ID_2)); } @Override diff --git a/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/cluster/seatunnel.yaml b/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/cluster/seatunnel.yaml index 4df400d08c9..0720832a67b 100644 --- a/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/cluster/seatunnel.yaml +++ b/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/cluster/seatunnel.yaml @@ -34,4 +34,3 @@ seatunnel: http: enable-http: true port: 8080 - context-path: /seatunnel \ No newline at end of file