Skip to content

Commit a3d5c88

Browse files
feat: added the Environment management module, fixed the problem of missing operator when calling portal, and added fields to OpenClusterDTO under the premise of compatibility
1 parent 6c1d182 commit a3d5c88

File tree

47 files changed

+1677
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1677
-41
lines changed

apollo-openapi.yaml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ tags:
3838
description: 实例管理相关接口,包括实例查询、配置生效状态等功能
3939
- name: Organization Management
4040
description: 组织管理相关接口,包括组织信息查询等功能
41+
- name: Environment Management
42+
description: 环境管理相关接口,包括环境查询等功能
4143
paths:
4244
/openapi/v1/apps:
4345
post:
@@ -1659,8 +1661,8 @@ paths:
16591661
type: string
16601662
- name: operator
16611663
in: query
1662-
description: '操作人用户名'
1663-
required: true
1664+
description: '操作人用户名,openapi外部调用时需传入'
1665+
required: false
16641666
schema:
16651667
type: string
16661668
responses:
@@ -3599,6 +3601,29 @@ paths:
35993601
allOf:
36003602
- $ref: '#/components/schemas/SuccessEmptyResponse'
36013603
headers: {}
3604+
/openapi/v1/envs:
3605+
get:
3606+
summary: 获取所有环境
3607+
operationId: getEnvs
3608+
deprecated: false
3609+
description: GET /openapi/v1/envs
3610+
tags:
3611+
- Environment Management
3612+
responses:
3613+
'200':
3614+
description: 成功获取环境列表
3615+
content:
3616+
application/json:
3617+
schema:
3618+
type: array
3619+
items:
3620+
type: string
3621+
example:
3622+
- 'DEV'
3623+
- 'FAT'
3624+
- 'UAT'
3625+
- 'PRO'
3626+
headers: {}
36023627
components:
36033628
securitySchemes:
36043629
ApiKeyAuth:
@@ -3742,6 +3767,17 @@ components:
37423767
appId:
37433768
type: string
37443769
description: 所属应用的唯一标识符
3770+
id:
3771+
type: integer
3772+
description: 集群的唯一标识符
3773+
format: int64
3774+
parentClusterId:
3775+
type: integer
3776+
description: 父集群的ID
3777+
format: int64
3778+
comment:
3779+
type: string
3780+
description: 集群的备注说明
37453781
description: Apollo集群信息数据传输对象,表示应用在特定环境下的集群配置
37463782
MapString:
37473783
type: object

java-client/.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ build.gradle
88
build.sbt
99
docs/AppManagementApi.md
1010
docs/ClusterManagementApi.md
11+
docs/EnvironmentManagementApi.md
1112
docs/InstanceManagementApi.md
1213
docs/ItemManagementApi.md
1314
docs/KVEntity.md
@@ -66,6 +67,7 @@ src/main/java/org/openapitools/client/ServerVariable.java
6667
src/main/java/org/openapitools/client/StringUtil.java
6768
src/main/java/org/openapitools/client/api/AppManagementApi.java
6869
src/main/java/org/openapitools/client/api/ClusterManagementApi.java
70+
src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java
6971
src/main/java/org/openapitools/client/api/InstanceManagementApi.java
7072
src/main/java/org/openapitools/client/api/ItemManagementApi.java
7173
src/main/java/org/openapitools/client/api/NamespaceBranchManagementApi.java
@@ -107,6 +109,7 @@ src/main/java/org/openapitools/client/model/OpenReleaseDTO.java
107109
src/main/java/org/openapitools/client/model/RichResponseEntity.java
108110
src/test/java/org/openapitools/client/api/AppManagementApiTest.java
109111
src/test/java/org/openapitools/client/api/ClusterManagementApiTest.java
112+
src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java
110113
src/test/java/org/openapitools/client/api/InstanceManagementApiTest.java
111114
src/test/java/org/openapitools/client/api/ItemManagementApiTest.java
112115
src/test/java/org/openapitools/client/api/NamespaceBranchManagementApiTest.java

