From feac274e7ec96fc357f032197e0d175492ea4f4f Mon Sep 17 00:00:00 2001 From: tacklequestions Date: Sun, 26 Oct 2025 15:21:50 +0800 Subject: [PATCH] feat: add env management, fix missing operator in portal call, add fields to OpenClusterDTO --- apollo-openapi.yaml | 40 ++- java-client/.openapi-generator/FILES | 3 + java-client/README.md | 1 + java-client/api/openapi.yaml | 43 ++- java-client/docs/ClusterManagementApi.md | 4 +- java-client/docs/EnvironmentManagementApi.md | 73 +++++ java-client/docs/OpenClusterDTO.md | 3 + .../client/api/ClusterManagementApi.java | 13 +- .../client/api/EnvironmentManagementApi.java | 188 +++++++++++++ .../client/model/OpenClusterDTO.java | 91 +++++- .../api/EnvironmentManagementApiTest.java | 46 +++ .../client/model/OpenClusterDTOTest.java | 24 ++ python/.openapi-generator/FILES | 2 + python/README.md | 2 + python/apollo_openapi/apis/path_to_api.py | 3 + .../apis/paths/openapi_v1_envs.py | 7 + python/apollo_openapi/apis/tag_to_api.py | 3 + python/apollo_openapi/apis/tags/__init__.py | 1 + .../apis/tags/environment_management_api.py | 23 ++ .../apollo_openapi/model/open_cluster_dto.py | 34 ++- .../apollo_openapi/model/open_cluster_dto.pyi | 34 ++- python/apollo_openapi/paths/__init__.py | 1 + .../paths/openapi_v1_envs/__init__.py | 7 + .../paths/openapi_v1_envs/get.py | 261 ++++++++++++++++++ .../paths/openapi_v1_envs/get.pyi | 253 +++++++++++++++++ .../delete.py | 3 +- .../delete.pyi | 3 +- python/docs/apis/tags/ClusterManagementApi.md | 25 +- .../apis/tags/EnvironmentManagementApi.md | 87 ++++++ python/docs/models/OpenClusterDTO.md | 3 + .../test_openapi_v1_envs/__init__.py | 1 + .../test_openapi_v1_envs/test_get.py | 41 +++ rust/docs/OpenClusterDto.md | 3 + rust/src/models/open_cluster_dto.rs | 12 + spring-boot2/.openapi-generator/FILES | 3 + .../server/api/ClusterManagementApi.java | 4 +- .../api/ClusterManagementApiDelegate.java | 6 +- .../server/api/EnvironmentManagementApi.java | 70 +++++ .../EnvironmentManagementApiController.java | 43 +++ .../api/EnvironmentManagementApiDelegate.java | 46 +++ .../openapi/server/model/OpenClusterDTO.java | 76 ++++- spring-boot2/src/main/resources/openapi.yaml | 45 ++- typescript/.openapi-generator/FILES | 1 + typescript/src/apis/ClusterManagementApi.ts | 6 +- .../src/apis/EnvironmentManagementApi.ts | 55 ++++ typescript/src/apis/index.ts | 1 + typescript/src/models/OpenClusterDTO.ts | 24 ++ 47 files changed, 1677 insertions(+), 41 deletions(-) create mode 100644 java-client/docs/EnvironmentManagementApi.md create mode 100644 java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java create mode 100644 java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java create mode 100644 python/apollo_openapi/apis/paths/openapi_v1_envs.py create mode 100644 python/apollo_openapi/apis/tags/environment_management_api.py create mode 100644 python/apollo_openapi/paths/openapi_v1_envs/__init__.py create mode 100644 python/apollo_openapi/paths/openapi_v1_envs/get.py create mode 100644 python/apollo_openapi/paths/openapi_v1_envs/get.pyi create mode 100644 python/docs/apis/tags/EnvironmentManagementApi.md create mode 100644 python/test/test_paths/test_openapi_v1_envs/__init__.py create mode 100644 python/test/test_paths/test_openapi_v1_envs/test_get.py create mode 100644 spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java create mode 100644 spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java create mode 100644 spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java create mode 100644 typescript/src/apis/EnvironmentManagementApi.ts diff --git a/apollo-openapi.yaml b/apollo-openapi.yaml index 9dc2479e..7fba16d2 100644 --- a/apollo-openapi.yaml +++ b/apollo-openapi.yaml @@ -38,6 +38,8 @@ tags: description: 实例管理相关接口,包括实例查询、配置生效状态等功能 - name: Organization Management description: 组织管理相关接口,包括组织信息查询等功能 + - name: Environment Management + description: 环境管理相关接口,包括环境查询等功能 paths: /openapi/v1/apps: post: @@ -1659,8 +1661,8 @@ paths: type: string - name: operator in: query - description: '操作人用户名' - required: true + description: '操作人用户名,openapi外部调用时需传入' + required: false schema: type: string responses: @@ -3599,6 +3601,29 @@ paths: allOf: - $ref: '#/components/schemas/SuccessEmptyResponse' headers: {} + /openapi/v1/envs: + get: + summary: 获取所有环境 + operationId: getEnvs + deprecated: false + description: GET /openapi/v1/envs + tags: + - Environment Management + responses: + '200': + description: 成功获取环境列表 + content: + application/json: + schema: + type: array + items: + type: string + example: + - 'DEV' + - 'FAT' + - 'UAT' + - 'PRO' + headers: {} components: securitySchemes: ApiKeyAuth: @@ -3742,6 +3767,17 @@ components: appId: type: string description: 所属应用的唯一标识符 + id: + type: integer + description: 集群的唯一标识符 + format: int64 + parentClusterId: + type: integer + description: 父集群的ID + format: int64 + comment: + type: string + description: 集群的备注说明 description: Apollo集群信息数据传输对象,表示应用在特定环境下的集群配置 MapString: type: object diff --git a/java-client/.openapi-generator/FILES b/java-client/.openapi-generator/FILES index 42d3869a..cd19a453 100644 --- a/java-client/.openapi-generator/FILES +++ b/java-client/.openapi-generator/FILES @@ -8,6 +8,7 @@ build.gradle build.sbt docs/AppManagementApi.md docs/ClusterManagementApi.md +docs/EnvironmentManagementApi.md docs/InstanceManagementApi.md docs/ItemManagementApi.md docs/KVEntity.md @@ -66,6 +67,7 @@ src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/StringUtil.java src/main/java/org/openapitools/client/api/AppManagementApi.java src/main/java/org/openapitools/client/api/ClusterManagementApi.java +src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java src/main/java/org/openapitools/client/api/InstanceManagementApi.java src/main/java/org/openapitools/client/api/ItemManagementApi.java src/main/java/org/openapitools/client/api/NamespaceBranchManagementApi.java @@ -107,6 +109,7 @@ src/main/java/org/openapitools/client/model/OpenReleaseDTO.java src/main/java/org/openapitools/client/model/RichResponseEntity.java src/test/java/org/openapitools/client/api/AppManagementApiTest.java src/test/java/org/openapitools/client/api/ClusterManagementApiTest.java +src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java src/test/java/org/openapitools/client/api/InstanceManagementApiTest.java src/test/java/org/openapitools/client/api/ItemManagementApiTest.java src/test/java/org/openapitools/client/api/NamespaceBranchManagementApiTest.java diff --git a/java-client/README.md b/java-client/README.md index a815e7b8..01e71d3b 100644 --- a/java-client/README.md +++ b/java-client/README.md @@ -149,6 +149,7 @@ Class | Method | HTTP request | Description *ClusterManagementApi* | [**createCluster**](docs/ClusterManagementApi.md#createCluster) | **POST** /openapi/v1/envs/{env}/apps/{appId}/clusters | 创建集群 (original openapi) *ClusterManagementApi* | [**deleteCluster**](docs/ClusterManagementApi.md#deleteCluster) | **DELETE** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} | 删除集群 (new added) *ClusterManagementApi* | [**getCluster**](docs/ClusterManagementApi.md#getCluster) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} | 获取指定集群信息 (original openapi) +*EnvironmentManagementApi* | [**getEnvs**](docs/EnvironmentManagementApi.md#getEnvs) | **GET** /openapi/v1/envs | 获取所有环境 *InstanceManagementApi* | [**getByRelease**](docs/InstanceManagementApi.md#getByRelease) | **GET** /openapi/v1/envs/{env}/releases/{releaseId}/instances | 根据发布版本查询实例(支持分页) (new added) *InstanceManagementApi* | [**getByReleasesNotIn**](docs/InstanceManagementApi.md#getByReleasesNotIn) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in | 查询不在指定发布版本中的实例 (new added) *InstanceManagementApi* | [**getInstanceCountByNamespace**](docs/InstanceManagementApi.md#getInstanceCountByNamespace) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances | 获取命名空间下的实例数量 (original openapi) diff --git a/java-client/api/openapi.yaml b/java-client/api/openapi.yaml index 0d4cccf7..b0d99056 100644 --- a/java-client/api/openapi.yaml +++ b/java-client/api/openapi.yaml @@ -39,6 +39,8 @@ tags: name: Instance Management - description: 组织管理相关接口,包括组织信息查询等功能 name: Organization Management +- description: 环境管理相关接口,包括环境查询等功能 + name: Environment Management paths: /openapi/v1/apps: get: @@ -1782,11 +1784,11 @@ paths: schema: type: string style: simple - - description: 操作人用户名 + - description: 操作人用户名,openapi外部调用时需传入 explode: true in: query name: operator - required: true + required: false schema: type: string style: form @@ -4039,6 +4041,29 @@ paths: - Namespace Branch Management x-content-type: application/json x-accepts: application/json + /openapi/v1/envs: + get: + deprecated: false + description: GET /openapi/v1/envs + operationId: getEnvs + responses: + "200": + content: + application/json: + example: + - DEV + - FAT + - UAT + - PRO + schema: + items: + type: string + type: array + description: 成功获取环境列表 + summary: 获取所有环境 + tags: + - Environment Management + x-accepts: application/json components: schemas: OpenAppDTO: @@ -4205,6 +4230,9 @@ components: appId: appId dataChangeCreatedBy: dataChangeCreatedBy name: name + parentClusterId: 6 + comment: comment + id: 0 dataChangeLastModifiedTime: 2025-09-29T12:34:56Z properties: dataChangeCreatedBy: @@ -4227,6 +4255,17 @@ components: appId: description: 所属应用的唯一标识符 type: string + id: + description: 集群的唯一标识符 + format: int64 + type: integer + parentClusterId: + description: 父集群的ID + format: int64 + type: integer + comment: + description: 集群的备注说明 + type: string type: object MapString: additionalProperties: diff --git a/java-client/docs/ClusterManagementApi.md b/java-client/docs/ClusterManagementApi.md index 96f8b509..ad4af3d6 100644 --- a/java-client/docs/ClusterManagementApi.md +++ b/java-client/docs/ClusterManagementApi.md @@ -117,7 +117,7 @@ public class Example { String env = "env_example"; // String | String appId = "appId_example"; // String | String clusterName = "clusterName_example"; // String | - String operator = "operator_example"; // String | 操作人用户名 + String operator = "operator_example"; // String | 操作人用户名,openapi外部调用时需传入 try { Object result = apiInstance.deleteCluster(env, appId, clusterName, operator); System.out.println(result); @@ -139,7 +139,7 @@ public class Example { | **env** | **String**| | | | **appId** | **String**| | | | **clusterName** | **String**| | | -| **operator** | **String**| 操作人用户名 | | +| **operator** | **String**| 操作人用户名,openapi外部调用时需传入 | [optional] | ### Return type diff --git a/java-client/docs/EnvironmentManagementApi.md b/java-client/docs/EnvironmentManagementApi.md new file mode 100644 index 00000000..80a39e78 --- /dev/null +++ b/java-client/docs/EnvironmentManagementApi.md @@ -0,0 +1,73 @@ +# EnvironmentManagementApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getEnvs**](EnvironmentManagementApi.md#getEnvs) | **GET** /openapi/v1/envs | 获取所有环境 | + + + +# **getEnvs** +> List<String> getEnvs() + +获取所有环境 + +GET /openapi/v1/envs + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.EnvironmentManagementApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure API key authorization: ApiKeyAuth + ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth"); + ApiKeyAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //ApiKeyAuth.setApiKeyPrefix("Token"); + + EnvironmentManagementApi apiInstance = new EnvironmentManagementApi(defaultClient); + try { + List result = apiInstance.getEnvs(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EnvironmentManagementApi#getEnvs"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**List<String>** + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | 成功获取环境列表 | - | diff --git a/java-client/docs/OpenClusterDTO.md b/java-client/docs/OpenClusterDTO.md index bd27f6ed..3d30b269 100644 --- a/java-client/docs/OpenClusterDTO.md +++ b/java-client/docs/OpenClusterDTO.md @@ -14,3 +14,6 @@ Apollo集群信息数据传输对象,表示应用在特定环境下的集群 |**dataChangeLastModifiedTime** | **String** | 集群最后修改时间,ISO 8601格式的时间戳 | [optional] | |**name** | **String** | 集群名称,在同一应用和环境下唯一标识一个集群 | [optional] | |**appId** | **String** | 所属应用的唯一标识符 | [optional] | +|**id** | **Long** | 集群的唯一标识符 | [optional] | +|**parentClusterId** | **Long** | 父集群的ID | [optional] | +|**comment** | **String** | 集群的备注说明 | [optional] | diff --git a/java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java index 39c682e9..8cd9df66 100644 --- a/java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java @@ -229,7 +229,7 @@ public okhttp3.Call createClusterAsync(String appId, String env, OpenClusterDTO * @param env (required) * @param appId (required) * @param clusterName (required) - * @param operator 操作人用户名 (required) + * @param operator 操作人用户名,openapi外部调用时需传入 (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -310,11 +310,6 @@ private okhttp3.Call deleteClusterValidateBeforeCall(String env, String appId, S throw new ApiException("Missing the required parameter 'clusterName' when calling deleteCluster(Async)"); } - // verify the required parameter 'operator' is set - if (operator == null) { - throw new ApiException("Missing the required parameter 'operator' when calling deleteCluster(Async)"); - } - return deleteClusterCall(env, appId, clusterName, operator, _callback); } @@ -325,7 +320,7 @@ private okhttp3.Call deleteClusterValidateBeforeCall(String env, String appId, S * @param env (required) * @param appId (required) * @param clusterName (required) - * @param operator 操作人用户名 (required) + * @param operator 操作人用户名,openapi外部调用时需传入 (optional) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -348,7 +343,7 @@ public Object deleteCluster(String env, String appId, String clusterName, String * @param env (required) * @param appId (required) * @param clusterName (required) - * @param operator 操作人用户名 (required) + * @param operator 操作人用户名,openapi外部调用时需传入 (optional) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -372,7 +367,7 @@ public ApiResponse deleteClusterWithHttpInfo(String env, String appId, S * @param env (required) * @param appId (required) * @param clusterName (required) - * @param operator 操作人用户名 (required) + * @param operator 操作人用户名,openapi外部调用时需传入 (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object diff --git a/java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java new file mode 100644 index 00000000..f18c75df --- /dev/null +++ b/java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java @@ -0,0 +1,188 @@ +/* + * Apollo OpenAPI + *

Apollo配置中心OpenAPI接口文档

认证方式

所有 API 接口都需要通过 Authorization header 进行身份验证。

获取 Token 的方式:

  1. Portal 管理界面获取:登录 Portal → 管理员工具 → 开放平台授权管理 → 创建第三方应用,获取 Token。
  2. Token 格式Authorization: token_value
  3. Token 权限:按应用/环境/命名空间授予,建议不同用途分别创建。

使用示例

curl -X GET \"http://localhost:8070/openapi/v1/apps\" \\ -H \"Authorization: your_token_here\"
+ * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class EnvironmentManagementApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public EnvironmentManagementApi() { + this(Configuration.getDefaultApiClient()); + } + + public EnvironmentManagementApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getEnvs + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 成功获取环境列表 -
+ */ + public okhttp3.Call getEnvsCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/openapi/v1/envs"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEnvsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getEnvsCall(_callback); + + } + + /** + * 获取所有环境 + * GET /openapi/v1/envs + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 成功获取环境列表 -
+ */ + public List getEnvs() throws ApiException { + ApiResponse> localVarResp = getEnvsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * 获取所有环境 + * GET /openapi/v1/envs + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 成功获取环境列表 -
+ */ + public ApiResponse> getEnvsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getEnvsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 获取所有环境 (asynchronously) + * GET /openapi/v1/envs + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 成功获取环境列表 -
+ */ + public okhttp3.Call getEnvsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getEnvsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java index f1a9fc2b..c265aef8 100644 --- a/java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java +++ b/java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java @@ -76,6 +76,18 @@ public class OpenClusterDTO { @SerializedName(SERIALIZED_NAME_APP_ID) private String appId; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private Long id; + + public static final String SERIALIZED_NAME_PARENT_CLUSTER_ID = "parentClusterId"; + @SerializedName(SERIALIZED_NAME_PARENT_CLUSTER_ID) + private Long parentClusterId; + + public static final String SERIALIZED_NAME_COMMENT = "comment"; + @SerializedName(SERIALIZED_NAME_COMMENT) + private String comment; + public OpenClusterDTO() { } @@ -205,6 +217,69 @@ public void setAppId(String appId) { } + public OpenClusterDTO id(Long id) { + + this.id = id; + return this; + } + + /** + * 集群的唯一标识符 + * @return id + **/ + @javax.annotation.Nullable + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public OpenClusterDTO parentClusterId(Long parentClusterId) { + + this.parentClusterId = parentClusterId; + return this; + } + + /** + * 父集群的ID + * @return parentClusterId + **/ + @javax.annotation.Nullable + public Long getParentClusterId() { + return parentClusterId; + } + + + public void setParentClusterId(Long parentClusterId) { + this.parentClusterId = parentClusterId; + } + + + public OpenClusterDTO comment(String comment) { + + this.comment = comment; + return this; + } + + /** + * 集群的备注说明 + * @return comment + **/ + @javax.annotation.Nullable + public String getComment() { + return comment; + } + + + public void setComment(String comment) { + this.comment = comment; + } + + @Override public boolean equals(Object o) { @@ -220,12 +295,15 @@ public boolean equals(Object o) { Objects.equals(this.dataChangeCreatedTime, openClusterDTO.dataChangeCreatedTime) && Objects.equals(this.dataChangeLastModifiedTime, openClusterDTO.dataChangeLastModifiedTime) && Objects.equals(this.name, openClusterDTO.name) && - Objects.equals(this.appId, openClusterDTO.appId); + Objects.equals(this.appId, openClusterDTO.appId) && + Objects.equals(this.id, openClusterDTO.id) && + Objects.equals(this.parentClusterId, openClusterDTO.parentClusterId) && + Objects.equals(this.comment, openClusterDTO.comment); } @Override public int hashCode() { - return Objects.hash(dataChangeCreatedBy, dataChangeLastModifiedBy, dataChangeCreatedTime, dataChangeLastModifiedTime, name, appId); + return Objects.hash(dataChangeCreatedBy, dataChangeLastModifiedBy, dataChangeCreatedTime, dataChangeLastModifiedTime, name, appId, id, parentClusterId, comment); } @Override @@ -238,6 +316,9 @@ public String toString() { sb.append(" dataChangeLastModifiedTime: ").append(toIndentedString(dataChangeLastModifiedTime)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parentClusterId: ").append(toIndentedString(parentClusterId)).append("\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); sb.append("}"); return sb.toString(); } @@ -266,6 +347,9 @@ private String toIndentedString(Object o) { openapiFields.add("dataChangeLastModifiedTime"); openapiFields.add("name"); openapiFields.add("appId"); + openapiFields.add("id"); + openapiFields.add("parentClusterId"); + openapiFields.add("comment"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -309,6 +393,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if ((jsonObj.get("appId") != null && !jsonObj.get("appId").isJsonNull()) && !jsonObj.get("appId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `appId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("appId").toString())); } + if ((jsonObj.get("comment") != null && !jsonObj.get("comment").isJsonNull()) && !jsonObj.get("comment").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comment").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java new file mode 100644 index 00000000..d00073ea --- /dev/null +++ b/java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java @@ -0,0 +1,46 @@ +/* + * Apollo OpenAPI + *

Apollo配置中心OpenAPI接口文档

认证方式

所有 API 接口都需要通过 Authorization header 进行身份验证。

获取 Token 的方式:

  1. Portal 管理界面获取:登录 Portal → 管理员工具 → 开放平台授权管理 → 创建第三方应用,获取 Token。
  2. Token 格式Authorization: token_value
  3. Token 权限:按应用/环境/命名空间授予,建议不同用途分别创建。

使用示例

curl -X GET \"http://localhost:8070/openapi/v1/apps\" \\ -H \"Authorization: your_token_here\"
+ * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for EnvironmentManagementApi + */ +@Disabled +public class EnvironmentManagementApiTest { + + private final EnvironmentManagementApi api = new EnvironmentManagementApi(); + + /** + * 获取所有环境 + * + * GET /openapi/v1/envs + * + * @throws ApiException if the Api call fails + */ + @Test + public void getEnvsTest() throws ApiException { + List response = api.getEnvs(); + // TODO: test validations + } + +} diff --git a/java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java b/java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java index 59360271..24f10d44 100644 --- a/java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java +++ b/java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java @@ -85,4 +85,28 @@ public void appIdTest() { // TODO: test appId } + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'parentClusterId' + */ + @Test + public void parentClusterIdTest() { + // TODO: test parentClusterId + } + + /** + * Test the property 'comment' + */ + @Test + public void commentTest() { + // TODO: test comment + } + } diff --git a/python/.openapi-generator/FILES b/python/.openapi-generator/FILES index 604290a9..970aae7f 100644 --- a/python/.openapi-generator/FILES +++ b/python/.openapi-generator/FILES @@ -8,6 +8,7 @@ apollo_openapi/api_client.py apollo_openapi/apis/__init__.py apollo_openapi/apis/tags/app_management_api.py apollo_openapi/apis/tags/cluster_management_api.py +apollo_openapi/apis/tags/environment_management_api.py apollo_openapi/apis/tags/instance_management_api.py apollo_openapi/apis/tags/item_management_api.py apollo_openapi/apis/tags/namespace_branch_management_api.py @@ -84,6 +85,7 @@ apollo_openapi/rest.py apollo_openapi/schemas.py docs/apis/tags/AppManagementApi.md docs/apis/tags/ClusterManagementApi.md +docs/apis/tags/EnvironmentManagementApi.md docs/apis/tags/InstanceManagementApi.md docs/apis/tags/ItemManagementApi.md docs/apis/tags/NamespaceBranchManagementApi.md diff --git a/python/README.md b/python/README.md index f4777cde..56b8f29c 100644 --- a/python/README.md +++ b/python/README.md @@ -229,6 +229,7 @@ Class | Method | HTTP request | Description *ClusterManagementApi* | [**create_cluster**](docs/apis/tags/ClusterManagementApi.md#create_cluster) | **post** /openapi/v1/envs/{env}/apps/{appId}/clusters | 创建集群 (original openapi) *ClusterManagementApi* | [**delete_cluster**](docs/apis/tags/ClusterManagementApi.md#delete_cluster) | **delete** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} | 删除集群 (new added) *ClusterManagementApi* | [**get_cluster**](docs/apis/tags/ClusterManagementApi.md#get_cluster) | **get** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} | 获取指定集群信息 (original openapi) +*EnvironmentManagementApi* | [**get_envs**](docs/apis/tags/EnvironmentManagementApi.md#get_envs) | **get** /openapi/v1/envs | 获取所有环境 *InstanceManagementApi* | [**get_by_release**](docs/apis/tags/InstanceManagementApi.md#get_by_release) | **get** /openapi/v1/envs/{env}/releases/{releaseId}/instances | 根据发布版本查询实例(支持分页) (new added) *InstanceManagementApi* | [**get_by_releases_not_in**](docs/apis/tags/InstanceManagementApi.md#get_by_releases_not_in) | **get** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in | 查询不在指定发布版本中的实例 (new added) *InstanceManagementApi* | [**get_instance_count_by_namespace**](docs/apis/tags/InstanceManagementApi.md#get_instance_count_by_namespace) | **get** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances | 获取命名空间下的实例数量 (original openapi) @@ -332,6 +333,7 @@ Authentication schemes defined for the API: + ## Notes for Large OpenAPI documents If the OpenAPI document is large, imports in apollo_openapi.apis and apollo_openapi.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: diff --git a/python/apollo_openapi/apis/path_to_api.py b/python/apollo_openapi/apis/path_to_api.py index 73252942..b12a7eac 100644 --- a/python/apollo_openapi/apis/path_to_api.py +++ b/python/apollo_openapi/apis/path_to_api.py @@ -47,6 +47,7 @@ from apollo_openapi.apis.paths.openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_branches import OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranches from apollo_openapi.apis.paths.openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_branches_branch_name import OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranchesBranchName from apollo_openapi.apis.paths.openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_branches_branch_name_rules import OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranchesBranchNameRules +from apollo_openapi.apis.paths.openapi_v1_envs import OpenapiV1Envs PathToApi = typing_extensions.TypedDict( 'PathToApi', @@ -97,6 +98,7 @@ PathValues.OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES: OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranches, PathValues.OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES_BRANCH_NAME: OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranchesBranchName, PathValues.OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES_BRANCH_NAME_RULES: OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranchesBranchNameRules, + PathValues.OPENAPI_V1_ENVS: OpenapiV1Envs, } ) @@ -148,5 +150,6 @@ PathValues.OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES: OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranches, PathValues.OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES_BRANCH_NAME: OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranchesBranchName, PathValues.OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES_BRANCH_NAME_RULES: OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameBranchesBranchNameRules, + PathValues.OPENAPI_V1_ENVS: OpenapiV1Envs, } ) diff --git a/python/apollo_openapi/apis/paths/openapi_v1_envs.py b/python/apollo_openapi/apis/paths/openapi_v1_envs.py new file mode 100644 index 00000000..401dc928 --- /dev/null +++ b/python/apollo_openapi/apis/paths/openapi_v1_envs.py @@ -0,0 +1,7 @@ +from apollo_openapi.paths.openapi_v1_envs.get import ApiForget + + +class OpenapiV1Envs( + ApiForget, +): + pass diff --git a/python/apollo_openapi/apis/tag_to_api.py b/python/apollo_openapi/apis/tag_to_api.py index 396e7df3..08add916 100644 --- a/python/apollo_openapi/apis/tag_to_api.py +++ b/python/apollo_openapi/apis/tag_to_api.py @@ -9,6 +9,7 @@ from apollo_openapi.apis.tags.namespace_namespace_branch_management_api import NamespaceNamespaceBranchManagementApi from apollo_openapi.apis.tags.instance_management_api import InstanceManagementApi from apollo_openapi.apis.tags.organization_management_api import OrganizationManagementApi +from apollo_openapi.apis.tags.environment_management_api import EnvironmentManagementApi from apollo_openapi.apis.tags.namespace_branch_management_api import NamespaceBranchManagementApi TagToApi = typing_extensions.TypedDict( @@ -22,6 +23,7 @@ TagValues.NAMESPACE_NAMESPACE_BRANCH_MANAGEMENT: NamespaceNamespaceBranchManagementApi, TagValues.INSTANCE_MANAGEMENT: InstanceManagementApi, TagValues.ORGANIZATION_MANAGEMENT: OrganizationManagementApi, + TagValues.ENVIRONMENT_MANAGEMENT: EnvironmentManagementApi, TagValues.NAMESPACE_BRANCH_MANAGEMENT: NamespaceBranchManagementApi, } ) @@ -36,6 +38,7 @@ TagValues.NAMESPACE_NAMESPACE_BRANCH_MANAGEMENT: NamespaceNamespaceBranchManagementApi, TagValues.INSTANCE_MANAGEMENT: InstanceManagementApi, TagValues.ORGANIZATION_MANAGEMENT: OrganizationManagementApi, + TagValues.ENVIRONMENT_MANAGEMENT: EnvironmentManagementApi, TagValues.NAMESPACE_BRANCH_MANAGEMENT: NamespaceBranchManagementApi, } ) diff --git a/python/apollo_openapi/apis/tags/__init__.py b/python/apollo_openapi/apis/tags/__init__.py index d1a9aefd..eaf2d81b 100644 --- a/python/apollo_openapi/apis/tags/__init__.py +++ b/python/apollo_openapi/apis/tags/__init__.py @@ -14,4 +14,5 @@ class TagValues(str, enum.Enum): NAMESPACE_NAMESPACE_BRANCH_MANAGEMENT = "Namespace Namespace Branch Management" INSTANCE_MANAGEMENT = "Instance Management" ORGANIZATION_MANAGEMENT = "Organization Management" + ENVIRONMENT_MANAGEMENT = "Environment Management" NAMESPACE_BRANCH_MANAGEMENT = "Namespace Branch Management" diff --git a/python/apollo_openapi/apis/tags/environment_management_api.py b/python/apollo_openapi/apis/tags/environment_management_api.py new file mode 100644 index 00000000..5132f759 --- /dev/null +++ b/python/apollo_openapi/apis/tags/environment_management_api.py @@ -0,0 +1,23 @@ +# coding: utf-8 + +""" + Apollo OpenAPI + +

Apollo配置中心OpenAPI接口文档

认证方式

所有 API 接口都需要通过 Authorization header 进行身份验证。

获取 Token 的方式:

  1. Portal 管理界面获取:登录 Portal → 管理员工具 → 开放平台授权管理 → 创建第三方应用,获取 Token。
  2. Token 格式Authorization: token_value
  3. Token 权限:按应用/环境/命名空间授予,建议不同用途分别创建。

使用示例

curl -X GET \"http://localhost:8070/openapi/v1/apps\" \\ -H \"Authorization: your_token_here\"
# noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + +from apollo_openapi.paths.openapi_v1_envs.get import GetEnvs + + +class EnvironmentManagementApi( + GetEnvs, +): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + pass diff --git a/python/apollo_openapi/model/open_cluster_dto.py b/python/apollo_openapi/model/open_cluster_dto.py index f46ca779..152952b2 100644 --- a/python/apollo_openapi/model/open_cluster_dto.py +++ b/python/apollo_openapi/model/open_cluster_dto.py @@ -44,6 +44,9 @@ class properties: dataChangeLastModifiedTime = schemas.StrSchema name = schemas.StrSchema appId = schemas.StrSchema + id = schemas.Int64Schema + parentClusterId = schemas.Int64Schema + comment = schemas.StrSchema __annotations__ = { "dataChangeCreatedBy": dataChangeCreatedBy, "dataChangeLastModifiedBy": dataChangeLastModifiedBy, @@ -51,6 +54,9 @@ class properties: "dataChangeLastModifiedTime": dataChangeLastModifiedTime, "name": name, "appId": appId, + "id": id, + "parentClusterId": parentClusterId, + "comment": comment, } @typing.overload @@ -71,10 +77,19 @@ def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.prope @typing.overload def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["id"]) -> MetaOapg.properties.id: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["parentClusterId"]) -> MetaOapg.properties.parentClusterId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["comment"]) -> MetaOapg.properties.comment: ... + @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", "id", "parentClusterId", "comment", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -97,10 +112,19 @@ def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["appId"]) -> typing.Union[MetaOapg.properties.appId, schemas.Unset]: ... + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["parentClusterId"]) -> typing.Union[MetaOapg.properties.parentClusterId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["comment"]) -> typing.Union[MetaOapg.properties.comment, schemas.Unset]: ... + @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", "id", "parentClusterId", "comment", ], str]): return super().get_item_oapg(name) @@ -113,6 +137,9 @@ def __new__( dataChangeLastModifiedTime: typing.Union[MetaOapg.properties.dataChangeLastModifiedTime, str, schemas.Unset] = schemas.unset, name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + id: typing.Union[MetaOapg.properties.id, decimal.Decimal, int, schemas.Unset] = schemas.unset, + parentClusterId: typing.Union[MetaOapg.properties.parentClusterId, decimal.Decimal, int, schemas.Unset] = schemas.unset, + comment: typing.Union[MetaOapg.properties.comment, str, schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'OpenClusterDTO': @@ -125,6 +152,9 @@ def __new__( dataChangeLastModifiedTime=dataChangeLastModifiedTime, name=name, appId=appId, + id=id, + parentClusterId=parentClusterId, + comment=comment, _configuration=_configuration, **kwargs, ) diff --git a/python/apollo_openapi/model/open_cluster_dto.pyi b/python/apollo_openapi/model/open_cluster_dto.pyi index f46ca779..152952b2 100644 --- a/python/apollo_openapi/model/open_cluster_dto.pyi +++ b/python/apollo_openapi/model/open_cluster_dto.pyi @@ -44,6 +44,9 @@ class OpenClusterDTO( dataChangeLastModifiedTime = schemas.StrSchema name = schemas.StrSchema appId = schemas.StrSchema + id = schemas.Int64Schema + parentClusterId = schemas.Int64Schema + comment = schemas.StrSchema __annotations__ = { "dataChangeCreatedBy": dataChangeCreatedBy, "dataChangeLastModifiedBy": dataChangeLastModifiedBy, @@ -51,6 +54,9 @@ class OpenClusterDTO( "dataChangeLastModifiedTime": dataChangeLastModifiedTime, "name": name, "appId": appId, + "id": id, + "parentClusterId": parentClusterId, + "comment": comment, } @typing.overload @@ -71,10 +77,19 @@ class OpenClusterDTO( @typing.overload def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["id"]) -> MetaOapg.properties.id: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["parentClusterId"]) -> MetaOapg.properties.parentClusterId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["comment"]) -> MetaOapg.properties.comment: ... + @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", "id", "parentClusterId", "comment", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -97,10 +112,19 @@ class OpenClusterDTO( @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["appId"]) -> typing.Union[MetaOapg.properties.appId, schemas.Unset]: ... + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["parentClusterId"]) -> typing.Union[MetaOapg.properties.parentClusterId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["comment"]) -> typing.Union[MetaOapg.properties.comment, schemas.Unset]: ... + @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["dataChangeCreatedBy", "dataChangeLastModifiedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime", "name", "appId", "id", "parentClusterId", "comment", ], str]): return super().get_item_oapg(name) @@ -113,6 +137,9 @@ class OpenClusterDTO( dataChangeLastModifiedTime: typing.Union[MetaOapg.properties.dataChangeLastModifiedTime, str, schemas.Unset] = schemas.unset, name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + id: typing.Union[MetaOapg.properties.id, decimal.Decimal, int, schemas.Unset] = schemas.unset, + parentClusterId: typing.Union[MetaOapg.properties.parentClusterId, decimal.Decimal, int, schemas.Unset] = schemas.unset, + comment: typing.Union[MetaOapg.properties.comment, str, schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'OpenClusterDTO': @@ -125,6 +152,9 @@ class OpenClusterDTO( dataChangeLastModifiedTime=dataChangeLastModifiedTime, name=name, appId=appId, + id=id, + parentClusterId=parentClusterId, + comment=comment, _configuration=_configuration, **kwargs, ) diff --git a/python/apollo_openapi/paths/__init__.py b/python/apollo_openapi/paths/__init__.py index e441c486..4437ce9f 100644 --- a/python/apollo_openapi/paths/__init__.py +++ b/python/apollo_openapi/paths/__init__.py @@ -52,3 +52,4 @@ class PathValues(str, enum.Enum): OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES = "/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches" OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES_BRANCH_NAME = "/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}" OPENAPI_V1_ENVS_ENV_APPS_APP_ID_CLUSTERS_CLUSTER_NAME_NAMESPACES_NAMESPACE_NAME_BRANCHES_BRANCH_NAME_RULES = "/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/rules" + OPENAPI_V1_ENVS = "/openapi/v1/envs" diff --git a/python/apollo_openapi/paths/openapi_v1_envs/__init__.py b/python/apollo_openapi/paths/openapi_v1_envs/__init__.py new file mode 100644 index 00000000..8b1a6645 --- /dev/null +++ b/python/apollo_openapi/paths/openapi_v1_envs/__init__.py @@ -0,0 +1,7 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from apollo_openapi.paths.openapi_v1_envs import Api + +from apollo_openapi.paths import PathValues + +path = PathValues.OPENAPI_V1_ENVS diff --git a/python/apollo_openapi/paths/openapi_v1_envs/get.py b/python/apollo_openapi/paths/openapi_v1_envs/get.py new file mode 100644 index 00000000..834b579c --- /dev/null +++ b/python/apollo_openapi/paths/openapi_v1_envs/get.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from apollo_openapi import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from apollo_openapi import schemas # noqa: F401 + +from . import path + +_auth = [ + 'ApiKeyAuth', +] + + +class SchemaFor200ResponseBodyApplicationJson( + schemas.ListSchema +): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + _arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'SchemaFor200ResponseBodyApplicationJson': + return super().__new__( + cls, + _arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + +@dataclass +class ApiResponseFor200(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor200ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_200 = api_client.OpenApiResponse( + response_cls=ApiResponseFor200, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), + }, +) +_status_code_to_response = { + '200': _response_for_200, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_envs_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def _get_envs_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_envs_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_envs_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + 获取所有环境 + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException( + status=response.status, + reason=response.reason, + api_response=api_response + ) + + return api_response + + +class GetEnvs(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_envs( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get_envs( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_envs( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_envs( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_envs_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_envs_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/python/apollo_openapi/paths/openapi_v1_envs/get.pyi b/python/apollo_openapi/paths/openapi_v1_envs/get.pyi new file mode 100644 index 00000000..51500d6a --- /dev/null +++ b/python/apollo_openapi/paths/openapi_v1_envs/get.pyi @@ -0,0 +1,253 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from apollo_openapi import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from apollo_openapi import schemas # noqa: F401 + + + +class SchemaFor200ResponseBodyApplicationJson( + schemas.ListSchema +): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + _arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'SchemaFor200ResponseBodyApplicationJson': + return super().__new__( + cls, + _arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + +@dataclass +class ApiResponseFor200(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor200ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_200 = api_client.OpenApiResponse( + response_cls=ApiResponseFor200, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), + }, +) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_envs_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def _get_envs_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_envs_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_envs_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + 获取所有环境 + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException( + status=response.status, + reason=response.reason, + api_response=api_response + ) + + return api_response + + +class GetEnvs(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_envs( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get_envs( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_envs( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_envs( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_envs_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_envs_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py b/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py index ed36dc43..c4fec0c5 100644 --- a/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py +++ b/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py @@ -34,12 +34,12 @@ RequestRequiredQueryParams = typing_extensions.TypedDict( 'RequestRequiredQueryParams', { - 'operator': typing.Union[OperatorSchema, str, ], } ) RequestOptionalQueryParams = typing_extensions.TypedDict( 'RequestOptionalQueryParams', { + 'operator': typing.Union[OperatorSchema, str, ], }, total=False ) @@ -53,7 +53,6 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) name="operator", style=api_client.ParameterStyle.FORM, schema=OperatorSchema, - required=True, explode=True, ) # Path params diff --git a/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi b/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi index 3108827b..b90fede4 100644 --- a/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi +++ b/python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi @@ -32,12 +32,12 @@ OperatorSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( 'RequestRequiredQueryParams', { - 'operator': typing.Union[OperatorSchema, str, ], } ) RequestOptionalQueryParams = typing_extensions.TypedDict( 'RequestOptionalQueryParams', { + 'operator': typing.Union[OperatorSchema, str, ], }, total=False ) @@ -51,7 +51,6 @@ request_query_operator = api_client.QueryParameter( name="operator", style=api_client.ParameterStyle.FORM, schema=OperatorSchema, - required=True, explode=True, ) # Path params diff --git a/python/docs/apis/tags/ClusterManagementApi.md b/python/docs/apis/tags/ClusterManagementApi.md index af6f9e6f..3444585e 100644 --- a/python/docs/apis/tags/ClusterManagementApi.md +++ b/python/docs/apis/tags/ClusterManagementApi.md @@ -59,6 +59,9 @@ with apollo_openapi.ApiClient(configuration) as api_client: data_change_last_modified_time="2025-09-29T12:34:56Z", name="name_example", app_id="app_id_example", + id=1, + parent_cluster_id=1, + comment="comment_example", ) try: # 创建集群 (original openapi) @@ -182,7 +185,7 @@ Class Name | Input Type | Accessed Type | Description | Notes # **delete_cluster** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} delete_cluster(envapp_idcluster_nameoperator) +> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} delete_cluster(envapp_idcluster_name) 删除集群 (new added) @@ -223,6 +226,24 @@ with apollo_openapi.ApiClient(configuration) as api_client: 'appId': "appId_example", 'clusterName': "clusterName_example", } + query_params = { + } + try: + # 删除集群 (new added) + api_response = api_instance.delete_cluster( + path_params=path_params, + query_params=query_params, + ) + pprint(api_response) + except apollo_openapi.ApiException as e: + print("Exception when calling ClusterManagementApi->delete_cluster: %s\n" % e) + + # example passing only optional values + path_params = { + 'env': "env_example", + 'appId': "appId_example", + 'clusterName': "clusterName_example", + } query_params = { 'operator': "operator_example", } @@ -252,7 +273,7 @@ skip_deserialization | bool | default is False | when True, headers and body wil Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -operator | OperatorSchema | | +operator | OperatorSchema | | optional # OperatorSchema diff --git a/python/docs/apis/tags/EnvironmentManagementApi.md b/python/docs/apis/tags/EnvironmentManagementApi.md new file mode 100644 index 00000000..fac15bca --- /dev/null +++ b/python/docs/apis/tags/EnvironmentManagementApi.md @@ -0,0 +1,87 @@ + +# apollo_openapi.apis.tags.environment_management_api.EnvironmentManagementApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_envs**](#get_envs) | **get** /openapi/v1/envs | 获取所有环境 + +# **get_envs** + +> [str] get_envs() + +获取所有环境 + +GET /openapi/v1/envs + +### Example + +* Api Key Authentication (ApiKeyAuth): +```python +import apollo_openapi +from apollo_openapi.apis.tags import environment_management_api +from pprint import pprint +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = apollo_openapi.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: ApiKeyAuth +configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY' + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer' +# Enter a context with an instance of the API client +with apollo_openapi.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = environment_management_api.EnvironmentManagementApi(api_client) + + # example, this endpoint has no required or optional parameters + try: + # 获取所有环境 + api_response = api_instance.get_envs() + pprint(api_response) + except apollo_openapi.ApiException as e: + print("Exception when calling EnvironmentManagementApi->get_envs: %s\n" % e) +``` +### Parameters +This endpoint does not need any parameter. + +### Return Types, Responses + +Code | Class | Description +------------- | ------------- | ------------- +n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned +200 | [ApiResponseFor200](#get_envs.ApiResponseFor200) | 成功获取环境列表 + +#### get_envs.ApiResponseFor200 +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +response | urllib3.HTTPResponse | Raw response | +body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +headers | Unset | headers were not defined | + +# SchemaFor200ResponseBodyApplicationJson + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +list, tuple, | tuple, | | + +### Tuple Items +Class Name | Input Type | Accessed Type | Description | Notes +------------- | ------------- | ------------- | ------------- | ------------- +items | str, | str, | | + +### Authorization + +[ApiKeyAuth](../../../README.md#ApiKeyAuth) + +[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) diff --git a/python/docs/models/OpenClusterDTO.md b/python/docs/models/OpenClusterDTO.md index 2f3d9105..17933582 100644 --- a/python/docs/models/OpenClusterDTO.md +++ b/python/docs/models/OpenClusterDTO.md @@ -16,6 +16,9 @@ Key | Input Type | Accessed Type | Description | Notes **dataChangeLastModifiedTime** | str, | str, | 集群最后修改时间,ISO 8601格式的时间戳 | [optional] **name** | str, | str, | 集群名称,在同一应用和环境下唯一标识一个集群 | [optional] **appId** | str, | str, | 所属应用的唯一标识符 | [optional] +**id** | decimal.Decimal, int, | decimal.Decimal, | 集群的唯一标识符 | [optional] value must be a 64 bit integer +**parentClusterId** | decimal.Decimal, int, | decimal.Decimal, | 父集群的ID | [optional] value must be a 64 bit integer +**comment** | str, | str, | 集群的备注说明 | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/python/test/test_paths/test_openapi_v1_envs/__init__.py b/python/test/test_paths/test_openapi_v1_envs/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/python/test/test_paths/test_openapi_v1_envs/__init__.py @@ -0,0 +1 @@ + diff --git a/python/test/test_paths/test_openapi_v1_envs/test_get.py b/python/test/test_paths/test_openapi_v1_envs/test_get.py new file mode 100644 index 00000000..483125b4 --- /dev/null +++ b/python/test/test_paths/test_openapi_v1_envs/test_get.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +import unittest +from unittest.mock import patch + +import urllib3 + +import apollo_openapi +from apollo_openapi.paths.openapi_v1_envs import get # noqa: E501 +from apollo_openapi import configuration, schemas, api_client + +from .. import ApiTestMixin + + +class TestOpenapiV1Envs(ApiTestMixin, unittest.TestCase): + """ + OpenapiV1Envs unit test stubs + 获取所有环境 # noqa: E501 + """ + _configuration = configuration.Configuration() + + def setUp(self): + used_api_client = api_client.ApiClient(configuration=self._configuration) + self.api = get.ApiForget(api_client=used_api_client) # noqa: E501 + + def tearDown(self): + pass + + response_status = 200 + + + + +if __name__ == '__main__': + unittest.main() diff --git a/rust/docs/OpenClusterDto.md b/rust/docs/OpenClusterDto.md index 095dcb41..a39fa572 100644 --- a/rust/docs/OpenClusterDto.md +++ b/rust/docs/OpenClusterDto.md @@ -10,5 +10,8 @@ Name | Type | Description | Notes **data_change_last_modified_time** | Option<**String**> | 集群最后修改时间,ISO 8601格式的时间戳 | [optional] **name** | Option<**String**> | 集群名称,在同一应用和环境下唯一标识一个集群 | [optional] **app_id** | Option<**String**> | 所属应用的唯一标识符 | [optional] +**id** | Option<**i64**> | 集群的唯一标识符 | [optional] +**parent_cluster_id** | Option<**i64**> | 父集群的ID | [optional] +**comment** | Option<**String**> | 集群的备注说明 | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rust/src/models/open_cluster_dto.rs b/rust/src/models/open_cluster_dto.rs index 460c46cc..ab6f49dc 100644 --- a/rust/src/models/open_cluster_dto.rs +++ b/rust/src/models/open_cluster_dto.rs @@ -32,6 +32,15 @@ pub struct OpenClusterDto { /// 所属应用的唯一标识符 #[serde(rename = "appId", skip_serializing_if = "Option::is_none")] pub app_id: Option, + /// 集群的唯一标识符 + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// 父集群的ID + #[serde(rename = "parentClusterId", skip_serializing_if = "Option::is_none")] + pub parent_cluster_id: Option, + /// 集群的备注说明 + #[serde(rename = "comment", skip_serializing_if = "Option::is_none")] + pub comment: Option, } impl OpenClusterDto { @@ -44,6 +53,9 @@ impl OpenClusterDto { data_change_last_modified_time: None, name: None, app_id: None, + id: None, + parent_cluster_id: None, + comment: None, } } } diff --git a/spring-boot2/.openapi-generator/FILES b/spring-boot2/.openapi-generator/FILES index 46c06f31..f4da8b29 100644 --- a/spring-boot2/.openapi-generator/FILES +++ b/spring-boot2/.openapi-generator/FILES @@ -10,6 +10,9 @@ src/main/java/com/apollo/openapi/server/api/AppManagementApiDelegate.java src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java src/main/java/com/apollo/openapi/server/api/ClusterManagementApiController.java src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java +src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java +src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java +src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java src/main/java/com/apollo/openapi/server/api/InstanceManagementApi.java src/main/java/com/apollo/openapi/server/api/InstanceManagementApiController.java src/main/java/com/apollo/openapi/server/api/InstanceManagementApiDelegate.java diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java index 12f45604..9cce350d 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java @@ -91,7 +91,7 @@ default ResponseEntity createCluster( * @param env (required) * @param appId (required) * @param clusterName (required) - * @param operator 操作人用户名 (required) + * @param operator 操作人用户名,openapi外部调用时需传入 (optional) * @return 集群删除成功 (status code 200) * or 删除失败,集群可能包含配置 (status code 400) * or 权限不足 (status code 403) @@ -129,7 +129,7 @@ default ResponseEntity deleteCluster( @Parameter(name = "env", description = "", required = true, in = ParameterIn.PATH) @PathVariable("env") String env, @Parameter(name = "appId", description = "", required = true, in = ParameterIn.PATH) @PathVariable("appId") String appId, @Parameter(name = "clusterName", description = "", required = true, in = ParameterIn.PATH) @PathVariable("clusterName") String clusterName, - @NotNull @Parameter(name = "operator", description = "操作人用户名", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "operator", required = true) String operator + @Parameter(name = "operator", description = "操作人用户名,openapi外部调用时需传入", in = ParameterIn.QUERY) @Valid @RequestParam(value = "operator", required = false) String operator ) { return getDelegate().deleteCluster(env, appId, clusterName, operator); } diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java index b3a3945b..77927a87 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java @@ -42,7 +42,7 @@ default ResponseEntity createCluster(String appId, getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"dataChangeCreatedTime\" : \"2025-09-29T12:34:56Z\", \"dataChangeLastModifiedBy\" : \"dataChangeLastModifiedBy\", \"appId\" : \"appId\", \"dataChangeCreatedBy\" : \"dataChangeCreatedBy\", \"name\" : \"name\", \"dataChangeLastModifiedTime\" : \"2025-09-29T12:34:56Z\" }"; + String exampleString = "{ \"dataChangeCreatedTime\" : \"2025-09-29T12:34:56Z\", \"dataChangeLastModifiedBy\" : \"dataChangeLastModifiedBy\", \"appId\" : \"appId\", \"dataChangeCreatedBy\" : \"dataChangeCreatedBy\", \"name\" : \"name\", \"parentClusterId\" : 6, \"comment\" : \"comment\", \"id\" : 0, \"dataChangeLastModifiedTime\" : \"2025-09-29T12:34:56Z\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } @@ -59,7 +59,7 @@ default ResponseEntity createCluster(String appId, * @param env (required) * @param appId (required) * @param clusterName (required) - * @param operator 操作人用户名 (required) + * @param operator 操作人用户名,openapi外部调用时需传入 (optional) * @return 集群删除成功 (status code 200) * or 删除失败,集群可能包含配置 (status code 400) * or 权限不足 (status code 403) @@ -91,7 +91,7 @@ default ResponseEntity getCluster(String appId, getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"dataChangeCreatedTime\" : \"2025-09-29T12:34:56Z\", \"dataChangeLastModifiedBy\" : \"dataChangeLastModifiedBy\", \"appId\" : \"appId\", \"dataChangeCreatedBy\" : \"dataChangeCreatedBy\", \"name\" : \"name\", \"dataChangeLastModifiedTime\" : \"2025-09-29T12:34:56Z\" }"; + String exampleString = "{ \"dataChangeCreatedTime\" : \"2025-09-29T12:34:56Z\", \"dataChangeLastModifiedBy\" : \"dataChangeLastModifiedBy\", \"appId\" : \"appId\", \"dataChangeCreatedBy\" : \"dataChangeCreatedBy\", \"name\" : \"name\", \"parentClusterId\" : 6, \"comment\" : \"comment\", \"id\" : 0, \"dataChangeLastModifiedTime\" : \"2025-09-29T12:34:56Z\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java new file mode 100644 index 00000000..d1192014 --- /dev/null +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java @@ -0,0 +1,70 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.6.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package com.apollo.openapi.server.api; + +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +@Validated +@Tag(name = "Environment Management", description = "环境管理相关接口,包括环境查询等功能") +public interface EnvironmentManagementApi { + + default EnvironmentManagementApiDelegate getDelegate() { + return new EnvironmentManagementApiDelegate() {}; + } + + /** + * GET /openapi/v1/envs : 获取所有环境 + * GET /openapi/v1/envs + * + * @return 成功获取环境列表 (status code 200) + */ + @Operation( + operationId = "getEnvs", + summary = "获取所有环境", + description = "GET /openapi/v1/envs", + tags = { "Environment Management" }, + responses = { + @ApiResponse(responseCode = "200", description = "成功获取环境列表", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = String.class))) + }) + }, + security = { + @SecurityRequirement(name = "ApiKeyAuth") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/openapi/v1/envs", + produces = { "application/json" } + ) + default ResponseEntity> getEnvs( + + ) { + return getDelegate().getEnvs(); + } + +} diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java new file mode 100644 index 00000000..30623c1f --- /dev/null +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java @@ -0,0 +1,43 @@ +package com.apollo.openapi.server.api; + + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +@Controller +@RequestMapping("${openapi.apolloOpen.base-path:}") +public class EnvironmentManagementApiController implements EnvironmentManagementApi { + + private final EnvironmentManagementApiDelegate delegate; + + public EnvironmentManagementApiController(@Autowired(required = false) EnvironmentManagementApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new EnvironmentManagementApiDelegate() {}); + } + + @Override + public EnvironmentManagementApiDelegate getDelegate() { + return delegate; + } + +} diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java new file mode 100644 index 00000000..15d71730 --- /dev/null +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java @@ -0,0 +1,46 @@ +package com.apollo.openapi.server.api; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +/** + * A delegate to be called by the {@link EnvironmentManagementApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public interface EnvironmentManagementApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * GET /openapi/v1/envs : 获取所有环境 + * GET /openapi/v1/envs + * + * @return 成功获取环境列表 (status code 200) + * @see EnvironmentManagementApi#getEnvs + */ + default ResponseEntity> getEnvs() { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ \"\", \"\" ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java index e48f763a..a6e31543 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java @@ -34,6 +34,12 @@ public class OpenClusterDTO { private String appId; + private Long id; + + private Long parentClusterId; + + private String comment; + public OpenClusterDTO dataChangeCreatedBy(String dataChangeCreatedBy) { this.dataChangeCreatedBy = dataChangeCreatedBy; return this; @@ -154,6 +160,66 @@ public void setAppId(String appId) { this.appId = appId; } + public OpenClusterDTO id(Long id) { + this.id = id; + return this; + } + + /** + * 集群的唯一标识符 + * @return id + */ + + @Schema(name = "id", description = "集群的唯一标识符", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public OpenClusterDTO parentClusterId(Long parentClusterId) { + this.parentClusterId = parentClusterId; + return this; + } + + /** + * 父集群的ID + * @return parentClusterId + */ + + @Schema(name = "parentClusterId", description = "父集群的ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("parentClusterId") + public Long getParentClusterId() { + return parentClusterId; + } + + public void setParentClusterId(Long parentClusterId) { + this.parentClusterId = parentClusterId; + } + + public OpenClusterDTO comment(String comment) { + this.comment = comment; + return this; + } + + /** + * 集群的备注说明 + * @return comment + */ + + @Schema(name = "comment", description = "集群的备注说明", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("comment") + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -168,12 +234,15 @@ public boolean equals(Object o) { Objects.equals(this.dataChangeCreatedTime, openClusterDTO.dataChangeCreatedTime) && Objects.equals(this.dataChangeLastModifiedTime, openClusterDTO.dataChangeLastModifiedTime) && Objects.equals(this.name, openClusterDTO.name) && - Objects.equals(this.appId, openClusterDTO.appId); + Objects.equals(this.appId, openClusterDTO.appId) && + Objects.equals(this.id, openClusterDTO.id) && + Objects.equals(this.parentClusterId, openClusterDTO.parentClusterId) && + Objects.equals(this.comment, openClusterDTO.comment); } @Override public int hashCode() { - return Objects.hash(dataChangeCreatedBy, dataChangeLastModifiedBy, dataChangeCreatedTime, dataChangeLastModifiedTime, name, appId); + return Objects.hash(dataChangeCreatedBy, dataChangeLastModifiedBy, dataChangeCreatedTime, dataChangeLastModifiedTime, name, appId, id, parentClusterId, comment); } @Override @@ -186,6 +255,9 @@ public String toString() { sb.append(" dataChangeLastModifiedTime: ").append(toIndentedString(dataChangeLastModifiedTime)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parentClusterId: ").append(toIndentedString(parentClusterId)).append("\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/spring-boot2/src/main/resources/openapi.yaml b/spring-boot2/src/main/resources/openapi.yaml index 8e043b9f..1b385400 100644 --- a/spring-boot2/src/main/resources/openapi.yaml +++ b/spring-boot2/src/main/resources/openapi.yaml @@ -39,6 +39,8 @@ tags: name: Instance Management - description: 组织管理相关接口,包括组织信息查询等功能 name: Organization Management +- description: 环境管理相关接口,包括环境查询等功能 + name: Environment Management paths: /openapi/v1/apps: get: @@ -1832,11 +1834,11 @@ paths: schema: type: string style: simple - - description: 操作人用户名 + - description: 操作人用户名,openapi外部调用时需传入 explode: true in: query name: operator - required: true + required: false schema: type: string style: form @@ -4159,6 +4161,31 @@ paths: x-accepts: application/json x-tags: - tag: Namespace Branch Management + /openapi/v1/envs: + get: + deprecated: false + description: GET /openapi/v1/envs + operationId: getEnvs + responses: + "200": + content: + application/json: + example: + - DEV + - FAT + - UAT + - PRO + schema: + items: + type: string + type: array + description: 成功获取环境列表 + summary: 获取所有环境 + tags: + - Environment Management + x-accepts: application/json + x-tags: + - tag: Environment Management components: schemas: OpenAppDTO: @@ -4325,6 +4352,9 @@ components: appId: appId dataChangeCreatedBy: dataChangeCreatedBy name: name + parentClusterId: 6 + comment: comment + id: 0 dataChangeLastModifiedTime: 2025-09-29T12:34:56Z properties: dataChangeCreatedBy: @@ -4347,6 +4377,17 @@ components: appId: description: 所属应用的唯一标识符 type: string + id: + description: 集群的唯一标识符 + format: int64 + type: integer + parentClusterId: + description: 父集群的ID + format: int64 + type: integer + comment: + description: 集群的备注说明 + type: string type: object MapString: additionalProperties: diff --git a/typescript/.openapi-generator/FILES b/typescript/.openapi-generator/FILES index 6329030c..f0cd1755 100644 --- a/typescript/.openapi-generator/FILES +++ b/typescript/.openapi-generator/FILES @@ -5,6 +5,7 @@ README.md package.json src/apis/AppManagementApi.ts src/apis/ClusterManagementApi.ts +src/apis/EnvironmentManagementApi.ts src/apis/InstanceManagementApi.ts src/apis/ItemManagementApi.ts src/apis/NamespaceBranchManagementApi.ts diff --git a/typescript/src/apis/ClusterManagementApi.ts b/typescript/src/apis/ClusterManagementApi.ts index 741570fe..81c126ee 100644 --- a/typescript/src/apis/ClusterManagementApi.ts +++ b/typescript/src/apis/ClusterManagementApi.ts @@ -32,7 +32,7 @@ export interface DeleteClusterRequest { env: string; appId: string; clusterName: string; - operator: string; + operator?: string; } export interface GetClusterRequest { @@ -110,10 +110,6 @@ export class ClusterManagementApi extends runtime.BaseAPI { throw new runtime.RequiredError('clusterName','Required parameter requestParameters.clusterName was null or undefined when calling deleteCluster.'); } - if (requestParameters.operator === null || requestParameters.operator === undefined) { - throw new runtime.RequiredError('operator','Required parameter requestParameters.operator was null or undefined when calling deleteCluster.'); - } - const queryParameters: any = {}; if (requestParameters.operator !== undefined) { diff --git a/typescript/src/apis/EnvironmentManagementApi.ts b/typescript/src/apis/EnvironmentManagementApi.ts new file mode 100644 index 00000000..09d868fe --- /dev/null +++ b/typescript/src/apis/EnvironmentManagementApi.ts @@ -0,0 +1,55 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Apollo OpenAPI + *

Apollo配置中心OpenAPI接口文档

认证方式

所有 API 接口都需要通过 Authorization header 进行身份验证。

获取 Token 的方式:

  1. Portal 管理界面获取:登录 Portal → 管理员工具 → 开放平台授权管理 → 创建第三方应用,获取 Token。
  2. Token 格式Authorization: token_value
  3. Token 权限:按应用/环境/命名空间授予,建议不同用途分别创建。

使用示例

curl -X GET \"http://localhost:8070/openapi/v1/apps\" \\ -H \"Authorization: your_token_here\"
+ * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; + +/** + * + */ +export class EnvironmentManagementApi extends runtime.BaseAPI { + + /** + * GET /openapi/v1/envs + * 获取所有环境 + */ + async getEnvsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication + } + + const response = await this.request({ + path: `/openapi/v1/envs`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response); + } + + /** + * GET /openapi/v1/envs + * 获取所有环境 + */ + async getEnvs(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.getEnvsRaw(initOverrides); + return await response.value(); + } + +} diff --git a/typescript/src/apis/index.ts b/typescript/src/apis/index.ts index f0421300..0b892222 100644 --- a/typescript/src/apis/index.ts +++ b/typescript/src/apis/index.ts @@ -2,6 +2,7 @@ /* eslint-disable */ export * from './AppManagementApi'; export * from './ClusterManagementApi'; +export * from './EnvironmentManagementApi'; export * from './InstanceManagementApi'; export * from './ItemManagementApi'; export * from './NamespaceBranchManagementApi'; diff --git a/typescript/src/models/OpenClusterDTO.ts b/typescript/src/models/OpenClusterDTO.ts index 01568401..02e4fca5 100644 --- a/typescript/src/models/OpenClusterDTO.ts +++ b/typescript/src/models/OpenClusterDTO.ts @@ -55,6 +55,24 @@ export interface OpenClusterDTO { * @memberof OpenClusterDTO */ appId?: string; + /** + * 集群的唯一标识符 + * @type {number} + * @memberof OpenClusterDTO + */ + id?: number; + /** + * 父集群的ID + * @type {number} + * @memberof OpenClusterDTO + */ + parentClusterId?: number; + /** + * 集群的备注说明 + * @type {string} + * @memberof OpenClusterDTO + */ + comment?: string; } /** @@ -82,6 +100,9 @@ export function OpenClusterDTOFromJSONTyped(json: any, ignoreDiscriminator: bool 'dataChangeLastModifiedTime': !exists(json, 'dataChangeLastModifiedTime') ? undefined : json['dataChangeLastModifiedTime'], 'name': !exists(json, 'name') ? undefined : json['name'], 'appId': !exists(json, 'appId') ? undefined : json['appId'], + 'id': !exists(json, 'id') ? undefined : json['id'], + 'parentClusterId': !exists(json, 'parentClusterId') ? undefined : json['parentClusterId'], + 'comment': !exists(json, 'comment') ? undefined : json['comment'], }; } @@ -100,5 +121,8 @@ export function OpenClusterDTOToJSON(value?: OpenClusterDTO | null): any { 'dataChangeLastModifiedTime': value.dataChangeLastModifiedTime, 'name': value.name, 'appId': value.appId, + 'id': value.id, + 'parentClusterId': value.parentClusterId, + 'comment': value.comment, }; }