java-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ Class | Method | HTTP request | Description
149149
*ClusterManagementApi* | [**createCluster**](docs/ClusterManagementApi.md#createCluster) | **POST** /openapi/v1/envs/{env}/apps/{appId}/clusters | 创建集群 (original openapi)
150150
*ClusterManagementApi* | [**deleteCluster**](docs/ClusterManagementApi.md#deleteCluster) | **DELETE** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} | 删除集群 (new added)
151151
*ClusterManagementApi* | [**getCluster**](docs/ClusterManagementApi.md#getCluster) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} | 获取指定集群信息 (original openapi)
152+
*EnvironmentManagementApi* | [**getEnvs**](docs/EnvironmentManagementApi.md#getEnvs) | **GET** /openapi/v1/envs | 获取所有环境
152153
*InstanceManagementApi* | [**getByRelease**](docs/InstanceManagementApi.md#getByRelease) | **GET** /openapi/v1/envs/{env}/releases/{releaseId}/instances | 根据发布版本查询实例(支持分页) (new added)
153154
*InstanceManagementApi* | [**getByReleasesNotIn**](docs/InstanceManagementApi.md#getByReleasesNotIn) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in | 查询不在指定发布版本中的实例 (new added)
154155
*InstanceManagementApi* | [**getInstanceCountByNamespace**](docs/InstanceManagementApi.md#getInstanceCountByNamespace) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances | 获取命名空间下的实例数量 (original openapi)

java-client/api/openapi.yaml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ tags:
3939
name: Instance Management
4040
- description: 组织管理相关接口,包括组织信息查询等功能
4141
name: Organization Management
42+
- description: 环境管理相关接口,包括环境查询等功能
43+
name: Environment Management
4244
paths:
4345
/openapi/v1/apps:
4446
get:
@@ -1782,11 +1784,11 @@ paths:
17821784
schema:
17831785
type: string
17841786
style: simple
1785-
- description: 操作人用户名
1787+
- description: 操作人用户名,openapi外部调用时需传入
17861788
explode: true
17871789
in: query
17881790
name: operator
1789-
required: true
1791+
required: false
17901792
schema:
17911793
type: string
17921794
style: form
@@ -4039,6 +4041,29 @@ paths:
40394041
- Namespace Branch Management
40404042
x-content-type: application/json
40414043
x-accepts: application/json
4044+
/openapi/v1/envs:
4045+
get:
4046+
deprecated: false
4047+
description: GET /openapi/v1/envs
4048+
operationId: getEnvs
4049+
responses:
4050+
"200":
4051+
content:
4052+
application/json:
4053+
example:
4054+
- DEV
4055+
- FAT
4056+
- UAT
4057+
- PRO
4058+
schema:
4059+
items:
4060+
type: string
4061+
type: array
4062+
description: 成功获取环境列表
4063+
summary: 获取所有环境
4064+
tags:
4065+
- Environment Management
4066+
x-accepts: application/json
40424067
components:
40434068
schemas:
40444069
OpenAppDTO:
@@ -4205,6 +4230,9 @@ components:
42054230
appId: appId
42064231
dataChangeCreatedBy: dataChangeCreatedBy
42074232
name: name
4233+
parentClusterId: 6
4234+
comment: comment
4235+
id: 0
42084236
dataChangeLastModifiedTime: 2025-09-29T12:34:56Z
42094237
properties:
42104238
dataChangeCreatedBy:
@@ -4227,6 +4255,17 @@ components:
42274255
appId:
42284256
description: 所属应用的唯一标识符
42294257
type: string
4258+
id:
4259+
description: 集群的唯一标识符
4260+
format: int64
4261+
type: integer
4262+
parentClusterId:
4263+
description: 父集群的ID
4264+
format: int64
4265+
type: integer
4266+
comment:
4267+
description: 集群的备注说明
4268+
type: string
42304269
type: object
42314270
MapString:
42324271
additionalProperties:

java-client/docs/ClusterManagementApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public class Example {
117117
String env = "env_example"; // String |
118118
String appId = "appId_example"; // String |
119119
String clusterName = "clusterName_example"; // String |
120-
String operator = "operator_example"; // String | 操作人用户名
120+
String operator = "operator_example"; // String | 操作人用户名,openapi外部调用时需传入
121121
try {
122122
Object result = apiInstance.deleteCluster(env, appId, clusterName, operator);
123123
System.out.println(result);
@@ -139,7 +139,7 @@ public class Example {
139139
| **env** | **String**| | |
140140
| **appId** | **String**| | |
141141
| **clusterName** | **String**| | |
142-
| **operator** | **String**| 操作人用户名 | |
142+
| **operator** | **String**| 操作人用户名,openapi外部调用时需传入 | [optional] |
143143

144144
### Return type
145145

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# EnvironmentManagementApi
2+
3+
All URIs are relative to *http://localhost*
4+
5+
| Method | HTTP request | Description |
6+
|------------- | ------------- | -------------|
7+
| [**getEnvs**](EnvironmentManagementApi.md#getEnvs) | **GET** /openapi/v1/envs | 获取所有环境 |
8+
9+
10+
<a id="getEnvs"></a>
11+
# **getEnvs**
12+
> List&lt;String&gt; getEnvs()
13+
14+
获取所有环境
15+
16+
GET /openapi/v1/envs
17+
18+
### Example
19+
```java
20+
// Import classes:
21+
import org.openapitools.client.ApiClient;
22+
import org.openapitools.client.ApiException;
23+
import org.openapitools.client.Configuration;
24+
import org.openapitools.client.auth.*;
25+
import org.openapitools.client.models.*;
26+
import org.openapitools.client.api.EnvironmentManagementApi;
27+
28+
public class Example {
29+
public static void main(String[] args) {
30+
ApiClient defaultClient = Configuration.getDefaultApiClient();
31+
defaultClient.setBasePath("http://localhost");
32+
33+
// Configure API key authorization: ApiKeyAuth
34+
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
35+
ApiKeyAuth.setApiKey("YOUR API KEY");
36+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
37+
//ApiKeyAuth.setApiKeyPrefix("Token");
38+
39+
EnvironmentManagementApi apiInstance = new EnvironmentManagementApi(defaultClient);
40+
try {
41+
List<String> result = apiInstance.getEnvs();
42+
System.out.println(result);
43+
} catch (ApiException e) {
44+
System.err.println("Exception when calling EnvironmentManagementApi#getEnvs");
45+
System.err.println("Status code: " + e.getCode());
46+
System.err.println("Reason: " + e.getResponseBody());
47+
System.err.println("Response headers: " + e.getResponseHeaders());
48+
e.printStackTrace();
49+
}
50+
}
51+
}
52+
```
53+
54+
### Parameters
55+
This endpoint does not need any parameter.
56+
57+
### Return type
58+
59+
**List&lt;String&gt;**
60+
61+
### Authorization
62+
63+
[ApiKeyAuth](../README.md#ApiKeyAuth)
64+
65+
### HTTP request headers
66+
67+
- **Content-Type**: Not defined
68+
- **Accept**: application/json
69+
70+
### HTTP response details
71+
| Status code | Description | Response headers |
72+
|-------------|-------------|------------------|
73+
| **200** | 成功获取环境列表 | - |

java-client/docs/OpenClusterDTO.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ Apollo集群信息数据传输对象,表示应用在特定环境下的集群
1414
|**dataChangeLastModifiedTime** | **String** | 集群最后修改时间,ISO 8601格式的时间戳 | [optional] |
1515
|**name** | **String** | 集群名称,在同一应用和环境下唯一标识一个集群 | [optional] |
1616
|**appId** | **String** | 所属应用的唯一标识符 | [optional] |
17+
|**id** | **Long** | 集群的唯一标识符 | [optional] |
18+
|**parentClusterId** | **Long** | 父集群的ID | [optional] |
19+
|**comment** | **String** | 集群的备注说明 | [optional] |

java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public okhttp3.Call createClusterAsync(String appId, String env, OpenClusterDTO
229229
* @param env (required)
230230
* @param appId (required)
231231
* @param clusterName (required)
232-
* @param operator 操作人用户名 (required)
232+
* @param operator 操作人用户名,openapi外部调用时需传入 (optional)
233233
* @param _callback Callback for upload/download progress
234234
* @return Call to execute
235235
* @throws ApiException If fail to serialize the request body object
@@ -310,11 +310,6 @@ private okhttp3.Call deleteClusterValidateBeforeCall(String env, String appId, S
310310
throw new ApiException("Missing the required parameter 'clusterName' when calling deleteCluster(Async)");
311311
}
312312

313-
// verify the required parameter 'operator' is set
314-
if (operator == null) {
315-
throw new ApiException("Missing the required parameter 'operator' when calling deleteCluster(Async)");
316-
}
317-
318313
return deleteClusterCall(env, appId, clusterName, operator, _callback);
319314

320315
}
@@ -325,7 +320,7 @@ private okhttp3.Call deleteClusterValidateBeforeCall(String env, String appId, S
325320
* @param env (required)
326321
* @param appId (required)
327322
* @param clusterName (required)
328-
* @param operator 操作人用户名 (required)
323+
* @param operator 操作人用户名,openapi外部调用时需传入 (optional)
329324
* @return Object
330325
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
331326
* @http.response.details
@@ -348,7 +343,7 @@ public Object deleteCluster(String env, String appId, String clusterName, String
348343
* @param env (required)
349344
* @param appId (required)
350345
* @param clusterName (required)
351-
* @param operator 操作人用户名 (required)
346+
* @param operator 操作人用户名,openapi外部调用时需传入 (optional)
352347
* @return ApiResponse&lt;Object&gt;
353348
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
354349
* @http.response.details
@@ -372,7 +367,7 @@ public ApiResponse<Object> deleteClusterWithHttpInfo(String env, String appId, S
372367
* @param env (required)
373368
* @param appId (required)
374369
* @param clusterName (required)
375-
* @param operator 操作人用户名 (required)
370+
* @param operator 操作人用户名,openapi外部调用时需传入 (optional)
376371
* @param _callback The callback to be executed when the API call finishes
377372
* @return The request call
378373
* @throws ApiException If fail to process the API call, e.g. serializing the request body object

0 commit comments

Comments
 (0)