From 13f9651de933279c6c3736987dc256c1607d9469 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sat, 6 Jun 2026 12:39:02 +0800 Subject: [PATCH 1/4] feat: add user management consumer contract --- CHANGELOG.md | 9 + apollo-openapi.yaml | 155 +++++- generate.sh | 10 +- java-client/.openapi-generator/FILES | 12 +- java-client/README.md | 19 +- java-client/api/openapi.yaml | 186 ++++++- java-client/build.gradle | 2 +- java-client/build.sbt | 2 +- .../docs/OpenConsumerCreateRequestDTO.md | 18 + java-client/docs/OpenConsumerInfoDTO.md | 20 + java-client/docs/PortalManagementApi.md | 16 +- ...rManagementApi.md => UserManagementApi.md} | 132 ++++- java-client/pom.xml | 2 +- .../org/openapitools/client/ApiClient.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/JSON.java | 2 + .../client/api/PortalManagementApi.java | 60 ++- ...agementApi.java => UserManagementApi.java} | 233 ++++++-- .../model/OpenConsumerCreateRequestDTO.java | 442 +++++++++++++++ .../client/model/OpenConsumerInfoDTO.java | 504 ++++++++++++++++++ .../client/api/PortalManagementApiTest.java | 8 +- ...piTest.java => UserManagementApiTest.java} | 38 +- .../OpenConsumerCreateRequestDTOTest.java | 111 ++++ .../client/model/OpenConsumerInfoDTOTest.java | 127 +++++ python/.openapi-generator/FILES | 12 +- python/README.md | 15 +- python/apollo_openapi/__init__.py | 2 +- python/apollo_openapi/api_client.py | 2 +- python/apollo_openapi/apis/path_to_api.py | 3 + .../apis/paths/openapi_v1_users_user_id.py | 7 + python/apollo_openapi/apis/tag_to_api.py | 6 +- python/apollo_openapi/apis/tags/__init__.py | 2 +- ...nagement_api.py => user_management_api.py} | 4 +- python/apollo_openapi/configuration.py | 4 +- .../model/open_consumer_create_request_dto.py | 157 ++++++ .../open_consumer_create_request_dto.pyi | 157 ++++++ .../model/open_consumer_info_dto.py | 177 ++++++ .../model/open_consumer_info_dto.pyi | 177 ++++++ python/apollo_openapi/models/__init__.py | 2 + python/apollo_openapi/paths/__init__.py | 1 + .../paths/openapi_v1_consumers/get.py | 11 +- .../paths/openapi_v1_consumers/get.pyi | 11 +- .../paths/openapi_v1_consumers/post.py | 41 +- .../paths/openapi_v1_consumers/post.pyi | 41 +- .../paths/openapi_v1_users/get.py | 2 +- .../paths/openapi_v1_users/get.pyi | 2 +- .../paths/openapi_v1_users/post.py | 11 +- .../paths/openapi_v1_users/post.pyi | 11 +- .../paths/openapi_v1_users_enabled/put.py | 59 +- .../paths/openapi_v1_users_enabled/put.pyi | 59 +- .../openapi_v1_users_user_id/__init__.py | 7 + .../paths/openapi_v1_users_user_id/get.py | 336 ++++++++++++ .../paths/openapi_v1_users_user_id/get.pyi | 326 +++++++++++ python/docs/apis/tags/PortalManagementApi.md | 54 +- ...rManagementApi.md => UserManagementApi.md} | 238 +++++++-- .../models/OpenConsumerCreateRequestDTO.md | 22 + python/docs/models/OpenConsumerInfoDTO.md | 24 + python/setup.py | 2 +- .../test_open_consumer_create_request_dto.py | 24 + .../test_open_consumer_info_dto.py | 24 + .../test_openapi_v1_users/test_get.py | 2 +- .../test_openapi_v1_users/test_post.py | 2 +- .../test_openapi_v1_users_enabled/test_put.py | 2 +- .../test_openapi_v1_users_user_id/__init__.py | 1 + .../test_openapi_v1_users_user_id/test_get.py | 41 ++ rust/.openapi-generator/FILES | 4 + rust/Cargo.toml | 2 +- rust/README.md | 6 +- rust/docs/OpenConsumerCreateRequestDto.md | 17 + rust/docs/OpenConsumerInfoDto.md | 19 + rust/src/apis/configuration.rs | 2 +- rust/src/models/mod.rs | 4 + .../open_consumer_create_request_dto.rs | 58 ++ rust/src/models/open_consumer_info_dto.rs | 66 +++ spring-boot2/.openapi-generator/FILES | 8 +- spring-boot2/pom.xml | 2 +- .../server/api/PortalManagementApi.java | 16 +- .../api/PortalManagementApiController.java | 2 + .../api/PortalManagementApiDelegate.java | 19 +- ...agementApi.java => UserManagementApi.java} | 97 +++- ....java => UserManagementApiController.java} | 10 +- ...te.java => UserManagementApiDelegate.java} | 58 +- .../server/config/SpringDocConfiguration.java | 2 +- .../model/OpenConsumerCreateRequestDTO.java | 274 ++++++++++ .../server/model/OpenConsumerInfoDTO.java | 322 +++++++++++ spring-boot2/src/main/resources/openapi.yaml | 196 ++++++- tests/test_user_management_contract.py | 105 ++++ typescript/.openapi-generator/FILES | 4 +- typescript/README.md | 4 +- typescript/package.json | 2 +- typescript/src/apis/PortalManagementApi.ts | 30 +- ...rManagementApi.ts => UserManagementApi.ts} | 76 ++- typescript/src/apis/index.ts | 2 +- .../models/OpenConsumerCreateRequestDTO.ts | 127 +++++ typescript/src/models/OpenConsumerInfoDTO.ts | 143 +++++ typescript/src/models/index.ts | 2 + 96 files changed, 5459 insertions(+), 413 deletions(-) create mode 100644 java-client/docs/OpenConsumerCreateRequestDTO.md create mode 100644 java-client/docs/OpenConsumerInfoDTO.md rename java-client/docs/{PortalUserManagementApi.md => UserManagementApi.md} (60%) rename java-client/src/main/java/org/openapitools/client/api/{PortalUserManagementApi.java => UserManagementApi.java} (70%) create mode 100644 java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java create mode 100644 java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java rename java-client/src/test/java/org/openapitools/client/api/{PortalUserManagementApiTest.java => UserManagementApiTest.java} (66%) create mode 100644 java-client/src/test/java/org/openapitools/client/model/OpenConsumerCreateRequestDTOTest.java create mode 100644 java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java create mode 100644 python/apollo_openapi/apis/paths/openapi_v1_users_user_id.py rename python/apollo_openapi/apis/tags/{portal_user_management_api.py => user_management_api.py} (91%) create mode 100644 python/apollo_openapi/model/open_consumer_create_request_dto.py create mode 100644 python/apollo_openapi/model/open_consumer_create_request_dto.pyi create mode 100644 python/apollo_openapi/model/open_consumer_info_dto.py create mode 100644 python/apollo_openapi/model/open_consumer_info_dto.pyi create mode 100644 python/apollo_openapi/paths/openapi_v1_users_user_id/__init__.py create mode 100644 python/apollo_openapi/paths/openapi_v1_users_user_id/get.py create mode 100644 python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi rename python/docs/apis/tags/{PortalUserManagementApi.md => UserManagementApi.md} (70%) create mode 100644 python/docs/models/OpenConsumerCreateRequestDTO.md create mode 100644 python/docs/models/OpenConsumerInfoDTO.md create mode 100644 python/test/test_models/test_open_consumer_create_request_dto.py create mode 100644 python/test/test_models/test_open_consumer_info_dto.py create mode 100644 python/test/test_paths/test_openapi_v1_users_user_id/__init__.py create mode 100644 python/test/test_paths/test_openapi_v1_users_user_id/test_get.py create mode 100644 rust/docs/OpenConsumerCreateRequestDto.md create mode 100644 rust/docs/OpenConsumerInfoDto.md create mode 100644 rust/src/models/open_consumer_create_request_dto.rs create mode 100644 rust/src/models/open_consumer_info_dto.rs rename spring-boot2/src/main/java/com/apollo/openapi/server/api/{PortalUserManagementApi.java => UserManagementApi.java} (63%) rename spring-boot2/src/main/java/com/apollo/openapi/server/api/{PortalUserManagementApiController.java => UserManagementApiController.java} (79%) rename spring-boot2/src/main/java/com/apollo/openapi/server/api/{PortalUserManagementApiDelegate.java => UserManagementApiDelegate.java} (60%) create mode 100644 spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java create mode 100644 spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java create mode 100644 tests/test_user_management_contract.py rename typescript/src/apis/{PortalUserManagementApi.ts => UserManagementApi.ts} (69%) create mode 100644 typescript/src/models/OpenConsumerCreateRequestDTO.ts create mode 100644 typescript/src/models/OpenConsumerInfoDTO.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index af53e290..a955462c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Rename Portal user management contracts from `Portal User Management` to `User Management`. + +### Added + +- Add Consumer Token support notes to user management contracts, including `ManageUsers`-guarded user lookup and mutation operations. +- Add typed consumer management request and response schemas with the `allowManageUsers` flag. + ## [0.3.5] - 2026-05-31 ### Added diff --git a/apollo-openapi.yaml b/apollo-openapi.yaml index 663d003a..9f95bd76 100644 --- a/apollo-openapi.yaml +++ b/apollo-openapi.yaml @@ -18,7 +18,7 @@ info:
curl -X GET "http://localhost:8070/openapi/v1/apps" \
     -H "Authorization: your_token_here"
- version: 0.3.5 + version: 0.3.6 security: - ApiKeyAuth: [] tags: @@ -48,8 +48,8 @@ tags: description: AccessKey管理相关接口,包括AccessKey的创建、查询、删除、启用、禁用等操作 - name: Permission Management description: 权限管理相关接口,包括权限查询等功能 - - name: Portal User Management - description: Portal用户管理相关接口,主要供Portal UI在用户登录态下调用 + - name: User Management + description: 用户管理相关接口,支持Portal用户登录态和具备用户管理权限的Consumer Token调用 - name: Portal Management description: Portal UI 登录态管理接口,主要供当前版本 Portal 前端调用 paths: @@ -4869,7 +4869,7 @@ paths: deprecated: false description: GET /openapi/v1/user tags: - - Portal User Management + - User Management responses: '200': description: 成功获取当前用户 @@ -4891,12 +4891,12 @@ paths: $ref: '#/components/schemas/ExceptionResponse' /openapi/v1/users: get: - summary: 搜索Portal用户(new added) + summary: 搜索用户(new added) operationId: searchUsers deprecated: false - description: GET /openapi/v1/users + description: GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 tags: - - Portal User Management + - User Management parameters: - name: keyword in: query @@ -4943,18 +4943,18 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' '403': - description: 仅支持Portal用户登录态访问 + description: 权限不足 content: application/json: schema: $ref: '#/components/schemas/ExceptionResponse' post: - summary: 创建或更新Portal用户(new added) + summary: 创建或更新用户(new added) operationId: createOrUpdateUser deprecated: false - description: POST /openapi/v1/users + description: POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator tags: - - Portal User Management + - User Management parameters: - name: isCreate in: query @@ -4963,6 +4963,12 @@ paths: schema: type: boolean default: false + - name: operator + in: query + description: 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 + required: false + schema: + type: string requestBody: content: application/json: @@ -4984,14 +4990,55 @@ paths: application/json: schema: $ref: '#/components/schemas/ExceptionResponse' + /openapi/v1/users/{userId}: + get: + summary: 获取指定用户(new added) + operationId: getUserByUserId + deprecated: false + description: GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + tags: + - User Management + parameters: + - name: userId + in: path + description: 用户ID + required: true + schema: + type: string + responses: + '200': + description: 成功获取用户 + content: + application/json: + schema: + $ref: '#/components/schemas/OpenUserInfoDTO' + '400': + description: 请求参数错误或用户不存在 + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + '403': + description: 权限不足 + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' /openapi/v1/users/enabled: put: - summary: 修改Portal用户启用状态(new added) + summary: 修改用户启用状态(new added) operationId: changeUserEnabled deprecated: false - description: PUT /openapi/v1/users/enabled + description: PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator tags: - - Portal User Management + - User Management + parameters: + - name: operator + in: query + description: 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 + required: false + schema: + type: string requestBody: content: application/json: @@ -5295,7 +5342,7 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerCreateRequestDTO' required: true responses: '200': @@ -5303,7 +5350,7 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' get: summary: 查询开放平台消费者列表(new added) operationId: getConsumerList @@ -5332,7 +5379,7 @@ paths: schema: type: array items: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' /openapi/v1/consumer-tokens/by-appId: get: summary: 按应用ID查询消费者Token(new added) @@ -6777,6 +6824,80 @@ components: hasPermission: type: boolean description: '' + OpenConsumerCreateRequestDTO: + type: object + properties: + appId: + type: string + description: 第三方应用ID + allowCreateApplication: + type: boolean + description: 是否允许该Consumer Token创建应用 + default: false + allowManageUsers: + type: boolean + description: 是否允许该Consumer Token管理用户 + default: false + name: + type: string + description: 第三方应用名称 + orgId: + type: string + description: 部门ID + orgName: + type: string + description: 部门名称 + ownerName: + type: string + description: 负责人用户名 + rateLimitEnabled: + type: boolean + description: 是否开启限流 + default: false + rateLimit: + type: integer + description: 限流QPS,0表示不限流 + default: 0 + OpenConsumerInfoDTO: + type: object + properties: + appId: + type: string + description: 第三方应用ID + name: + type: string + description: 第三方应用名称 + orgId: + type: string + description: 部门ID + orgName: + type: string + description: 部门名称 + ownerName: + type: string + description: 负责人用户名 + ownerEmail: + type: string + description: 负责人邮箱 + consumerId: + type: integer + format: int64 + description: Consumer ID + token: + type: string + description: Consumer Token,仅在创建或按应用查询详情时返回 + allowCreateApplication: + type: boolean + description: 是否允许该Consumer Token创建应用 + default: false + allowManageUsers: + type: boolean + description: 是否允许该Consumer Token管理用户 + default: false + rateLimit: + type: integer + description: 限流QPS,0表示不限流 + default: 0 OpenUserInfoDTO: type: object properties: diff --git a/generate.sh b/generate.sh index 81b4175c..5ba544a2 100755 --- a/generate.sh +++ b/generate.sh @@ -42,14 +42,14 @@ echo "🚀 Generating Python SDK..." -o "$PYTHON_DIR" \ -t "$PYTHON_TEMPLATE_DIR" \ --package-name apollo_openapi \ - --additional-properties=projectName=apollo-openapi,packageVersion=0.3.5 + --additional-properties=projectName=apollo-openapi,packageVersion=0.3.6 echo "🚀 Generating TypeScript SDK..." "${OPENAPI_GENERATOR[@]}" generate \ -i "$SPEC_FILE" \ -g typescript-fetch \ -o "$TS_DIR" \ - --additional-properties=npmName=apollo-openapi,npmVersion=0.3.5,typescriptThreePlus=true + --additional-properties=npmName=apollo-openapi,npmVersion=0.3.6,typescriptThreePlus=true echo "🚀 Generating Java Client SDK..." "${OPENAPI_GENERATOR[@]}" generate \ @@ -57,7 +57,7 @@ echo "🚀 Generating Java Client SDK..." -g java \ -o "$JAVA_CLIENT_DIR" \ --additional-properties hideGenerationTimestamp=true \ - --additional-properties=groupId=com.apollo,artifactId=apollo-openapi-client,artifactVersion=0.3.5,packageName=com.apollo.openapi.client + --additional-properties=groupId=com.apollo,artifactId=apollo-openapi-client,artifactVersion=0.3.6,packageName=com.apollo.openapi.client echo "🚀 Generating Spring Boot 2 Server..." "${OPENAPI_GENERATOR[@]}" generate \ @@ -65,7 +65,7 @@ echo "🚀 Generating Spring Boot 2 Server..." -g spring \ -o "$SPRING_BOOT2_DIR" \ --additional-properties hideGenerationTimestamp=true \ - --additional-properties=groupId=com.apollo,artifactId=apollo-openapi-server,artifactVersion=0.3.5,packageName=com.apollo.openapi.server,basePackage=com.apollo.openapi.server,configPackage=com.apollo.openapi.server.config,modelPackage=com.apollo.openapi.server.model,apiPackage=com.apollo.openapi.server.api,library=spring-boot,java8=true,interfaceOnly=false,delegatePattern=true,useTags=true + --additional-properties=groupId=com.apollo,artifactId=apollo-openapi-server,artifactVersion=0.3.6,packageName=com.apollo.openapi.server,basePackage=com.apollo.openapi.server,configPackage=com.apollo.openapi.server.config,modelPackage=com.apollo.openapi.server.model,apiPackage=com.apollo.openapi.server.api,library=spring-boot,java8=true,interfaceOnly=false,delegatePattern=true,useTags=true echo "📦 Adding Maven Wrapper to Spring Boot 2 project..." cd "$SPRING_BOOT2_DIR" @@ -90,7 +90,7 @@ echo "🚀 Generating Rust SDK..." -g rust \ -o "$RUST_DIR" \ --global-property models,supportingFiles \ - --additional-properties=packageName=apollo-openapi,packageVersion=0.3.5 + --additional-properties=packageName=apollo-openapi,packageVersion=0.3.6 echo "✅ SDK generation complete." diff --git a/java-client/.openapi-generator/FILES b/java-client/.openapi-generator/FILES index 26391319..8cd1caec 100644 --- a/java-client/.openapi-generator/FILES +++ b/java-client/.openapi-generator/FILES @@ -25,6 +25,8 @@ docs/OpenAppNamespaceDTO.md docs/OpenAppRoleUserDTO.md docs/OpenClusterDTO.md docs/OpenClusterNamespaceRoleUserDTO.md +docs/OpenConsumerCreateRequestDTO.md +docs/OpenConsumerInfoDTO.md docs/OpenCreateAppDTO.md docs/OpenCreateNamespaceDTO.md docs/OpenEnvClusterDTO.md @@ -58,8 +60,8 @@ docs/OpenUserInfoDTO.md docs/OrganizationManagementApi.md docs/PermissionManagementApi.md docs/PortalManagementApi.md -docs/PortalUserManagementApi.md docs/ReleaseManagementApi.md +docs/UserManagementApi.md git_push.sh gradle.properties gradle/wrapper/gradle-wrapper.jar @@ -95,8 +97,8 @@ src/main/java/org/openapitools/client/api/NamespaceManagementApi.java src/main/java/org/openapitools/client/api/OrganizationManagementApi.java src/main/java/org/openapitools/client/api/PermissionManagementApi.java src/main/java/org/openapitools/client/api/PortalManagementApi.java -src/main/java/org/openapitools/client/api/PortalUserManagementApi.java src/main/java/org/openapitools/client/api/ReleaseManagementApi.java +src/main/java/org/openapitools/client/api/UserManagementApi.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -111,6 +113,8 @@ src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java src/main/java/org/openapitools/client/model/OpenAppRoleUserDTO.java src/main/java/org/openapitools/client/model/OpenClusterDTO.java src/main/java/org/openapitools/client/model/OpenClusterNamespaceRoleUserDTO.java +src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java +src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java src/main/java/org/openapitools/client/model/OpenCreateNamespaceDTO.java src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java @@ -154,8 +158,8 @@ src/test/java/org/openapitools/client/api/NamespaceManagementApiTest.java src/test/java/org/openapitools/client/api/OrganizationManagementApiTest.java src/test/java/org/openapitools/client/api/PermissionManagementApiTest.java src/test/java/org/openapitools/client/api/PortalManagementApiTest.java -src/test/java/org/openapitools/client/api/PortalUserManagementApiTest.java src/test/java/org/openapitools/client/api/ReleaseManagementApiTest.java +src/test/java/org/openapitools/client/api/UserManagementApiTest.java src/test/java/org/openapitools/client/model/ExceptionResponseTest.java src/test/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTOTest.java src/test/java/org/openapitools/client/model/NamespaceReleaseDTOTest.java @@ -165,6 +169,8 @@ src/test/java/org/openapitools/client/model/OpenAppNamespaceDTOTest.java src/test/java/org/openapitools/client/model/OpenAppRoleUserDTOTest.java src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java src/test/java/org/openapitools/client/model/OpenClusterNamespaceRoleUserDTOTest.java +src/test/java/org/openapitools/client/model/OpenConsumerCreateRequestDTOTest.java +src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java src/test/java/org/openapitools/client/model/OpenCreateAppDTOTest.java src/test/java/org/openapitools/client/model/OpenCreateNamespaceDTOTest.java src/test/java/org/openapitools/client/model/OpenEnvClusterDTOTest.java diff --git a/java-client/README.md b/java-client/README.md index d9baca68..6b97a85d 100644 --- a/java-client/README.md +++ b/java-client/README.md @@ -1,7 +1,7 @@ # apollo-openapi-client Apollo OpenAPI -- API version: 0.3.5 +- API version: 0.3.6

Apollo配置中心OpenAPI接口文档

@@ -54,7 +54,7 @@ Add this dependency to your project's POM: com.apollo apollo-openapi-client - 0.3.5 + 0.3.6 compile ``` @@ -70,7 +70,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.apollo:apollo-openapi-client:0.3.5" + implementation "com.apollo:apollo-openapi-client:0.3.6" } ``` @@ -84,7 +84,7 @@ mvn clean package Then manually install the following JARs: -* `target/apollo-openapi-client-0.3.5.jar` +* `target/apollo-openapi-client-0.3.6.jar` * `target/lib/*.jar` ## Getting Started @@ -262,10 +262,6 @@ Class | Method | HTTP request | Description *PortalManagementApi* | [**searchAuditLogs**](docs/PortalManagementApi.md#searchAuditLogs) | **GET** /openapi/v1/apollo/audit/logs/by-name-or-type-or-operator | 搜索审计日志(new added) *PortalManagementApi* | [**searchItemInfoByKeyOrValue**](docs/PortalManagementApi.md#searchItemInfoByKeyOrValue) | **GET** /openapi/v1/global-search/item-info/by-key-or-value | 按Key或Value全局搜索配置(new added) *PortalManagementApi* | [**topFavorite**](docs/PortalManagementApi.md#topFavorite) | **PUT** /openapi/v1/favorites/{favoriteId} | 收藏置顶(new added) -*PortalUserManagementApi* | [**changeUserEnabled**](docs/PortalUserManagementApi.md#changeUserEnabled) | **PUT** /openapi/v1/users/enabled | 修改Portal用户启用状态(new added) -*PortalUserManagementApi* | [**createOrUpdateUser**](docs/PortalUserManagementApi.md#createOrUpdateUser) | **POST** /openapi/v1/users | 创建或更新Portal用户(new added) -*PortalUserManagementApi* | [**getCurrentUser**](docs/PortalUserManagementApi.md#getCurrentUser) | **GET** /openapi/v1/user | 获取当前Portal用户(new added) -*PortalUserManagementApi* | [**searchUsers**](docs/PortalUserManagementApi.md#searchUsers) | **GET** /openapi/v1/users | 搜索Portal用户(new added) *ReleaseManagementApi* | [**compareRelease**](docs/ReleaseManagementApi.md#compareRelease) | **GET** /openapi/v1/envs/{env}/releases/comparison | Compare two releases *ReleaseManagementApi* | [**createGrayDelRelease**](docs/ReleaseManagementApi.md#createGrayDelRelease) | **POST** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/gray-del-releases | 创建灰度删除发布 (original openapi) *ReleaseManagementApi* | [**createGrayRelease**](docs/ReleaseManagementApi.md#createGrayRelease) | **POST** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases | 创建灰度发布 (original openapi) @@ -274,6 +270,11 @@ Class | Method | HTTP request | Description *ReleaseManagementApi* | [**getReleaseById**](docs/ReleaseManagementApi.md#getReleaseById) | **GET** /openapi/v1/envs/{env}/releases/{releaseId} | 获取发布详情 (new added) *ReleaseManagementApi* | [**loadLatestActiveRelease**](docs/ReleaseManagementApi.md#loadLatestActiveRelease) | **GET** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest | 获取最新活跃发布 (original openapi) *ReleaseManagementApi* | [**rollback**](docs/ReleaseManagementApi.md#rollback) | **PUT** /openapi/v1/envs/{env}/releases/{releaseId}/rollback | 回滚发布 (original openapi) +*UserManagementApi* | [**changeUserEnabled**](docs/UserManagementApi.md#changeUserEnabled) | **PUT** /openapi/v1/users/enabled | 修改用户启用状态(new added) +*UserManagementApi* | [**createOrUpdateUser**](docs/UserManagementApi.md#createOrUpdateUser) | **POST** /openapi/v1/users | 创建或更新用户(new added) +*UserManagementApi* | [**getCurrentUser**](docs/UserManagementApi.md#getCurrentUser) | **GET** /openapi/v1/user | 获取当前Portal用户(new added) +*UserManagementApi* | [**getUserByUserId**](docs/UserManagementApi.md#getUserByUserId) | **GET** /openapi/v1/users/{userId} | 获取指定用户(new added) +*UserManagementApi* | [**searchUsers**](docs/UserManagementApi.md#searchUsers) | **GET** /openapi/v1/users | 搜索用户(new added) ## Documentation for Models @@ -287,6 +288,8 @@ Class | Method | HTTP request | Description - [OpenAppRoleUserDTO](docs/OpenAppRoleUserDTO.md) - [OpenClusterDTO](docs/OpenClusterDTO.md) - [OpenClusterNamespaceRoleUserDTO](docs/OpenClusterNamespaceRoleUserDTO.md) + - [OpenConsumerCreateRequestDTO](docs/OpenConsumerCreateRequestDTO.md) + - [OpenConsumerInfoDTO](docs/OpenConsumerInfoDTO.md) - [OpenCreateAppDTO](docs/OpenCreateAppDTO.md) - [OpenCreateNamespaceDTO](docs/OpenCreateNamespaceDTO.md) - [OpenEnvClusterDTO](docs/OpenEnvClusterDTO.md) diff --git a/java-client/api/openapi.yaml b/java-client/api/openapi.yaml index 281b6a87..6f1ca891 100644 --- a/java-client/api/openapi.yaml +++ b/java-client/api/openapi.yaml @@ -17,7 +17,7 @@ info:
curl -X GET "http://localhost:8070/openapi/v1/apps" \
     -H "Authorization: your_token_here"
title: Apollo OpenAPI - version: 0.3.5 + version: 0.3.6 servers: - url: / security: @@ -49,8 +49,8 @@ tags: name: AccessKey Management - description: 权限管理相关接口,包括权限查询等功能 name: Permission Management -- description: Portal用户管理相关接口,主要供Portal UI在用户登录态下调用 - name: Portal User Management +- description: 用户管理相关接口,支持Portal用户登录态和具备用户管理权限的Consumer Token调用 + name: User Management - description: Portal UI 登录态管理接口,主要供当前版本 Portal 前端调用 name: Portal Management paths: @@ -5629,12 +5629,12 @@ paths: description: 仅支持Portal用户登录态访问 summary: 获取当前Portal用户(new added) tags: - - Portal User Management + - User Management x-accepts: application/json /openapi/v1/users: get: deprecated: false - description: GET /openapi/v1/users + description: GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 operationId: searchUsers parameters: - description: 用户名、显示名或邮箱关键字 @@ -5694,14 +5694,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ExceptionResponse' - description: 仅支持Portal用户登录态访问 - summary: 搜索Portal用户(new added) + description: 权限不足 + summary: 搜索用户(new added) tags: - - Portal User Management + - User Management x-accepts: application/json post: deprecated: false - description: POST /openapi/v1/users + description: POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator operationId: createOrUpdateUser parameters: - description: true 表示创建用户,false 表示更新用户 @@ -5713,6 +5713,14 @@ paths: default: false type: boolean style: form + - description: 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 + explode: true + in: query + name: operator + required: false + schema: + type: string + style: form requestBody: content: application/json: @@ -5734,16 +5742,64 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' description: 权限不足 - summary: 创建或更新Portal用户(new added) + summary: 创建或更新用户(new added) tags: - - Portal User Management + - User Management x-content-type: application/json x-accepts: application/json + /openapi/v1/users/{userId}: + get: + deprecated: false + description: "GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的\ + Consumer Token访问" + operationId: getUserByUserId + parameters: + - description: 用户ID + explode: false + in: path + name: userId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OpenUserInfoDTO' + description: 成功获取用户 + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + description: 请求参数错误或用户不存在 + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + description: 权限不足 + summary: 获取指定用户(new added) + tags: + - User Management + x-accepts: application/json /openapi/v1/users/enabled: put: deprecated: false - description: PUT /openapi/v1/users/enabled + description: PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer + Token访问时需要具备ManageUsers权限并传入有效operator operationId: changeUserEnabled + parameters: + - description: 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 + explode: true + in: query + name: operator + required: false + schema: + type: string + style: form requestBody: content: application/json: @@ -5765,9 +5821,9 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' description: 权限不足 - summary: 修改Portal用户启用状态(new added) + summary: 修改用户启用状态(new added) tags: - - Portal User Management + - User Management x-content-type: application/json x-accepts: application/json /openapi/v1/apollo/audit/properties: @@ -6115,7 +6171,7 @@ paths: application/json: schema: items: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' type: array description: 成功获取消费者列表 summary: 查询开放平台消费者列表(new added) @@ -6139,14 +6195,14 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerCreateRequestDTO' required: true responses: "200": content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' description: 成功创建消费者 summary: 创建开放平台消费者(new added) tags: @@ -8329,6 +8385,102 @@ components: description: "" type: boolean type: object + OpenConsumerCreateRequestDTO: + example: + orgName: orgName + rateLimit: 0 + ownerName: ownerName + appId: appId + name: name + allowCreateApplication: false + allowManageUsers: false + rateLimitEnabled: false + orgId: orgId + properties: + appId: + description: 第三方应用ID + type: string + allowCreateApplication: + default: false + description: 是否允许该Consumer Token创建应用 + type: boolean + allowManageUsers: + default: false + description: 是否允许该Consumer Token管理用户 + type: boolean + name: + description: 第三方应用名称 + type: string + orgId: + description: 部门ID + type: string + orgName: + description: 部门名称 + type: string + ownerName: + description: 负责人用户名 + type: string + rateLimitEnabled: + default: false + description: 是否开启限流 + type: boolean + rateLimit: + default: 0 + description: 限流QPS,0表示不限流 + type: integer + type: object + OpenConsumerInfoDTO: + example: + orgName: orgName + rateLimit: 6 + ownerName: ownerName + consumerId: 0 + appId: appId + name: name + allowCreateApplication: false + allowManageUsers: false + orgId: orgId + ownerEmail: ownerEmail + token: token + properties: + appId: + description: 第三方应用ID + type: string + name: + description: 第三方应用名称 + type: string + orgId: + description: 部门ID + type: string + orgName: + description: 部门名称 + type: string + ownerName: + description: 负责人用户名 + type: string + ownerEmail: + description: 负责人邮箱 + type: string + consumerId: + description: Consumer ID + format: int64 + type: integer + token: + description: Consumer Token,仅在创建或按应用查询详情时返回 + type: string + allowCreateApplication: + default: false + description: 是否允许该Consumer Token创建应用 + type: boolean + allowManageUsers: + default: false + description: 是否允许该Consumer Token管理用户 + type: boolean + rateLimit: + default: 0 + description: 限流QPS,0表示不限流 + type: integer + type: object OpenUserInfoDTO: example: name: name diff --git a/java-client/build.gradle b/java-client/build.gradle index 445700e3..65a759a7 100644 --- a/java-client/build.gradle +++ b/java-client/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'com.apollo' -version = '0.3.5' +version = '0.3.6' buildscript { repositories { diff --git a/java-client/build.sbt b/java-client/build.sbt index d8c27626..55224b35 100644 --- a/java-client/build.sbt +++ b/java-client/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.apollo", name := "apollo-openapi-client", - version := "0.3.5", + version := "0.3.6", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/java-client/docs/OpenConsumerCreateRequestDTO.md b/java-client/docs/OpenConsumerCreateRequestDTO.md new file mode 100644 index 00000000..0ba4b906 --- /dev/null +++ b/java-client/docs/OpenConsumerCreateRequestDTO.md @@ -0,0 +1,18 @@ + + +# OpenConsumerCreateRequestDTO + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**appId** | **String** | 第三方应用ID | [optional] | +|**allowCreateApplication** | **Boolean** | 是否允许该Consumer Token创建应用 | [optional] | +|**allowManageUsers** | **Boolean** | 是否允许该Consumer Token管理用户 | [optional] | +|**name** | **String** | 第三方应用名称 | [optional] | +|**orgId** | **String** | 部门ID | [optional] | +|**orgName** | **String** | 部门名称 | [optional] | +|**ownerName** | **String** | 负责人用户名 | [optional] | +|**rateLimitEnabled** | **Boolean** | 是否开启限流 | [optional] | +|**rateLimit** | **Integer** | 限流QPS,0表示不限流 | [optional] | diff --git a/java-client/docs/OpenConsumerInfoDTO.md b/java-client/docs/OpenConsumerInfoDTO.md new file mode 100644 index 00000000..9a90b3bd --- /dev/null +++ b/java-client/docs/OpenConsumerInfoDTO.md @@ -0,0 +1,20 @@ + + +# OpenConsumerInfoDTO + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**appId** | **String** | 第三方应用ID | [optional] | +|**name** | **String** | 第三方应用名称 | [optional] | +|**orgId** | **String** | 部门ID | [optional] | +|**orgName** | **String** | 部门名称 | [optional] | +|**ownerName** | **String** | 负责人用户名 | [optional] | +|**ownerEmail** | **String** | 负责人邮箱 | [optional] | +|**consumerId** | **Long** | Consumer ID | [optional] | +|**token** | **String** | Consumer Token,仅在创建或按应用查询详情时返回 | [optional] | +|**allowCreateApplication** | **Boolean** | 是否允许该Consumer Token创建应用 | [optional] | +|**allowManageUsers** | **Boolean** | 是否允许该Consumer Token管理用户 | [optional] | +|**rateLimit** | **Integer** | 限流QPS,0表示不限流 | [optional] | diff --git a/java-client/docs/PortalManagementApi.md b/java-client/docs/PortalManagementApi.md index b107cba8..3d6f4bcb 100644 --- a/java-client/docs/PortalManagementApi.md +++ b/java-client/docs/PortalManagementApi.md @@ -329,7 +329,7 @@ public class Example { # **createConsumer** -> Object createConsumer(body, expires) +> OpenConsumerInfoDTO createConsumer(openConsumerCreateRequestDTO, expires) 创建开放平台消费者(new added) @@ -357,10 +357,10 @@ public class Example { //ApiKeyAuth.setApiKeyPrefix("Token"); PortalManagementApi apiInstance = new PortalManagementApi(defaultClient); - Object body = null; // Object | + OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO = new OpenConsumerCreateRequestDTO(); // OpenConsumerCreateRequestDTO | String expires = "expires_example"; // String | try { - Object result = apiInstance.createConsumer(body, expires); + OpenConsumerInfoDTO result = apiInstance.createConsumer(openConsumerCreateRequestDTO, expires); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PortalManagementApi#createConsumer"); @@ -377,12 +377,12 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | **Object**| | | +| **openConsumerCreateRequestDTO** | [**OpenConsumerCreateRequestDTO**](OpenConsumerCreateRequestDTO.md)| | | | **expires** | **String**| | [optional] | ### Return type -**Object** +[**OpenConsumerInfoDTO**](OpenConsumerInfoDTO.md) ### Authorization @@ -1761,7 +1761,7 @@ This endpoint does not need any parameter. # **getConsumerList** -> List<Object> getConsumerList(page, size) +> List<OpenConsumerInfoDTO> getConsumerList(page, size) 查询开放平台消费者列表(new added) @@ -1792,7 +1792,7 @@ public class Example { Integer page = 0; // Integer | Integer size = 10; // Integer | try { - List result = apiInstance.getConsumerList(page, size); + List result = apiInstance.getConsumerList(page, size); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PortalManagementApi#getConsumerList"); @@ -1814,7 +1814,7 @@ public class Example { ### Return type -**List<Object>** +[**List<OpenConsumerInfoDTO>**](OpenConsumerInfoDTO.md) ### Authorization diff --git a/java-client/docs/PortalUserManagementApi.md b/java-client/docs/UserManagementApi.md similarity index 60% rename from java-client/docs/PortalUserManagementApi.md rename to java-client/docs/UserManagementApi.md index 7977c56a..222048df 100644 --- a/java-client/docs/PortalUserManagementApi.md +++ b/java-client/docs/UserManagementApi.md @@ -1,22 +1,23 @@ -# PortalUserManagementApi +# UserManagementApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**changeUserEnabled**](PortalUserManagementApi.md#changeUserEnabled) | **PUT** /openapi/v1/users/enabled | 修改Portal用户启用状态(new added) | -| [**createOrUpdateUser**](PortalUserManagementApi.md#createOrUpdateUser) | **POST** /openapi/v1/users | 创建或更新Portal用户(new added) | -| [**getCurrentUser**](PortalUserManagementApi.md#getCurrentUser) | **GET** /openapi/v1/user | 获取当前Portal用户(new added) | -| [**searchUsers**](PortalUserManagementApi.md#searchUsers) | **GET** /openapi/v1/users | 搜索Portal用户(new added) | +| [**changeUserEnabled**](UserManagementApi.md#changeUserEnabled) | **PUT** /openapi/v1/users/enabled | 修改用户启用状态(new added) | +| [**createOrUpdateUser**](UserManagementApi.md#createOrUpdateUser) | **POST** /openapi/v1/users | 创建或更新用户(new added) | +| [**getCurrentUser**](UserManagementApi.md#getCurrentUser) | **GET** /openapi/v1/user | 获取当前Portal用户(new added) | +| [**getUserByUserId**](UserManagementApi.md#getUserByUserId) | **GET** /openapi/v1/users/{userId} | 获取指定用户(new added) | +| [**searchUsers**](UserManagementApi.md#searchUsers) | **GET** /openapi/v1/users | 搜索用户(new added) | # **changeUserEnabled** -> changeUserEnabled(openUserDTO) +> changeUserEnabled(openUserDTO, operator) -修改Portal用户启用状态(new added) +修改用户启用状态(new added) -PUT /openapi/v1/users/enabled +PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator ### Example ```java @@ -26,7 +27,7 @@ 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.PortalUserManagementApi; +import org.openapitools.client.api.UserManagementApi; public class Example { public static void main(String[] args) { @@ -39,12 +40,13 @@ public class Example { // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //ApiKeyAuth.setApiKeyPrefix("Token"); - PortalUserManagementApi apiInstance = new PortalUserManagementApi(defaultClient); + UserManagementApi apiInstance = new UserManagementApi(defaultClient); OpenUserDTO openUserDTO = new OpenUserDTO(); // OpenUserDTO | + String operator = "operator_example"; // String | 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 try { - apiInstance.changeUserEnabled(openUserDTO); + apiInstance.changeUserEnabled(openUserDTO, operator); } catch (ApiException e) { - System.err.println("Exception when calling PortalUserManagementApi#changeUserEnabled"); + System.err.println("Exception when calling UserManagementApi#changeUserEnabled"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -59,6 +61,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **openUserDTO** | [**OpenUserDTO**](OpenUserDTO.md)| | | +| **operator** | **String**| 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 | [optional] | ### Return type @@ -82,11 +85,11 @@ null (empty response body) # **createOrUpdateUser** -> createOrUpdateUser(openUserDTO, isCreate) +> createOrUpdateUser(openUserDTO, isCreate, operator) -创建或更新Portal用户(new added) +创建或更新用户(new added) -POST /openapi/v1/users +POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator ### Example ```java @@ -96,7 +99,7 @@ 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.PortalUserManagementApi; +import org.openapitools.client.api.UserManagementApi; public class Example { public static void main(String[] args) { @@ -109,13 +112,14 @@ public class Example { // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //ApiKeyAuth.setApiKeyPrefix("Token"); - PortalUserManagementApi apiInstance = new PortalUserManagementApi(defaultClient); + UserManagementApi apiInstance = new UserManagementApi(defaultClient); OpenUserDTO openUserDTO = new OpenUserDTO(); // OpenUserDTO | Boolean isCreate = false; // Boolean | true 表示创建用户,false 表示更新用户 + String operator = "operator_example"; // String | 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 try { - apiInstance.createOrUpdateUser(openUserDTO, isCreate); + apiInstance.createOrUpdateUser(openUserDTO, isCreate, operator); } catch (ApiException e) { - System.err.println("Exception when calling PortalUserManagementApi#createOrUpdateUser"); + System.err.println("Exception when calling UserManagementApi#createOrUpdateUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -131,6 +135,7 @@ public class Example { |------------- | ------------- | ------------- | -------------| | **openUserDTO** | [**OpenUserDTO**](OpenUserDTO.md)| | | | **isCreate** | **Boolean**| true 表示创建用户,false 表示更新用户 | [optional] [default to false] | +| **operator** | **String**| 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 | [optional] | ### Return type @@ -168,7 +173,7 @@ 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.PortalUserManagementApi; +import org.openapitools.client.api.UserManagementApi; public class Example { public static void main(String[] args) { @@ -181,12 +186,12 @@ public class Example { // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //ApiKeyAuth.setApiKeyPrefix("Token"); - PortalUserManagementApi apiInstance = new PortalUserManagementApi(defaultClient); + UserManagementApi apiInstance = new UserManagementApi(defaultClient); try { OpenUserInfoDTO result = apiInstance.getCurrentUser(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PortalUserManagementApi#getCurrentUser"); + System.err.println("Exception when calling UserManagementApi#getCurrentUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -219,13 +224,84 @@ This endpoint does not need any parameter. | **401** | 未登录或未授权访问 | - | | **403** | 仅支持Portal用户登录态访问 | - | + +# **getUserByUserId** +> OpenUserInfoDTO getUserByUserId(userId) + +获取指定用户(new added) + +GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + +### 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.UserManagementApi; + +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"); + + UserManagementApi apiInstance = new UserManagementApi(defaultClient); + String userId = "userId_example"; // String | 用户ID + try { + OpenUserInfoDTO result = apiInstance.getUserByUserId(userId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserManagementApi#getUserByUserId"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| 用户ID | | + +### Return type + +[**OpenUserInfoDTO**](OpenUserInfoDTO.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | 成功获取用户 | - | +| **400** | 请求参数错误或用户不存在 | - | +| **403** | 权限不足 | - | + # **searchUsers** > List<OpenUserInfoDTO> searchUsers(keyword, includeInactiveUsers, offset, limit) -搜索Portal用户(new added) +搜索用户(new added) -GET /openapi/v1/users +GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 ### Example ```java @@ -235,7 +311,7 @@ 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.PortalUserManagementApi; +import org.openapitools.client.api.UserManagementApi; public class Example { public static void main(String[] args) { @@ -248,7 +324,7 @@ public class Example { // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //ApiKeyAuth.setApiKeyPrefix("Token"); - PortalUserManagementApi apiInstance = new PortalUserManagementApi(defaultClient); + UserManagementApi apiInstance = new UserManagementApi(defaultClient); String keyword = "keyword_example"; // String | 用户名、显示名或邮箱关键字 Boolean includeInactiveUsers = false; // Boolean | 是否包含禁用用户 Integer offset = 0; // Integer | 偏移量 @@ -257,7 +333,7 @@ public class Example { List result = apiInstance.searchUsers(keyword, includeInactiveUsers, offset, limit); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PortalUserManagementApi#searchUsers"); + System.err.println("Exception when calling UserManagementApi#searchUsers"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -294,4 +370,4 @@ public class Example { |-------------|-------------|------------------| | **200** | 成功获取用户列表 | - | | **401** | 未登录或未授权访问 | - | -| **403** | 仅支持Portal用户登录态访问 | - | +| **403** | 权限不足 | - | diff --git a/java-client/pom.xml b/java-client/pom.xml index 1fe91a9d..cb81f858 100644 --- a/java-client/pom.xml +++ b/java-client/pom.xml @@ -5,7 +5,7 @@ apollo-openapi-client jar apollo-openapi-client - 0.3.5 + 0.3.6 https://github.com/openapitools/openapi-generator OpenAPI Java diff --git a/java-client/src/main/java/org/openapitools/client/ApiClient.java b/java-client/src/main/java/org/openapitools/client/ApiClient.java index 84f733ba..13dd29cd 100644 --- a/java-client/src/main/java/org/openapitools/client/ApiClient.java +++ b/java-client/src/main/java/org/openapitools/client/ApiClient.java @@ -139,7 +139,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/0.3.5/java"); + setUserAgent("OpenAPI-Generator/0.3.6/java"); authentications = new HashMap(); } diff --git a/java-client/src/main/java/org/openapitools/client/Configuration.java b/java-client/src/main/java/org/openapitools/client/Configuration.java index 4426e8a4..696bceac 100644 --- a/java-client/src/main/java/org/openapitools/client/Configuration.java +++ b/java-client/src/main/java/org/openapitools/client/Configuration.java @@ -14,7 +14,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "0.3.5"; + public static final String VERSION = "0.3.6"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/java-client/src/main/java/org/openapitools/client/JSON.java b/java-client/src/main/java/org/openapitools/client/JSON.java index 31932a3a..6b49254f 100644 --- a/java-client/src/main/java/org/openapitools/client/JSON.java +++ b/java-client/src/main/java/org/openapitools/client/JSON.java @@ -101,6 +101,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenAppRoleUserDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenClusterDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenClusterNamespaceRoleUserDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenConsumerCreateRequestDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenConsumerInfoDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenCreateAppDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenCreateNamespaceDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenEnvClusterDTO.CustomTypeAdapterFactory()); diff --git a/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java index f6707979..aef98e90 100644 --- a/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java @@ -27,6 +27,8 @@ import java.io.File; +import org.openapitools.client.model.OpenConsumerCreateRequestDTO; +import org.openapitools.client.model.OpenConsumerInfoDTO; import java.lang.reflect.Type; import java.util.ArrayList; @@ -615,7 +617,7 @@ public okhttp3.Call checkSystemHealthAsync(String instanceId, final ApiCallback< } /** * Build call for createConsumer - * @param body (required) + * @param openConsumerCreateRequestDTO (required) * @param expires (optional) * @param _callback Callback for upload/download progress * @return Call to execute @@ -626,7 +628,7 @@ public okhttp3.Call checkSystemHealthAsync(String instanceId, final ApiCallback< 200 成功创建消费者 - */ - public okhttp3.Call createConsumerCall(Object body, String expires, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createConsumerCall(OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, String expires, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -640,7 +642,7 @@ public okhttp3.Call createConsumerCall(Object body, String expires, final ApiCal basePath = null; } - Object localVarPostBody = body; + Object localVarPostBody = openConsumerCreateRequestDTO; // create path and map variables String localVarPath = "/openapi/v1/consumers"; @@ -676,22 +678,22 @@ public okhttp3.Call createConsumerCall(Object body, String expires, final ApiCal } @SuppressWarnings("rawtypes") - private okhttp3.Call createConsumerValidateBeforeCall(Object body, String expires, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling createConsumer(Async)"); + private okhttp3.Call createConsumerValidateBeforeCall(OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, String expires, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'openConsumerCreateRequestDTO' is set + if (openConsumerCreateRequestDTO == null) { + throw new ApiException("Missing the required parameter 'openConsumerCreateRequestDTO' when calling createConsumer(Async)"); } - return createConsumerCall(body, expires, _callback); + return createConsumerCall(openConsumerCreateRequestDTO, expires, _callback); } /** * 创建开放平台消费者(new added) * POST /openapi/v1/consumers - * @param body (required) + * @param openConsumerCreateRequestDTO (required) * @param expires (optional) - * @return Object + * @return OpenConsumerInfoDTO * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -699,17 +701,17 @@ private okhttp3.Call createConsumerValidateBeforeCall(Object body, String expire
200 成功创建消费者 -
*/ - public Object createConsumer(Object body, String expires) throws ApiException { - ApiResponse localVarResp = createConsumerWithHttpInfo(body, expires); + public OpenConsumerInfoDTO createConsumer(OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, String expires) throws ApiException { + ApiResponse localVarResp = createConsumerWithHttpInfo(openConsumerCreateRequestDTO, expires); return localVarResp.getData(); } /** * 创建开放平台消费者(new added) * POST /openapi/v1/consumers - * @param body (required) + * @param openConsumerCreateRequestDTO (required) * @param expires (optional) - * @return ApiResponse<Object> + * @return ApiResponse<OpenConsumerInfoDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -717,16 +719,16 @@ public Object createConsumer(Object body, String expires) throws ApiException {
200 成功创建消费者 -
*/ - public ApiResponse createConsumerWithHttpInfo(Object body, String expires) throws ApiException { - okhttp3.Call localVarCall = createConsumerValidateBeforeCall(body, expires, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createConsumerWithHttpInfo(OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, String expires) throws ApiException { + okhttp3.Call localVarCall = createConsumerValidateBeforeCall(openConsumerCreateRequestDTO, expires, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 创建开放平台消费者(new added) (asynchronously) * POST /openapi/v1/consumers - * @param body (required) + * @param openConsumerCreateRequestDTO (required) * @param expires (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -737,10 +739,10 @@ public ApiResponse createConsumerWithHttpInfo(Object body, String expire 200 成功创建消费者 - */ - public okhttp3.Call createConsumerAsync(Object body, String expires, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createConsumerAsync(OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, String expires, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = createConsumerValidateBeforeCall(body, expires, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = createConsumerValidateBeforeCall(openConsumerCreateRequestDTO, expires, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -3423,7 +3425,7 @@ private okhttp3.Call getConsumerListValidateBeforeCall(Integer page, Integer siz * GET /openapi/v1/consumers * @param page (optional, default to 0) * @param size (optional, default to 10) - * @return List<Object> + * @return List<OpenConsumerInfoDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3431,8 +3433,8 @@ private okhttp3.Call getConsumerListValidateBeforeCall(Integer page, Integer siz
200 成功获取消费者列表 -
*/ - public List getConsumerList(Integer page, Integer size) throws ApiException { - ApiResponse> localVarResp = getConsumerListWithHttpInfo(page, size); + public List getConsumerList(Integer page, Integer size) throws ApiException { + ApiResponse> localVarResp = getConsumerListWithHttpInfo(page, size); return localVarResp.getData(); } @@ -3441,7 +3443,7 @@ public List getConsumerList(Integer page, Integer size) throws ApiExcept * GET /openapi/v1/consumers * @param page (optional, default to 0) * @param size (optional, default to 10) - * @return ApiResponse<List<Object>> + * @return ApiResponse<List<OpenConsumerInfoDTO>> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3449,9 +3451,9 @@ public List getConsumerList(Integer page, Integer size) throws ApiExcept
200 成功获取消费者列表 -
*/ - public ApiResponse> getConsumerListWithHttpInfo(Integer page, Integer size) throws ApiException { + public ApiResponse> getConsumerListWithHttpInfo(Integer page, Integer size) throws ApiException { okhttp3.Call localVarCall = getConsumerListValidateBeforeCall(page, size, null); - Type localVarReturnType = new TypeToken>(){}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -3469,10 +3471,10 @@ public ApiResponse> getConsumerListWithHttpInfo(Integer page, Integ 200 成功获取消费者列表 - */ - public okhttp3.Call getConsumerListAsync(Integer page, Integer size, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getConsumerListAsync(Integer page, Integer size, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getConsumerListValidateBeforeCall(page, size, _callback); - Type localVarReturnType = new TypeToken>(){}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/java-client/src/main/java/org/openapitools/client/api/PortalUserManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java similarity index 70% rename from java-client/src/main/java/org/openapitools/client/api/PortalUserManagementApi.java rename to java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java index add6cd31..0237d861 100644 --- a/java-client/src/main/java/org/openapitools/client/api/PortalUserManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java @@ -37,16 +37,16 @@ import java.util.Map; import javax.ws.rs.core.GenericType; -public class PortalUserManagementApi { +public class UserManagementApi { private ApiClient localVarApiClient; private int localHostIndex; private String localCustomBaseUrl; - public PortalUserManagementApi() { + public UserManagementApi() { this(Configuration.getDefaultApiClient()); } - public PortalUserManagementApi(ApiClient apiClient) { + public UserManagementApi(ApiClient apiClient) { this.localVarApiClient = apiClient; } @@ -77,6 +77,7 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for changeUserEnabled * @param openUserDTO (required) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -88,7 +89,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 403 权限不足 - */ - public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, final ApiCallback _callback) throws ApiException { + public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, String operator, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -113,6 +114,10 @@ public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, final ApiCall Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (operator != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("operator", operator)); + } + final String[] localVarAccepts = { "application/json" }; @@ -134,20 +139,21 @@ public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, final ApiCall } @SuppressWarnings("rawtypes") - private okhttp3.Call changeUserEnabledValidateBeforeCall(OpenUserDTO openUserDTO, final ApiCallback _callback) throws ApiException { + private okhttp3.Call changeUserEnabledValidateBeforeCall(OpenUserDTO openUserDTO, String operator, final ApiCallback _callback) throws ApiException { // verify the required parameter 'openUserDTO' is set if (openUserDTO == null) { throw new ApiException("Missing the required parameter 'openUserDTO' when calling changeUserEnabled(Async)"); } - return changeUserEnabledCall(openUserDTO, _callback); + return changeUserEnabledCall(openUserDTO, operator, _callback); } /** - * 修改Portal用户启用状态(new added) - * PUT /openapi/v1/users/enabled + * 修改用户启用状态(new added) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * @param openUserDTO (required) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -157,14 +163,15 @@ private okhttp3.Call changeUserEnabledValidateBeforeCall(OpenUserDTO openUserDTO
403 权限不足 -
*/ - public void changeUserEnabled(OpenUserDTO openUserDTO) throws ApiException { - changeUserEnabledWithHttpInfo(openUserDTO); + public void changeUserEnabled(OpenUserDTO openUserDTO, String operator) throws ApiException { + changeUserEnabledWithHttpInfo(openUserDTO, operator); } /** - * 修改Portal用户启用状态(new added) - * PUT /openapi/v1/users/enabled + * 修改用户启用状态(new added) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * @param openUserDTO (required) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -175,15 +182,16 @@ public void changeUserEnabled(OpenUserDTO openUserDTO) throws ApiException { 403 权限不足 - */ - public ApiResponse changeUserEnabledWithHttpInfo(OpenUserDTO openUserDTO) throws ApiException { - okhttp3.Call localVarCall = changeUserEnabledValidateBeforeCall(openUserDTO, null); + public ApiResponse changeUserEnabledWithHttpInfo(OpenUserDTO openUserDTO, String operator) throws ApiException { + okhttp3.Call localVarCall = changeUserEnabledValidateBeforeCall(openUserDTO, operator, null); return localVarApiClient.execute(localVarCall); } /** - * 修改Portal用户启用状态(new added) (asynchronously) - * PUT /openapi/v1/users/enabled + * 修改用户启用状态(new added) (asynchronously) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * @param openUserDTO (required) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (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 @@ -195,9 +203,9 @@ public ApiResponse changeUserEnabledWithHttpInfo(OpenUserDTO openUserDTO) 403 权限不足 - */ - public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, final ApiCallback _callback) throws ApiException { + public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, String operator, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = changeUserEnabledValidateBeforeCall(openUserDTO, _callback); + okhttp3.Call localVarCall = changeUserEnabledValidateBeforeCall(openUserDTO, operator, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } @@ -205,6 +213,7 @@ public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, final ApiCal * Build call for createOrUpdateUser * @param openUserDTO (required) * @param isCreate true 表示创建用户,false 表示更新用户 (optional, default to false) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -216,7 +225,7 @@ public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, final ApiCal 403 权限不足 - */ - public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCreate, String operator, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -245,6 +254,10 @@ public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCr localVarQueryParams.addAll(localVarApiClient.parameterToPair("isCreate", isCreate)); } + if (operator != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("operator", operator)); + } + final String[] localVarAccepts = { "application/json" }; @@ -266,21 +279,22 @@ public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCr } @SuppressWarnings("rawtypes") - private okhttp3.Call createOrUpdateUserValidateBeforeCall(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback _callback) throws ApiException { + private okhttp3.Call createOrUpdateUserValidateBeforeCall(OpenUserDTO openUserDTO, Boolean isCreate, String operator, final ApiCallback _callback) throws ApiException { // verify the required parameter 'openUserDTO' is set if (openUserDTO == null) { throw new ApiException("Missing the required parameter 'openUserDTO' when calling createOrUpdateUser(Async)"); } - return createOrUpdateUserCall(openUserDTO, isCreate, _callback); + return createOrUpdateUserCall(openUserDTO, isCreate, operator, _callback); } /** - * 创建或更新Portal用户(new added) - * POST /openapi/v1/users + * 创建或更新用户(new added) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * @param openUserDTO (required) * @param isCreate true 表示创建用户,false 表示更新用户 (optional, default to false) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -290,15 +304,16 @@ private okhttp3.Call createOrUpdateUserValidateBeforeCall(OpenUserDTO openUserDT
403 权限不足 -
*/ - public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException { - createOrUpdateUserWithHttpInfo(openUserDTO, isCreate); + public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate, String operator) throws ApiException { + createOrUpdateUserWithHttpInfo(openUserDTO, isCreate, operator); } /** - * 创建或更新Portal用户(new added) - * POST /openapi/v1/users + * 创建或更新用户(new added) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * @param openUserDTO (required) * @param isCreate true 表示创建用户,false 表示更新用户 (optional, default to false) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -309,16 +324,17 @@ public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate) throws 403 权限不足 - */ - public ApiResponse createOrUpdateUserWithHttpInfo(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException { - okhttp3.Call localVarCall = createOrUpdateUserValidateBeforeCall(openUserDTO, isCreate, null); + public ApiResponse createOrUpdateUserWithHttpInfo(OpenUserDTO openUserDTO, Boolean isCreate, String operator) throws ApiException { + okhttp3.Call localVarCall = createOrUpdateUserValidateBeforeCall(openUserDTO, isCreate, operator, null); return localVarApiClient.execute(localVarCall); } /** - * 创建或更新Portal用户(new added) (asynchronously) - * POST /openapi/v1/users + * 创建或更新用户(new added) (asynchronously) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * @param openUserDTO (required) * @param isCreate true 表示创建用户,false 表示更新用户 (optional, default to false) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (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 @@ -330,9 +346,9 @@ public ApiResponse createOrUpdateUserWithHttpInfo(OpenUserDTO openUserDTO, 403 权限不足 - */ - public okhttp3.Call createOrUpdateUserAsync(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createOrUpdateUserAsync(OpenUserDTO openUserDTO, Boolean isCreate, String operator, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = createOrUpdateUserValidateBeforeCall(openUserDTO, isCreate, _callback); + okhttp3.Call localVarCall = createOrUpdateUserValidateBeforeCall(openUserDTO, isCreate, operator, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } @@ -457,6 +473,137 @@ public okhttp3.Call getCurrentUserAsync(final ApiCallback _call localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for getUserByUserId + * @param userId 用户ID (required) + * @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 成功获取用户 -
400 请求参数错误或用户不存在 -
403 权限不足 -
+ */ + public okhttp3.Call getUserByUserIdCall(String userId, 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/users/{userId}" + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); + + 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 getUserByUserIdValidateBeforeCall(String userId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserByUserId(Async)"); + } + + return getUserByUserIdCall(userId, _callback); + + } + + /** + * 获取指定用户(new added) + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * @param userId 用户ID (required) + * @return OpenUserInfoDTO + * @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 成功获取用户 -
400 请求参数错误或用户不存在 -
403 权限不足 -
+ */ + public OpenUserInfoDTO getUserByUserId(String userId) throws ApiException { + ApiResponse localVarResp = getUserByUserIdWithHttpInfo(userId); + return localVarResp.getData(); + } + + /** + * 获取指定用户(new added) + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * @param userId 用户ID (required) + * @return ApiResponse<OpenUserInfoDTO> + * @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 成功获取用户 -
400 请求参数错误或用户不存在 -
403 权限不足 -
+ */ + public ApiResponse getUserByUserIdWithHttpInfo(String userId) throws ApiException { + okhttp3.Call localVarCall = getUserByUserIdValidateBeforeCall(userId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 获取指定用户(new added) (asynchronously) + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * @param userId 用户ID (required) + * @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 成功获取用户 -
400 请求参数错误或用户不存在 -
403 权限不足 -
+ */ + public okhttp3.Call getUserByUserIdAsync(String userId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByUserIdValidateBeforeCall(userId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for searchUsers * @param keyword 用户名、显示名或邮箱关键字 (required) @@ -471,7 +618,7 @@ public okhttp3.Call getCurrentUserAsync(final ApiCallback _call Status Code Description Response Headers 200 成功获取用户列表 - 401 未登录或未授权访问 - - 403 仅支持Portal用户登录态访问 - + 403 权限不足 - */ public okhttp3.Call searchUsersCall(String keyword, Boolean includeInactiveUsers, Integer offset, Integer limit, final ApiCallback _callback) throws ApiException { @@ -546,8 +693,8 @@ private okhttp3.Call searchUsersValidateBeforeCall(String keyword, Boolean inclu } /** - * 搜索Portal用户(new added) - * GET /openapi/v1/users + * 搜索用户(new added) + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 * @param keyword 用户名、显示名或邮箱关键字 (required) * @param includeInactiveUsers 是否包含禁用用户 (optional, default to false) * @param offset 偏移量 (optional, default to 0) @@ -559,7 +706,7 @@ private okhttp3.Call searchUsersValidateBeforeCall(String keyword, Boolean inclu Status Code Description Response Headers 200 成功获取用户列表 - 401 未登录或未授权访问 - - 403 仅支持Portal用户登录态访问 - + 403 权限不足 - */ public List searchUsers(String keyword, Boolean includeInactiveUsers, Integer offset, Integer limit) throws ApiException { @@ -568,8 +715,8 @@ public List searchUsers(String keyword, Boolean includeInactive } /** - * 搜索Portal用户(new added) - * GET /openapi/v1/users + * 搜索用户(new added) + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 * @param keyword 用户名、显示名或邮箱关键字 (required) * @param includeInactiveUsers 是否包含禁用用户 (optional, default to false) * @param offset 偏移量 (optional, default to 0) @@ -581,7 +728,7 @@ public List searchUsers(String keyword, Boolean includeInactive Status Code Description Response Headers 200 成功获取用户列表 - 401 未登录或未授权访问 - - 403 仅支持Portal用户登录态访问 - + 403 权限不足 - */ public ApiResponse> searchUsersWithHttpInfo(String keyword, Boolean includeInactiveUsers, Integer offset, Integer limit) throws ApiException { @@ -591,8 +738,8 @@ public ApiResponse> searchUsersWithHttpInfo(String keyword } /** - * 搜索Portal用户(new added) (asynchronously) - * GET /openapi/v1/users + * 搜索用户(new added) (asynchronously) + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 * @param keyword 用户名、显示名或邮箱关键字 (required) * @param includeInactiveUsers 是否包含禁用用户 (optional, default to false) * @param offset 偏移量 (optional, default to 0) @@ -605,7 +752,7 @@ public ApiResponse> searchUsersWithHttpInfo(String keyword Status Code Description Response Headers 200 成功获取用户列表 - 401 未登录或未授权访问 - - 403 仅支持Portal用户登录态访问 - + 403 权限不足 - */ public okhttp3.Call searchUsersAsync(String keyword, Boolean includeInactiveUsers, Integer offset, Integer limit, final ApiCallback> _callback) throws ApiException { diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java new file mode 100644 index 00000000..0271ad39 --- /dev/null +++ b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java @@ -0,0 +1,442 @@ +/* + * 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\"
+ * + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OpenConsumerCreateRequestDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OpenConsumerCreateRequestDTO { + public static final String SERIALIZED_NAME_APP_ID = "appId"; + @SerializedName(SERIALIZED_NAME_APP_ID) + private String appId; + + public static final String SERIALIZED_NAME_ALLOW_CREATE_APPLICATION = "allowCreateApplication"; + @SerializedName(SERIALIZED_NAME_ALLOW_CREATE_APPLICATION) + private Boolean allowCreateApplication = false; + + public static final String SERIALIZED_NAME_ALLOW_MANAGE_USERS = "allowManageUsers"; + @SerializedName(SERIALIZED_NAME_ALLOW_MANAGE_USERS) + private Boolean allowManageUsers = false; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ORG_ID = "orgId"; + @SerializedName(SERIALIZED_NAME_ORG_ID) + private String orgId; + + public static final String SERIALIZED_NAME_ORG_NAME = "orgName"; + @SerializedName(SERIALIZED_NAME_ORG_NAME) + private String orgName; + + public static final String SERIALIZED_NAME_OWNER_NAME = "ownerName"; + @SerializedName(SERIALIZED_NAME_OWNER_NAME) + private String ownerName; + + public static final String SERIALIZED_NAME_RATE_LIMIT_ENABLED = "rateLimitEnabled"; + @SerializedName(SERIALIZED_NAME_RATE_LIMIT_ENABLED) + private Boolean rateLimitEnabled = false; + + public static final String SERIALIZED_NAME_RATE_LIMIT = "rateLimit"; + @SerializedName(SERIALIZED_NAME_RATE_LIMIT) + private Integer rateLimit = 0; + + public OpenConsumerCreateRequestDTO() { + } + + public OpenConsumerCreateRequestDTO appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * 第三方应用ID + * @return appId + **/ + @javax.annotation.Nullable + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public OpenConsumerCreateRequestDTO allowCreateApplication(Boolean allowCreateApplication) { + + this.allowCreateApplication = allowCreateApplication; + return this; + } + + /** + * 是否允许该Consumer Token创建应用 + * @return allowCreateApplication + **/ + @javax.annotation.Nullable + public Boolean getAllowCreateApplication() { + return allowCreateApplication; + } + + + public void setAllowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + } + + + public OpenConsumerCreateRequestDTO allowManageUsers(Boolean allowManageUsers) { + + this.allowManageUsers = allowManageUsers; + return this; + } + + /** + * 是否允许该Consumer Token管理用户 + * @return allowManageUsers + **/ + @javax.annotation.Nullable + public Boolean getAllowManageUsers() { + return allowManageUsers; + } + + + public void setAllowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + } + + + public OpenConsumerCreateRequestDTO name(String name) { + + this.name = name; + return this; + } + + /** + * 第三方应用名称 + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public OpenConsumerCreateRequestDTO orgId(String orgId) { + + this.orgId = orgId; + return this; + } + + /** + * 部门ID + * @return orgId + **/ + @javax.annotation.Nullable + public String getOrgId() { + return orgId; + } + + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + + public OpenConsumerCreateRequestDTO orgName(String orgName) { + + this.orgName = orgName; + return this; + } + + /** + * 部门名称 + * @return orgName + **/ + @javax.annotation.Nullable + public String getOrgName() { + return orgName; + } + + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + + public OpenConsumerCreateRequestDTO ownerName(String ownerName) { + + this.ownerName = ownerName; + return this; + } + + /** + * 负责人用户名 + * @return ownerName + **/ + @javax.annotation.Nullable + public String getOwnerName() { + return ownerName; + } + + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + + public OpenConsumerCreateRequestDTO rateLimitEnabled(Boolean rateLimitEnabled) { + + this.rateLimitEnabled = rateLimitEnabled; + return this; + } + + /** + * 是否开启限流 + * @return rateLimitEnabled + **/ + @javax.annotation.Nullable + public Boolean getRateLimitEnabled() { + return rateLimitEnabled; + } + + + public void setRateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + } + + + public OpenConsumerCreateRequestDTO rateLimit(Integer rateLimit) { + + this.rateLimit = rateLimit; + return this; + } + + /** + * 限流QPS,0表示不限流 + * @return rateLimit + **/ + @javax.annotation.Nullable + public Integer getRateLimit() { + return rateLimit; + } + + + public void setRateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO = (OpenConsumerCreateRequestDTO) o; + return Objects.equals(this.appId, openConsumerCreateRequestDTO.appId) && + Objects.equals(this.allowCreateApplication, openConsumerCreateRequestDTO.allowCreateApplication) && + Objects.equals(this.allowManageUsers, openConsumerCreateRequestDTO.allowManageUsers) && + Objects.equals(this.name, openConsumerCreateRequestDTO.name) && + Objects.equals(this.orgId, openConsumerCreateRequestDTO.orgId) && + Objects.equals(this.orgName, openConsumerCreateRequestDTO.orgName) && + Objects.equals(this.ownerName, openConsumerCreateRequestDTO.ownerName) && + Objects.equals(this.rateLimitEnabled, openConsumerCreateRequestDTO.rateLimitEnabled) && + Objects.equals(this.rateLimit, openConsumerCreateRequestDTO.rateLimit); + } + + @Override + public int hashCode() { + return Objects.hash(appId, allowCreateApplication, allowManageUsers, name, orgId, orgName, ownerName, rateLimitEnabled, rateLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenConsumerCreateRequestDTO {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); + sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" rateLimitEnabled: ").append(toIndentedString(rateLimitEnabled)).append("\n"); + sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("appId"); + openapiFields.add("allowCreateApplication"); + openapiFields.add("allowManageUsers"); + openapiFields.add("name"); + openapiFields.add("orgId"); + openapiFields.add("orgName"); + openapiFields.add("ownerName"); + openapiFields.add("rateLimitEnabled"); + openapiFields.add("rateLimit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OpenConsumerCreateRequestDTO + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OpenConsumerCreateRequestDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenConsumerCreateRequestDTO is not found in the empty JSON string", OpenConsumerCreateRequestDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!OpenConsumerCreateRequestDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenConsumerCreateRequestDTO` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + } + } + 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("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("orgId") != null && !jsonObj.get("orgId").isJsonNull()) && !jsonObj.get("orgId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orgId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orgId").toString())); + } + if ((jsonObj.get("orgName") != null && !jsonObj.get("orgName").isJsonNull()) && !jsonObj.get("orgName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orgName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orgName").toString())); + } + if ((jsonObj.get("ownerName") != null && !jsonObj.get("ownerName").isJsonNull()) && !jsonObj.get("ownerName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ownerName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ownerName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OpenConsumerCreateRequestDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OpenConsumerCreateRequestDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OpenConsumerCreateRequestDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OpenConsumerCreateRequestDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OpenConsumerCreateRequestDTO read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OpenConsumerCreateRequestDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of OpenConsumerCreateRequestDTO + * @throws IOException if the JSON string is invalid with respect to OpenConsumerCreateRequestDTO + */ + public static OpenConsumerCreateRequestDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OpenConsumerCreateRequestDTO.class); + } + + /** + * Convert an instance of OpenConsumerCreateRequestDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java new file mode 100644 index 00000000..e70f53c2 --- /dev/null +++ b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java @@ -0,0 +1,504 @@ +/* + * 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\"
+ * + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OpenConsumerInfoDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OpenConsumerInfoDTO { + public static final String SERIALIZED_NAME_APP_ID = "appId"; + @SerializedName(SERIALIZED_NAME_APP_ID) + private String appId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ORG_ID = "orgId"; + @SerializedName(SERIALIZED_NAME_ORG_ID) + private String orgId; + + public static final String SERIALIZED_NAME_ORG_NAME = "orgName"; + @SerializedName(SERIALIZED_NAME_ORG_NAME) + private String orgName; + + public static final String SERIALIZED_NAME_OWNER_NAME = "ownerName"; + @SerializedName(SERIALIZED_NAME_OWNER_NAME) + private String ownerName; + + public static final String SERIALIZED_NAME_OWNER_EMAIL = "ownerEmail"; + @SerializedName(SERIALIZED_NAME_OWNER_EMAIL) + private String ownerEmail; + + public static final String SERIALIZED_NAME_CONSUMER_ID = "consumerId"; + @SerializedName(SERIALIZED_NAME_CONSUMER_ID) + private Long consumerId; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public static final String SERIALIZED_NAME_ALLOW_CREATE_APPLICATION = "allowCreateApplication"; + @SerializedName(SERIALIZED_NAME_ALLOW_CREATE_APPLICATION) + private Boolean allowCreateApplication = false; + + public static final String SERIALIZED_NAME_ALLOW_MANAGE_USERS = "allowManageUsers"; + @SerializedName(SERIALIZED_NAME_ALLOW_MANAGE_USERS) + private Boolean allowManageUsers = false; + + public static final String SERIALIZED_NAME_RATE_LIMIT = "rateLimit"; + @SerializedName(SERIALIZED_NAME_RATE_LIMIT) + private Integer rateLimit = 0; + + public OpenConsumerInfoDTO() { + } + + public OpenConsumerInfoDTO appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * 第三方应用ID + * @return appId + **/ + @javax.annotation.Nullable + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public OpenConsumerInfoDTO name(String name) { + + this.name = name; + return this; + } + + /** + * 第三方应用名称 + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public OpenConsumerInfoDTO orgId(String orgId) { + + this.orgId = orgId; + return this; + } + + /** + * 部门ID + * @return orgId + **/ + @javax.annotation.Nullable + public String getOrgId() { + return orgId; + } + + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + + public OpenConsumerInfoDTO orgName(String orgName) { + + this.orgName = orgName; + return this; + } + + /** + * 部门名称 + * @return orgName + **/ + @javax.annotation.Nullable + public String getOrgName() { + return orgName; + } + + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + + public OpenConsumerInfoDTO ownerName(String ownerName) { + + this.ownerName = ownerName; + return this; + } + + /** + * 负责人用户名 + * @return ownerName + **/ + @javax.annotation.Nullable + public String getOwnerName() { + return ownerName; + } + + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + + public OpenConsumerInfoDTO ownerEmail(String ownerEmail) { + + this.ownerEmail = ownerEmail; + return this; + } + + /** + * 负责人邮箱 + * @return ownerEmail + **/ + @javax.annotation.Nullable + public String getOwnerEmail() { + return ownerEmail; + } + + + public void setOwnerEmail(String ownerEmail) { + this.ownerEmail = ownerEmail; + } + + + public OpenConsumerInfoDTO consumerId(Long consumerId) { + + this.consumerId = consumerId; + return this; + } + + /** + * Consumer ID + * @return consumerId + **/ + @javax.annotation.Nullable + public Long getConsumerId() { + return consumerId; + } + + + public void setConsumerId(Long consumerId) { + this.consumerId = consumerId; + } + + + public OpenConsumerInfoDTO token(String token) { + + this.token = token; + return this; + } + + /** + * Consumer Token,仅在创建或按应用查询详情时返回 + * @return token + **/ + @javax.annotation.Nullable + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + public OpenConsumerInfoDTO allowCreateApplication(Boolean allowCreateApplication) { + + this.allowCreateApplication = allowCreateApplication; + return this; + } + + /** + * 是否允许该Consumer Token创建应用 + * @return allowCreateApplication + **/ + @javax.annotation.Nullable + public Boolean getAllowCreateApplication() { + return allowCreateApplication; + } + + + public void setAllowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + } + + + public OpenConsumerInfoDTO allowManageUsers(Boolean allowManageUsers) { + + this.allowManageUsers = allowManageUsers; + return this; + } + + /** + * 是否允许该Consumer Token管理用户 + * @return allowManageUsers + **/ + @javax.annotation.Nullable + public Boolean getAllowManageUsers() { + return allowManageUsers; + } + + + public void setAllowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + } + + + public OpenConsumerInfoDTO rateLimit(Integer rateLimit) { + + this.rateLimit = rateLimit; + return this; + } + + /** + * 限流QPS,0表示不限流 + * @return rateLimit + **/ + @javax.annotation.Nullable + public Integer getRateLimit() { + return rateLimit; + } + + + public void setRateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenConsumerInfoDTO openConsumerInfoDTO = (OpenConsumerInfoDTO) o; + return Objects.equals(this.appId, openConsumerInfoDTO.appId) && + Objects.equals(this.name, openConsumerInfoDTO.name) && + Objects.equals(this.orgId, openConsumerInfoDTO.orgId) && + Objects.equals(this.orgName, openConsumerInfoDTO.orgName) && + Objects.equals(this.ownerName, openConsumerInfoDTO.ownerName) && + Objects.equals(this.ownerEmail, openConsumerInfoDTO.ownerEmail) && + Objects.equals(this.consumerId, openConsumerInfoDTO.consumerId) && + Objects.equals(this.token, openConsumerInfoDTO.token) && + Objects.equals(this.allowCreateApplication, openConsumerInfoDTO.allowCreateApplication) && + Objects.equals(this.allowManageUsers, openConsumerInfoDTO.allowManageUsers) && + Objects.equals(this.rateLimit, openConsumerInfoDTO.rateLimit); + } + + @Override + public int hashCode() { + return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, token, allowCreateApplication, allowManageUsers, rateLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenConsumerInfoDTO {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" ownerEmail: ").append(toIndentedString(ownerEmail)).append("\n"); + sb.append(" consumerId: ").append(toIndentedString(consumerId)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); + sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); + sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("appId"); + openapiFields.add("name"); + openapiFields.add("orgId"); + openapiFields.add("orgName"); + openapiFields.add("ownerName"); + openapiFields.add("ownerEmail"); + openapiFields.add("consumerId"); + openapiFields.add("token"); + openapiFields.add("allowCreateApplication"); + openapiFields.add("allowManageUsers"); + openapiFields.add("rateLimit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OpenConsumerInfoDTO + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OpenConsumerInfoDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenConsumerInfoDTO is not found in the empty JSON string", OpenConsumerInfoDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!OpenConsumerInfoDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenConsumerInfoDTO` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + } + } + 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("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("orgId") != null && !jsonObj.get("orgId").isJsonNull()) && !jsonObj.get("orgId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orgId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orgId").toString())); + } + if ((jsonObj.get("orgName") != null && !jsonObj.get("orgName").isJsonNull()) && !jsonObj.get("orgName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orgName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orgName").toString())); + } + if ((jsonObj.get("ownerName") != null && !jsonObj.get("ownerName").isJsonNull()) && !jsonObj.get("ownerName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ownerName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ownerName").toString())); + } + if ((jsonObj.get("ownerEmail") != null && !jsonObj.get("ownerEmail").isJsonNull()) && !jsonObj.get("ownerEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ownerEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ownerEmail").toString())); + } + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OpenConsumerInfoDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OpenConsumerInfoDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OpenConsumerInfoDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OpenConsumerInfoDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OpenConsumerInfoDTO read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OpenConsumerInfoDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of OpenConsumerInfoDTO + * @throws IOException if the JSON string is invalid with respect to OpenConsumerInfoDTO + */ + public static OpenConsumerInfoDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OpenConsumerInfoDTO.class); + } + + /** + * Convert an instance of OpenConsumerInfoDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java index 1be6fc61..57ae5706 100644 --- a/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java @@ -14,6 +14,8 @@ import org.openapitools.client.ApiException; import java.io.File; +import org.openapitools.client.model.OpenConsumerCreateRequestDTO; +import org.openapitools.client.model.OpenConsumerInfoDTO; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -100,9 +102,9 @@ public void checkSystemHealthTest() throws ApiException { */ @Test public void createConsumerTest() throws ApiException { - Object body = null; + OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO = null; String expires = null; - Object response = api.createConsumer(body, expires); + OpenConsumerInfoDTO response = api.createConsumer(openConsumerCreateRequestDTO, expires); // TODO: test validations } @@ -412,7 +414,7 @@ public void getAuditPropertiesTest() throws ApiException { public void getConsumerListTest() throws ApiException { Integer page = null; Integer size = null; - List response = api.getConsumerList(page, size); + List response = api.getConsumerList(page, size); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/api/PortalUserManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java similarity index 66% rename from java-client/src/test/java/org/openapitools/client/api/PortalUserManagementApiTest.java rename to java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java index 20d981b9..8b2c15b1 100644 --- a/java-client/src/test/java/org/openapitools/client/api/PortalUserManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java @@ -25,31 +25,32 @@ import java.util.Map; /** - * API tests for PortalUserManagementApi + * API tests for UserManagementApi */ @Disabled -public class PortalUserManagementApiTest { +public class UserManagementApiTest { - private final PortalUserManagementApi api = new PortalUserManagementApi(); + private final UserManagementApi api = new UserManagementApi(); /** - * 修改Portal用户启用状态(new added) + * 修改用户启用状态(new added) * - * PUT /openapi/v1/users/enabled + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * * @throws ApiException if the Api call fails */ @Test public void changeUserEnabledTest() throws ApiException { OpenUserDTO openUserDTO = null; - api.changeUserEnabled(openUserDTO); + String operator = null; + api.changeUserEnabled(openUserDTO, operator); // TODO: test validations } /** - * 创建或更新Portal用户(new added) + * 创建或更新用户(new added) * - * POST /openapi/v1/users + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * * @throws ApiException if the Api call fails */ @@ -57,7 +58,8 @@ public void changeUserEnabledTest() throws ApiException { public void createOrUpdateUserTest() throws ApiException { OpenUserDTO openUserDTO = null; Boolean isCreate = null; - api.createOrUpdateUser(openUserDTO, isCreate); + String operator = null; + api.createOrUpdateUser(openUserDTO, isCreate, operator); // TODO: test validations } @@ -75,9 +77,23 @@ public void getCurrentUserTest() throws ApiException { } /** - * 搜索Portal用户(new added) + * 获取指定用户(new added) * - * GET /openapi/v1/users + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByUserIdTest() throws ApiException { + String userId = null; + OpenUserInfoDTO response = api.getUserByUserId(userId); + // TODO: test validations + } + + /** + * 搜索用户(new added) + * + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 * * @throws ApiException if the Api call fails */ diff --git a/java-client/src/test/java/org/openapitools/client/model/OpenConsumerCreateRequestDTOTest.java b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerCreateRequestDTOTest.java new file mode 100644 index 00000000..d0d8c2b9 --- /dev/null +++ b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerCreateRequestDTOTest.java @@ -0,0 +1,111 @@ +/* + * 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\"
+ * + * + * + * 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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OpenConsumerCreateRequestDTO + */ +public class OpenConsumerCreateRequestDTOTest { + private final OpenConsumerCreateRequestDTO model = new OpenConsumerCreateRequestDTO(); + + /** + * Model tests for OpenConsumerCreateRequestDTO + */ + @Test + public void testOpenConsumerCreateRequestDTO() { + // TODO: test OpenConsumerCreateRequestDTO + } + + /** + * Test the property 'appId' + */ + @Test + public void appIdTest() { + // TODO: test appId + } + + /** + * Test the property 'allowCreateApplication' + */ + @Test + public void allowCreateApplicationTest() { + // TODO: test allowCreateApplication + } + + /** + * Test the property 'allowManageUsers' + */ + @Test + public void allowManageUsersTest() { + // TODO: test allowManageUsers + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'orgId' + */ + @Test + public void orgIdTest() { + // TODO: test orgId + } + + /** + * Test the property 'orgName' + */ + @Test + public void orgNameTest() { + // TODO: test orgName + } + + /** + * Test the property 'ownerName' + */ + @Test + public void ownerNameTest() { + // TODO: test ownerName + } + + /** + * Test the property 'rateLimitEnabled' + */ + @Test + public void rateLimitEnabledTest() { + // TODO: test rateLimitEnabled + } + + /** + * Test the property 'rateLimit' + */ + @Test + public void rateLimitTest() { + // TODO: test rateLimit + } + +} diff --git a/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java new file mode 100644 index 00000000..37b3dfed --- /dev/null +++ b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java @@ -0,0 +1,127 @@ +/* + * 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\"
+ * + * + * + * 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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OpenConsumerInfoDTO + */ +public class OpenConsumerInfoDTOTest { + private final OpenConsumerInfoDTO model = new OpenConsumerInfoDTO(); + + /** + * Model tests for OpenConsumerInfoDTO + */ + @Test + public void testOpenConsumerInfoDTO() { + // TODO: test OpenConsumerInfoDTO + } + + /** + * Test the property 'appId' + */ + @Test + public void appIdTest() { + // TODO: test appId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'orgId' + */ + @Test + public void orgIdTest() { + // TODO: test orgId + } + + /** + * Test the property 'orgName' + */ + @Test + public void orgNameTest() { + // TODO: test orgName + } + + /** + * Test the property 'ownerName' + */ + @Test + public void ownerNameTest() { + // TODO: test ownerName + } + + /** + * Test the property 'ownerEmail' + */ + @Test + public void ownerEmailTest() { + // TODO: test ownerEmail + } + + /** + * Test the property 'consumerId' + */ + @Test + public void consumerIdTest() { + // TODO: test consumerId + } + + /** + * Test the property 'token' + */ + @Test + public void tokenTest() { + // TODO: test token + } + + /** + * Test the property 'allowCreateApplication' + */ + @Test + public void allowCreateApplicationTest() { + // TODO: test allowCreateApplication + } + + /** + * Test the property 'allowManageUsers' + */ + @Test + public void allowManageUsersTest() { + // TODO: test allowManageUsers + } + + /** + * Test the property 'rateLimit' + */ + @Test + public void rateLimitTest() { + // TODO: test rateLimit + } + +} diff --git a/python/.openapi-generator/FILES b/python/.openapi-generator/FILES index 8d323a98..44c1557f 100644 --- a/python/.openapi-generator/FILES +++ b/python/.openapi-generator/FILES @@ -19,8 +19,8 @@ apollo_openapi/apis/tags/namespace_management_api.py apollo_openapi/apis/tags/organization_management_api.py apollo_openapi/apis/tags/permission_management_api.py apollo_openapi/apis/tags/portal_management_api.py -apollo_openapi/apis/tags/portal_user_management_api.py apollo_openapi/apis/tags/release_management_api.py +apollo_openapi/apis/tags/user_management_api.py apollo_openapi/configuration.py apollo_openapi/exceptions.py apollo_openapi/model/__init__.py @@ -44,6 +44,10 @@ apollo_openapi/model/open_cluster_dto.py apollo_openapi/model/open_cluster_dto.pyi apollo_openapi/model/open_cluster_namespace_role_user_dto.py apollo_openapi/model/open_cluster_namespace_role_user_dto.pyi +apollo_openapi/model/open_consumer_create_request_dto.py +apollo_openapi/model/open_consumer_create_request_dto.pyi +apollo_openapi/model/open_consumer_info_dto.py +apollo_openapi/model/open_consumer_info_dto.pyi apollo_openapi/model/open_create_app_dto.py apollo_openapi/model/open_create_app_dto.pyi apollo_openapi/model/open_create_namespace_dto.py @@ -122,8 +126,8 @@ docs/apis/tags/NamespaceManagementApi.md docs/apis/tags/OrganizationManagementApi.md docs/apis/tags/PermissionManagementApi.md docs/apis/tags/PortalManagementApi.md -docs/apis/tags/PortalUserManagementApi.md docs/apis/tags/ReleaseManagementApi.md +docs/apis/tags/UserManagementApi.md docs/models/ExceptionResponse.md docs/models/MapString.md docs/models/NamespaceGrayDelReleaseDTO.md @@ -134,6 +138,8 @@ docs/models/OpenAppNamespaceDTO.md docs/models/OpenAppRoleUserDTO.md docs/models/OpenClusterDTO.md docs/models/OpenClusterNamespaceRoleUserDTO.md +docs/models/OpenConsumerCreateRequestDTO.md +docs/models/OpenConsumerInfoDTO.md docs/models/OpenCreateAppDTO.md docs/models/OpenCreateNamespaceDTO.md docs/models/OpenEnvClusterDTO.md @@ -182,6 +188,8 @@ test/test_models/test_open_app_namespace_dto.py test/test_models/test_open_app_role_user_dto.py test/test_models/test_open_cluster_dto.py test/test_models/test_open_cluster_namespace_role_user_dto.py +test/test_models/test_open_consumer_create_request_dto.py +test/test_models/test_open_consumer_info_dto.py test/test_models/test_open_create_app_dto.py test/test_models/test_open_create_namespace_dto.py test/test_models/test_open_env_cluster_dto.py diff --git a/python/README.md b/python/README.md index 433209fd..ee9c6f02 100644 --- a/python/README.md +++ b/python/README.md @@ -18,8 +18,8 @@ This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 0.3.5 -- Package version: 0.3.5 +- API version: 0.3.6 +- Package version: 0.3.6 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. @@ -321,10 +321,6 @@ Class | Method | HTTP request | Description *PortalManagementApi* | [**search_audit_logs**](docs/apis/tags/PortalManagementApi.md#search_audit_logs) | **get** /openapi/v1/apollo/audit/logs/by-name-or-type-or-operator | 搜索审计日志(new added) *PortalManagementApi* | [**search_item_info_by_key_or_value**](docs/apis/tags/PortalManagementApi.md#search_item_info_by_key_or_value) | **get** /openapi/v1/global-search/item-info/by-key-or-value | 按Key或Value全局搜索配置(new added) *PortalManagementApi* | [**top_favorite**](docs/apis/tags/PortalManagementApi.md#top_favorite) | **put** /openapi/v1/favorites/{favoriteId} | 收藏置顶(new added) -*PortalUserManagementApi* | [**change_user_enabled**](docs/apis/tags/PortalUserManagementApi.md#change_user_enabled) | **put** /openapi/v1/users/enabled | 修改Portal用户启用状态(new added) -*PortalUserManagementApi* | [**create_or_update_user**](docs/apis/tags/PortalUserManagementApi.md#create_or_update_user) | **post** /openapi/v1/users | 创建或更新Portal用户(new added) -*PortalUserManagementApi* | [**get_current_user**](docs/apis/tags/PortalUserManagementApi.md#get_current_user) | **get** /openapi/v1/user | 获取当前Portal用户(new added) -*PortalUserManagementApi* | [**search_users**](docs/apis/tags/PortalUserManagementApi.md#search_users) | **get** /openapi/v1/users | 搜索Portal用户(new added) *ReleaseManagementApi* | [**compare_release**](docs/apis/tags/ReleaseManagementApi.md#compare_release) | **get** /openapi/v1/envs/{env}/releases/comparison | Compare two releases *ReleaseManagementApi* | [**create_gray_del_release**](docs/apis/tags/ReleaseManagementApi.md#create_gray_del_release) | **post** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/gray-del-releases | 创建灰度删除发布 (original openapi) *ReleaseManagementApi* | [**create_gray_release**](docs/apis/tags/ReleaseManagementApi.md#create_gray_release) | **post** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases | 创建灰度发布 (original openapi) @@ -333,6 +329,11 @@ Class | Method | HTTP request | Description *ReleaseManagementApi* | [**get_release_by_id**](docs/apis/tags/ReleaseManagementApi.md#get_release_by_id) | **get** /openapi/v1/envs/{env}/releases/{releaseId} | 获取发布详情 (new added) *ReleaseManagementApi* | [**load_latest_active_release**](docs/apis/tags/ReleaseManagementApi.md#load_latest_active_release) | **get** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest | 获取最新活跃发布 (original openapi) *ReleaseManagementApi* | [**rollback**](docs/apis/tags/ReleaseManagementApi.md#rollback) | **put** /openapi/v1/envs/{env}/releases/{releaseId}/rollback | 回滚发布 (original openapi) +*UserManagementApi* | [**change_user_enabled**](docs/apis/tags/UserManagementApi.md#change_user_enabled) | **put** /openapi/v1/users/enabled | 修改用户启用状态(new added) +*UserManagementApi* | [**create_or_update_user**](docs/apis/tags/UserManagementApi.md#create_or_update_user) | **post** /openapi/v1/users | 创建或更新用户(new added) +*UserManagementApi* | [**get_current_user**](docs/apis/tags/UserManagementApi.md#get_current_user) | **get** /openapi/v1/user | 获取当前Portal用户(new added) +*UserManagementApi* | [**get_user_by_user_id**](docs/apis/tags/UserManagementApi.md#get_user_by_user_id) | **get** /openapi/v1/users/{userId} | 获取指定用户(new added) +*UserManagementApi* | [**search_users**](docs/apis/tags/UserManagementApi.md#search_users) | **get** /openapi/v1/users | 搜索用户(new added) ## Documentation For Models @@ -346,6 +347,8 @@ Class | Method | HTTP request | Description - [OpenAppRoleUserDTO](docs/models/OpenAppRoleUserDTO.md) - [OpenClusterDTO](docs/models/OpenClusterDTO.md) - [OpenClusterNamespaceRoleUserDTO](docs/models/OpenClusterNamespaceRoleUserDTO.md) + - [OpenConsumerCreateRequestDTO](docs/models/OpenConsumerCreateRequestDTO.md) + - [OpenConsumerInfoDTO](docs/models/OpenConsumerInfoDTO.md) - [OpenCreateAppDTO](docs/models/OpenCreateAppDTO.md) - [OpenCreateNamespaceDTO](docs/models/OpenCreateNamespaceDTO.md) - [OpenEnvClusterDTO](docs/models/OpenEnvClusterDTO.md) diff --git a/python/apollo_openapi/__init__.py b/python/apollo_openapi/__init__.py index 2148a5ac..e50ab444 100644 --- a/python/apollo_openapi/__init__.py +++ b/python/apollo_openapi/__init__.py @@ -10,7 +10,7 @@ Generated by: https://openapi-generator.tech """ -__version__ = "0.3.5" +__version__ = "0.3.6" # import ApiClient from apollo_openapi.api_client import ApiClient diff --git a/python/apollo_openapi/api_client.py b/python/apollo_openapi/api_client.py index f2a64930..db3e6fee 100644 --- a/python/apollo_openapi/api_client.py +++ b/python/apollo_openapi/api_client.py @@ -1002,7 +1002,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/0.3.5/python' + self.user_agent = 'OpenAPI-Generator/0.3.6/python' def __enter__(self): return self diff --git a/python/apollo_openapi/apis/path_to_api.py b/python/apollo_openapi/apis/path_to_api.py index 0575979b..037ecff8 100644 --- a/python/apollo_openapi/apis/path_to_api.py +++ b/python/apollo_openapi/apis/path_to_api.py @@ -76,6 +76,7 @@ from apollo_openapi.apis.paths.openapi_v1_apps_app_id_envs_env_accesskeys_access_key_id_deactivation import OpenapiV1AppsAppIdEnvsEnvAccesskeysAccessKeyIdDeactivation from apollo_openapi.apis.paths.openapi_v1_user import OpenapiV1User from apollo_openapi.apis.paths.openapi_v1_users import OpenapiV1Users +from apollo_openapi.apis.paths.openapi_v1_users_user_id import OpenapiV1UsersUserId from apollo_openapi.apis.paths.openapi_v1_users_enabled import OpenapiV1UsersEnabled from apollo_openapi.apis.paths.openapi_v1_apollo_audit_properties import OpenapiV1ApolloAuditProperties from apollo_openapi.apis.paths.openapi_v1_apollo_audit_logs import OpenapiV1ApolloAuditLogs @@ -186,6 +187,7 @@ PathValues.OPENAPI_V1_APPS_APP_ID_ENVS_ENV_ACCESSKEYS_ACCESS_KEY_ID_DEACTIVATION: OpenapiV1AppsAppIdEnvsEnvAccesskeysAccessKeyIdDeactivation, PathValues.OPENAPI_V1_USER: OpenapiV1User, PathValues.OPENAPI_V1_USERS: OpenapiV1Users, + PathValues.OPENAPI_V1_USERS_USER_ID: OpenapiV1UsersUserId, PathValues.OPENAPI_V1_USERS_ENABLED: OpenapiV1UsersEnabled, PathValues.OPENAPI_V1_APOLLO_AUDIT_PROPERTIES: OpenapiV1ApolloAuditProperties, PathValues.OPENAPI_V1_APOLLO_AUDIT_LOGS: OpenapiV1ApolloAuditLogs, @@ -297,6 +299,7 @@ PathValues.OPENAPI_V1_APPS_APP_ID_ENVS_ENV_ACCESSKEYS_ACCESS_KEY_ID_DEACTIVATION: OpenapiV1AppsAppIdEnvsEnvAccesskeysAccessKeyIdDeactivation, PathValues.OPENAPI_V1_USER: OpenapiV1User, PathValues.OPENAPI_V1_USERS: OpenapiV1Users, + PathValues.OPENAPI_V1_USERS_USER_ID: OpenapiV1UsersUserId, PathValues.OPENAPI_V1_USERS_ENABLED: OpenapiV1UsersEnabled, PathValues.OPENAPI_V1_APOLLO_AUDIT_PROPERTIES: OpenapiV1ApolloAuditProperties, PathValues.OPENAPI_V1_APOLLO_AUDIT_LOGS: OpenapiV1ApolloAuditLogs, diff --git a/python/apollo_openapi/apis/paths/openapi_v1_users_user_id.py b/python/apollo_openapi/apis/paths/openapi_v1_users_user_id.py new file mode 100644 index 00000000..ed8499dc --- /dev/null +++ b/python/apollo_openapi/apis/paths/openapi_v1_users_user_id.py @@ -0,0 +1,7 @@ +from apollo_openapi.paths.openapi_v1_users_user_id.get import ApiForget + + +class OpenapiV1UsersUserId( + ApiForget, +): + pass diff --git a/python/apollo_openapi/apis/tag_to_api.py b/python/apollo_openapi/apis/tag_to_api.py index 101378c1..e73bc616 100644 --- a/python/apollo_openapi/apis/tag_to_api.py +++ b/python/apollo_openapi/apis/tag_to_api.py @@ -14,7 +14,7 @@ from apollo_openapi.apis.tags.environment_management_api import EnvironmentManagementApi from apollo_openapi.apis.tags.access_key_management_api import AccessKeyManagementApi from apollo_openapi.apis.tags.permission_management_api import PermissionManagementApi -from apollo_openapi.apis.tags.portal_user_management_api import PortalUserManagementApi +from apollo_openapi.apis.tags.user_management_api import UserManagementApi from apollo_openapi.apis.tags.portal_management_api import PortalManagementApi TagToApi = typing_extensions.TypedDict( @@ -33,7 +33,7 @@ TagValues.ENVIRONMENT_MANAGEMENT: EnvironmentManagementApi, TagValues.ACCESS_KEY_MANAGEMENT: AccessKeyManagementApi, TagValues.PERMISSION_MANAGEMENT: PermissionManagementApi, - TagValues.PORTAL_USER_MANAGEMENT: PortalUserManagementApi, + TagValues.USER_MANAGEMENT: UserManagementApi, TagValues.PORTAL_MANAGEMENT: PortalManagementApi, } ) @@ -53,7 +53,7 @@ TagValues.ENVIRONMENT_MANAGEMENT: EnvironmentManagementApi, TagValues.ACCESS_KEY_MANAGEMENT: AccessKeyManagementApi, TagValues.PERMISSION_MANAGEMENT: PermissionManagementApi, - TagValues.PORTAL_USER_MANAGEMENT: PortalUserManagementApi, + TagValues.USER_MANAGEMENT: UserManagementApi, TagValues.PORTAL_MANAGEMENT: PortalManagementApi, } ) diff --git a/python/apollo_openapi/apis/tags/__init__.py b/python/apollo_openapi/apis/tags/__init__.py index 27a218e5..f6786e57 100644 --- a/python/apollo_openapi/apis/tags/__init__.py +++ b/python/apollo_openapi/apis/tags/__init__.py @@ -19,5 +19,5 @@ class TagValues(str, enum.Enum): ENVIRONMENT_MANAGEMENT = "Environment Management" ACCESS_KEY_MANAGEMENT = "AccessKey Management" PERMISSION_MANAGEMENT = "Permission Management" - PORTAL_USER_MANAGEMENT = "Portal User Management" + USER_MANAGEMENT = "User Management" PORTAL_MANAGEMENT = "Portal Management" diff --git a/python/apollo_openapi/apis/tags/portal_user_management_api.py b/python/apollo_openapi/apis/tags/user_management_api.py similarity index 91% rename from python/apollo_openapi/apis/tags/portal_user_management_api.py rename to python/apollo_openapi/apis/tags/user_management_api.py index 3a31b6f4..23300050 100644 --- a/python/apollo_openapi/apis/tags/portal_user_management_api.py +++ b/python/apollo_openapi/apis/tags/user_management_api.py @@ -11,13 +11,15 @@ from apollo_openapi.paths.openapi_v1_users_enabled.put import ChangeUserEnabled from apollo_openapi.paths.openapi_v1_users.post import CreateOrUpdateUser from apollo_openapi.paths.openapi_v1_user.get import GetCurrentUser +from apollo_openapi.paths.openapi_v1_users_user_id.get import GetUserByUserId from apollo_openapi.paths.openapi_v1_users.get import SearchUsers -class PortalUserManagementApi( +class UserManagementApi( ChangeUserEnabled, CreateOrUpdateUser, GetCurrentUser, + GetUserByUserId, SearchUsers, ): """NOTE: This class is auto generated by OpenAPI Generator diff --git a/python/apollo_openapi/configuration.py b/python/apollo_openapi/configuration.py index 20e7f83f..4f9d26e3 100644 --- a/python/apollo_openapi/configuration.py +++ b/python/apollo_openapi/configuration.py @@ -402,8 +402,8 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 0.3.5\n"\ - "SDK Package Version: 0.3.5".\ + "Version of the API: 0.3.6\n"\ + "SDK Package Version: 0.3.6".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/python/apollo_openapi/model/open_consumer_create_request_dto.py b/python/apollo_openapi/model/open_consumer_create_request_dto.py new file mode 100644 index 00000000..b6548ca0 --- /dev/null +++ b/python/apollo_openapi/model/open_consumer_create_request_dto.py @@ -0,0 +1,157 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +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 OpenConsumerCreateRequestDTO( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + appId = schemas.StrSchema + allowCreateApplication = schemas.BoolSchema + allowManageUsers = schemas.BoolSchema + name = schemas.StrSchema + orgId = schemas.StrSchema + orgName = schemas.StrSchema + ownerName = schemas.StrSchema + rateLimitEnabled = schemas.BoolSchema + rateLimit = schemas.IntSchema + __annotations__ = { + "appId": appId, + "allowCreateApplication": allowCreateApplication, + "allowManageUsers": allowManageUsers, + "name": name, + "orgId": orgId, + "orgName": orgName, + "ownerName": ownerName, + "rateLimitEnabled": rateLimitEnabled, + "rateLimit": rateLimit, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowCreateApplication"]) -> MetaOapg.properties.allowCreateApplication: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> MetaOapg.properties.allowManageUsers: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgId"]) -> MetaOapg.properties.orgId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgName"]) -> MetaOapg.properties.orgName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerName"]) -> MetaOapg.properties.ownerName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> MetaOapg.properties.rateLimitEnabled: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "allowCreateApplication", "allowManageUsers", "name", "orgId", "orgName", "ownerName", "rateLimitEnabled", "rateLimit", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @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["allowCreateApplication"]) -> typing.Union[MetaOapg.properties.allowCreateApplication, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> typing.Union[MetaOapg.properties.allowManageUsers, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgId"]) -> typing.Union[MetaOapg.properties.orgId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgName"]) -> typing.Union[MetaOapg.properties.orgName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerName"]) -> typing.Union[MetaOapg.properties.ownerName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> typing.Union[MetaOapg.properties.rateLimitEnabled, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, 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["appId", "allowCreateApplication", "allowManageUsers", "name", "orgId", "orgName", "ownerName", "rateLimitEnabled", "rateLimit", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, + allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + orgId: typing.Union[MetaOapg.properties.orgId, str, schemas.Unset] = schemas.unset, + orgName: typing.Union[MetaOapg.properties.orgName, str, schemas.Unset] = schemas.unset, + ownerName: typing.Union[MetaOapg.properties.ownerName, str, schemas.Unset] = schemas.unset, + rateLimitEnabled: typing.Union[MetaOapg.properties.rateLimitEnabled, bool, schemas.Unset] = schemas.unset, + rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, 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], + ) -> 'OpenConsumerCreateRequestDTO': + return super().__new__( + cls, + *_args, + appId=appId, + allowCreateApplication=allowCreateApplication, + allowManageUsers=allowManageUsers, + name=name, + orgId=orgId, + orgName=orgName, + ownerName=ownerName, + rateLimitEnabled=rateLimitEnabled, + rateLimit=rateLimit, + _configuration=_configuration, + **kwargs, + ) diff --git a/python/apollo_openapi/model/open_consumer_create_request_dto.pyi b/python/apollo_openapi/model/open_consumer_create_request_dto.pyi new file mode 100644 index 00000000..b6548ca0 --- /dev/null +++ b/python/apollo_openapi/model/open_consumer_create_request_dto.pyi @@ -0,0 +1,157 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +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 OpenConsumerCreateRequestDTO( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + appId = schemas.StrSchema + allowCreateApplication = schemas.BoolSchema + allowManageUsers = schemas.BoolSchema + name = schemas.StrSchema + orgId = schemas.StrSchema + orgName = schemas.StrSchema + ownerName = schemas.StrSchema + rateLimitEnabled = schemas.BoolSchema + rateLimit = schemas.IntSchema + __annotations__ = { + "appId": appId, + "allowCreateApplication": allowCreateApplication, + "allowManageUsers": allowManageUsers, + "name": name, + "orgId": orgId, + "orgName": orgName, + "ownerName": ownerName, + "rateLimitEnabled": rateLimitEnabled, + "rateLimit": rateLimit, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowCreateApplication"]) -> MetaOapg.properties.allowCreateApplication: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> MetaOapg.properties.allowManageUsers: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgId"]) -> MetaOapg.properties.orgId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgName"]) -> MetaOapg.properties.orgName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerName"]) -> MetaOapg.properties.ownerName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> MetaOapg.properties.rateLimitEnabled: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "allowCreateApplication", "allowManageUsers", "name", "orgId", "orgName", "ownerName", "rateLimitEnabled", "rateLimit", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @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["allowCreateApplication"]) -> typing.Union[MetaOapg.properties.allowCreateApplication, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> typing.Union[MetaOapg.properties.allowManageUsers, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgId"]) -> typing.Union[MetaOapg.properties.orgId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgName"]) -> typing.Union[MetaOapg.properties.orgName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerName"]) -> typing.Union[MetaOapg.properties.ownerName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> typing.Union[MetaOapg.properties.rateLimitEnabled, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, 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["appId", "allowCreateApplication", "allowManageUsers", "name", "orgId", "orgName", "ownerName", "rateLimitEnabled", "rateLimit", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, + allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + orgId: typing.Union[MetaOapg.properties.orgId, str, schemas.Unset] = schemas.unset, + orgName: typing.Union[MetaOapg.properties.orgName, str, schemas.Unset] = schemas.unset, + ownerName: typing.Union[MetaOapg.properties.ownerName, str, schemas.Unset] = schemas.unset, + rateLimitEnabled: typing.Union[MetaOapg.properties.rateLimitEnabled, bool, schemas.Unset] = schemas.unset, + rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, 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], + ) -> 'OpenConsumerCreateRequestDTO': + return super().__new__( + cls, + *_args, + appId=appId, + allowCreateApplication=allowCreateApplication, + allowManageUsers=allowManageUsers, + name=name, + orgId=orgId, + orgName=orgName, + ownerName=ownerName, + rateLimitEnabled=rateLimitEnabled, + rateLimit=rateLimit, + _configuration=_configuration, + **kwargs, + ) diff --git a/python/apollo_openapi/model/open_consumer_info_dto.py b/python/apollo_openapi/model/open_consumer_info_dto.py new file mode 100644 index 00000000..a0fd4450 --- /dev/null +++ b/python/apollo_openapi/model/open_consumer_info_dto.py @@ -0,0 +1,177 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +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 OpenConsumerInfoDTO( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + appId = schemas.StrSchema + name = schemas.StrSchema + orgId = schemas.StrSchema + orgName = schemas.StrSchema + ownerName = schemas.StrSchema + ownerEmail = schemas.StrSchema + consumerId = schemas.Int64Schema + token = schemas.StrSchema + allowCreateApplication = schemas.BoolSchema + allowManageUsers = schemas.BoolSchema + rateLimit = schemas.IntSchema + __annotations__ = { + "appId": appId, + "name": name, + "orgId": orgId, + "orgName": orgName, + "ownerName": ownerName, + "ownerEmail": ownerEmail, + "consumerId": consumerId, + "token": token, + "allowCreateApplication": allowCreateApplication, + "allowManageUsers": allowManageUsers, + "rateLimit": rateLimit, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgId"]) -> MetaOapg.properties.orgId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgName"]) -> MetaOapg.properties.orgName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerName"]) -> MetaOapg.properties.ownerName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerEmail"]) -> MetaOapg.properties.ownerEmail: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["consumerId"]) -> MetaOapg.properties.consumerId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["token"]) -> MetaOapg.properties.token: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowCreateApplication"]) -> MetaOapg.properties.allowCreateApplication: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> MetaOapg.properties.allowManageUsers: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @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["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgId"]) -> typing.Union[MetaOapg.properties.orgId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgName"]) -> typing.Union[MetaOapg.properties.orgName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerName"]) -> typing.Union[MetaOapg.properties.ownerName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerEmail"]) -> typing.Union[MetaOapg.properties.ownerEmail, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["consumerId"]) -> typing.Union[MetaOapg.properties.consumerId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["token"]) -> typing.Union[MetaOapg.properties.token, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowCreateApplication"]) -> typing.Union[MetaOapg.properties.allowCreateApplication, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> typing.Union[MetaOapg.properties.allowManageUsers, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, 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["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + orgId: typing.Union[MetaOapg.properties.orgId, str, schemas.Unset] = schemas.unset, + orgName: typing.Union[MetaOapg.properties.orgName, str, schemas.Unset] = schemas.unset, + ownerName: typing.Union[MetaOapg.properties.ownerName, str, schemas.Unset] = schemas.unset, + ownerEmail: typing.Union[MetaOapg.properties.ownerEmail, str, schemas.Unset] = schemas.unset, + consumerId: typing.Union[MetaOapg.properties.consumerId, decimal.Decimal, int, schemas.Unset] = schemas.unset, + token: typing.Union[MetaOapg.properties.token, str, schemas.Unset] = schemas.unset, + allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, + allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, + rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, 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], + ) -> 'OpenConsumerInfoDTO': + return super().__new__( + cls, + *_args, + appId=appId, + name=name, + orgId=orgId, + orgName=orgName, + ownerName=ownerName, + ownerEmail=ownerEmail, + consumerId=consumerId, + token=token, + allowCreateApplication=allowCreateApplication, + allowManageUsers=allowManageUsers, + rateLimit=rateLimit, + _configuration=_configuration, + **kwargs, + ) diff --git a/python/apollo_openapi/model/open_consumer_info_dto.pyi b/python/apollo_openapi/model/open_consumer_info_dto.pyi new file mode 100644 index 00000000..a0fd4450 --- /dev/null +++ b/python/apollo_openapi/model/open_consumer_info_dto.pyi @@ -0,0 +1,177 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +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 OpenConsumerInfoDTO( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + appId = schemas.StrSchema + name = schemas.StrSchema + orgId = schemas.StrSchema + orgName = schemas.StrSchema + ownerName = schemas.StrSchema + ownerEmail = schemas.StrSchema + consumerId = schemas.Int64Schema + token = schemas.StrSchema + allowCreateApplication = schemas.BoolSchema + allowManageUsers = schemas.BoolSchema + rateLimit = schemas.IntSchema + __annotations__ = { + "appId": appId, + "name": name, + "orgId": orgId, + "orgName": orgName, + "ownerName": ownerName, + "ownerEmail": ownerEmail, + "consumerId": consumerId, + "token": token, + "allowCreateApplication": allowCreateApplication, + "allowManageUsers": allowManageUsers, + "rateLimit": rateLimit, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgId"]) -> MetaOapg.properties.orgId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgName"]) -> MetaOapg.properties.orgName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerName"]) -> MetaOapg.properties.ownerName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerEmail"]) -> MetaOapg.properties.ownerEmail: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["consumerId"]) -> MetaOapg.properties.consumerId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["token"]) -> MetaOapg.properties.token: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowCreateApplication"]) -> MetaOapg.properties.allowCreateApplication: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> MetaOapg.properties.allowManageUsers: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @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["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgId"]) -> typing.Union[MetaOapg.properties.orgId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgName"]) -> typing.Union[MetaOapg.properties.orgName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerName"]) -> typing.Union[MetaOapg.properties.ownerName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerEmail"]) -> typing.Union[MetaOapg.properties.ownerEmail, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["consumerId"]) -> typing.Union[MetaOapg.properties.consumerId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["token"]) -> typing.Union[MetaOapg.properties.token, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowCreateApplication"]) -> typing.Union[MetaOapg.properties.allowCreateApplication, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> typing.Union[MetaOapg.properties.allowManageUsers, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, 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["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + orgId: typing.Union[MetaOapg.properties.orgId, str, schemas.Unset] = schemas.unset, + orgName: typing.Union[MetaOapg.properties.orgName, str, schemas.Unset] = schemas.unset, + ownerName: typing.Union[MetaOapg.properties.ownerName, str, schemas.Unset] = schemas.unset, + ownerEmail: typing.Union[MetaOapg.properties.ownerEmail, str, schemas.Unset] = schemas.unset, + consumerId: typing.Union[MetaOapg.properties.consumerId, decimal.Decimal, int, schemas.Unset] = schemas.unset, + token: typing.Union[MetaOapg.properties.token, str, schemas.Unset] = schemas.unset, + allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, + allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, + rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, 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], + ) -> 'OpenConsumerInfoDTO': + return super().__new__( + cls, + *_args, + appId=appId, + name=name, + orgId=orgId, + orgName=orgName, + ownerName=ownerName, + ownerEmail=ownerEmail, + consumerId=consumerId, + token=token, + allowCreateApplication=allowCreateApplication, + allowManageUsers=allowManageUsers, + rateLimit=rateLimit, + _configuration=_configuration, + **kwargs, + ) diff --git a/python/apollo_openapi/models/__init__.py b/python/apollo_openapi/models/__init__.py index 37a0a05e..f30770ba 100644 --- a/python/apollo_openapi/models/__init__.py +++ b/python/apollo_openapi/models/__init__.py @@ -21,6 +21,8 @@ from apollo_openapi.model.open_app_role_user_dto import OpenAppRoleUserDTO from apollo_openapi.model.open_cluster_dto import OpenClusterDTO from apollo_openapi.model.open_cluster_namespace_role_user_dto import OpenClusterNamespaceRoleUserDTO +from apollo_openapi.model.open_consumer_create_request_dto import OpenConsumerCreateRequestDTO +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO from apollo_openapi.model.open_create_app_dto import OpenCreateAppDTO from apollo_openapi.model.open_create_namespace_dto import OpenCreateNamespaceDTO from apollo_openapi.model.open_env_cluster_dto import OpenEnvClusterDTO diff --git a/python/apollo_openapi/paths/__init__.py b/python/apollo_openapi/paths/__init__.py index 993209a7..a49c1b84 100644 --- a/python/apollo_openapi/paths/__init__.py +++ b/python/apollo_openapi/paths/__init__.py @@ -81,6 +81,7 @@ class PathValues(str, enum.Enum): OPENAPI_V1_APPS_APP_ID_ENVS_ENV_ACCESSKEYS_ACCESS_KEY_ID_DEACTIVATION = "/openapi/v1/apps/{appId}/envs/{env}/accesskeys/{accessKeyId}/deactivation" OPENAPI_V1_USER = "/openapi/v1/user" OPENAPI_V1_USERS = "/openapi/v1/users" + OPENAPI_V1_USERS_USER_ID = "/openapi/v1/users/{userId}" OPENAPI_V1_USERS_ENABLED = "/openapi/v1/users/enabled" OPENAPI_V1_APOLLO_AUDIT_PROPERTIES = "/openapi/v1/apollo/audit/properties" OPENAPI_V1_APOLLO_AUDIT_LOGS = "/openapi/v1/apollo/audit/logs" diff --git a/python/apollo_openapi/paths/openapi_v1_consumers/get.py b/python/apollo_openapi/paths/openapi_v1_consumers/get.py index a1925445..92b4c625 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumers/get.py +++ b/python/apollo_openapi/paths/openapi_v1_consumers/get.py @@ -25,6 +25,8 @@ from apollo_openapi import schemas # noqa: F401 +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO + from . import path # Query params @@ -72,11 +74,14 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: - items = schemas.DictSchema + + @staticmethod + def items() -> typing.Type['OpenConsumerInfoDTO']: + return OpenConsumerInfoDTO def __new__( cls, - _arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, dict, frozendict.frozendict, ]], typing.List[typing.Union[MetaOapg.items, dict, frozendict.frozendict, ]]], + _arg: typing.Union[typing.Tuple['OpenConsumerInfoDTO'], typing.List['OpenConsumerInfoDTO']], _configuration: typing.Optional[schemas.Configuration] = None, ) -> 'SchemaFor200ResponseBodyApplicationJson': return super().__new__( @@ -85,7 +90,7 @@ def __new__( _configuration=_configuration, ) - def __getitem__(self, i: int) -> MetaOapg.items: + def __getitem__(self, i: int) -> 'OpenConsumerInfoDTO': return super().__getitem__(i) diff --git a/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi b/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi index 8cb91c70..769cfda4 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi +++ b/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi @@ -25,6 +25,8 @@ import frozendict # noqa: F401 from apollo_openapi import schemas # noqa: F401 +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO + # Query params PageSchema = schemas.IntSchema SizeSchema = schemas.IntSchema @@ -67,11 +69,14 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: - items = schemas.DictSchema + + @staticmethod + def items() -> typing.Type['OpenConsumerInfoDTO']: + return OpenConsumerInfoDTO def __new__( cls, - _arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, dict, frozendict.frozendict, ]], typing.List[typing.Union[MetaOapg.items, dict, frozendict.frozendict, ]]], + _arg: typing.Union[typing.Tuple['OpenConsumerInfoDTO'], typing.List['OpenConsumerInfoDTO']], _configuration: typing.Optional[schemas.Configuration] = None, ) -> 'SchemaFor200ResponseBodyApplicationJson': return super().__new__( @@ -80,7 +85,7 @@ class SchemaFor200ResponseBodyApplicationJson( _configuration=_configuration, ) - def __getitem__(self, i: int) -> MetaOapg.items: + def __getitem__(self, i: int) -> 'OpenConsumerInfoDTO': return super().__getitem__(i) diff --git a/python/apollo_openapi/paths/openapi_v1_consumers/post.py b/python/apollo_openapi/paths/openapi_v1_consumers/post.py index c8e63f3e..449a8974 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumers/post.py +++ b/python/apollo_openapi/paths/openapi_v1_consumers/post.py @@ -25,6 +25,9 @@ from apollo_openapi import schemas # noqa: F401 +from apollo_openapi.model.open_consumer_create_request_dto import OpenConsumerCreateRequestDTO +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO + from . import path # Query params @@ -54,10 +57,10 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) explode=True, ) # body param -SchemaForRequestBodyApplicationJson = schemas.DictSchema +SchemaForRequestBodyApplicationJson = OpenConsumerCreateRequestDTO -request_body_body = api_client.RequestBody( +request_body_open_consumer_create_request_dto = api_client.RequestBody( content={ 'application/json': api_client.MediaType( schema=SchemaForRequestBodyApplicationJson), @@ -67,7 +70,7 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) _auth = [ 'ApiKeyAuth', ] -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema +SchemaFor200ResponseBodyApplicationJson = OpenConsumerInfoDTO @dataclass @@ -98,7 +101,7 @@ class BaseApi(api_client.Api): @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -112,7 +115,7 @@ def _create_consumer_oapg( @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -127,7 +130,7 @@ def _create_consumer_oapg( @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), @@ -139,7 +142,7 @@ def _create_consumer_oapg( @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -153,7 +156,7 @@ def _create_consumer_oapg( def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -194,7 +197,7 @@ class instances 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_body.serialize(body, content_type) + serialized_data = request_body_open_consumer_create_request_dto.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] @@ -236,7 +239,7 @@ class CreateConsumer(BaseApi): @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -250,7 +253,7 @@ def create_consumer( @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -265,7 +268,7 @@ def create_consumer( @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), @@ -277,7 +280,7 @@ def create_consumer( @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -291,7 +294,7 @@ def create_consumer( def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -316,7 +319,7 @@ class ApiForpost(BaseApi): @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -330,7 +333,7 @@ def post( @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -345,7 +348,7 @@ def post( @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), @@ -357,7 +360,7 @@ def post( @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -371,7 +374,7 @@ def post( def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, diff --git a/python/apollo_openapi/paths/openapi_v1_consumers/post.pyi b/python/apollo_openapi/paths/openapi_v1_consumers/post.pyi index f654cf1c..2de54dd0 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumers/post.pyi +++ b/python/apollo_openapi/paths/openapi_v1_consumers/post.pyi @@ -25,6 +25,9 @@ import frozendict # noqa: F401 from apollo_openapi import schemas # noqa: F401 +from apollo_openapi.model.open_consumer_create_request_dto import OpenConsumerCreateRequestDTO +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO + # Query params ExpiresSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -52,17 +55,17 @@ request_query_expires = api_client.QueryParameter( explode=True, ) # body param -SchemaForRequestBodyApplicationJson = schemas.DictSchema +SchemaForRequestBodyApplicationJson = OpenConsumerCreateRequestDTO -request_body_body = api_client.RequestBody( +request_body_open_consumer_create_request_dto = api_client.RequestBody( content={ 'application/json': api_client.MediaType( schema=SchemaForRequestBodyApplicationJson), }, required=True, ) -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema +SchemaFor200ResponseBodyApplicationJson = OpenConsumerInfoDTO @dataclass @@ -90,7 +93,7 @@ class BaseApi(api_client.Api): @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -104,7 +107,7 @@ class BaseApi(api_client.Api): @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -119,7 +122,7 @@ class BaseApi(api_client.Api): @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), @@ -131,7 +134,7 @@ class BaseApi(api_client.Api): @typing.overload def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -145,7 +148,7 @@ class BaseApi(api_client.Api): def _create_consumer_oapg( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -186,7 +189,7 @@ class BaseApi(api_client.Api): 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_body.serialize(body, content_type) + serialized_data = request_body_open_consumer_create_request_dto.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] @@ -228,7 +231,7 @@ class CreateConsumer(BaseApi): @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -242,7 +245,7 @@ class CreateConsumer(BaseApi): @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -257,7 +260,7 @@ class CreateConsumer(BaseApi): @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), @@ -269,7 +272,7 @@ class CreateConsumer(BaseApi): @typing.overload def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -283,7 +286,7 @@ class CreateConsumer(BaseApi): def create_consumer( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -308,7 +311,7 @@ class ApiForpost(BaseApi): @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -322,7 +325,7 @@ class ApiForpost(BaseApi): @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -337,7 +340,7 @@ class ApiForpost(BaseApi): @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), @@ -349,7 +352,7 @@ class ApiForpost(BaseApi): @typing.overload def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -363,7 +366,7 @@ class ApiForpost(BaseApi): def post( self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], + body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, diff --git a/python/apollo_openapi/paths/openapi_v1_users/get.py b/python/apollo_openapi/paths/openapi_v1_users/get.py index a337db20..aeff3a1d 100644 --- a/python/apollo_openapi/paths/openapi_v1_users/get.py +++ b/python/apollo_openapi/paths/openapi_v1_users/get.py @@ -237,7 +237,7 @@ def _search_users_oapg( skip_deserialization: bool = False, ): """ - 搜索Portal用户(new added) + 搜索用户(new added) :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 diff --git a/python/apollo_openapi/paths/openapi_v1_users/get.pyi b/python/apollo_openapi/paths/openapi_v1_users/get.pyi index 423d695a..b7f898ab 100644 --- a/python/apollo_openapi/paths/openapi_v1_users/get.pyi +++ b/python/apollo_openapi/paths/openapi_v1_users/get.pyi @@ -221,7 +221,7 @@ class BaseApi(api_client.Api): skip_deserialization: bool = False, ): """ - 搜索Portal用户(new added) + 搜索用户(new added) :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 diff --git a/python/apollo_openapi/paths/openapi_v1_users/post.py b/python/apollo_openapi/paths/openapi_v1_users/post.py index 785600a2..76b13cbc 100644 --- a/python/apollo_openapi/paths/openapi_v1_users/post.py +++ b/python/apollo_openapi/paths/openapi_v1_users/post.py @@ -32,6 +32,7 @@ # Query params IsCreateSchema = schemas.BoolSchema +OperatorSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( 'RequestRequiredQueryParams', { @@ -41,6 +42,7 @@ 'RequestOptionalQueryParams', { 'isCreate': typing.Union[IsCreateSchema, bool, ], + 'operator': typing.Union[OperatorSchema, str, ], }, total=False ) @@ -56,6 +58,12 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) schema=IsCreateSchema, explode=True, ) +request_query_operator = api_client.QueryParameter( + name="operator", + style=api_client.ParameterStyle.FORM, + schema=OperatorSchema, + explode=True, +) # body param SchemaForRequestBodyApplicationJson = OpenUserDTO @@ -198,7 +206,7 @@ def _create_or_update_user_oapg( skip_deserialization: bool = False, ): """ - 创建或更新Portal用户(new added) + 创建或更新用户(new added) :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 @@ -209,6 +217,7 @@ class instances prefix_separator_iterator = None for parameter in ( request_query_is_create, + request_query_operator, ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: diff --git a/python/apollo_openapi/paths/openapi_v1_users/post.pyi b/python/apollo_openapi/paths/openapi_v1_users/post.pyi index 6530dc69..0dcde8c0 100644 --- a/python/apollo_openapi/paths/openapi_v1_users/post.pyi +++ b/python/apollo_openapi/paths/openapi_v1_users/post.pyi @@ -30,6 +30,7 @@ from apollo_openapi.model.exception_response import ExceptionResponse # Query params IsCreateSchema = schemas.BoolSchema +OperatorSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( 'RequestRequiredQueryParams', { @@ -39,6 +40,7 @@ RequestOptionalQueryParams = typing_extensions.TypedDict( 'RequestOptionalQueryParams', { 'isCreate': typing.Union[IsCreateSchema, bool, ], + 'operator': typing.Union[OperatorSchema, str, ], }, total=False ) @@ -54,6 +56,12 @@ request_query_is_create = api_client.QueryParameter( schema=IsCreateSchema, explode=True, ) +request_query_operator = api_client.QueryParameter( + name="operator", + style=api_client.ParameterStyle.FORM, + schema=OperatorSchema, + explode=True, +) # body param SchemaForRequestBodyApplicationJson = OpenUserDTO @@ -188,7 +196,7 @@ class BaseApi(api_client.Api): skip_deserialization: bool = False, ): """ - 创建或更新Portal用户(new added) + 创建或更新用户(new added) :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 @@ -199,6 +207,7 @@ class BaseApi(api_client.Api): prefix_separator_iterator = None for parameter in ( request_query_is_create, + request_query_operator, ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: diff --git a/python/apollo_openapi/paths/openapi_v1_users_enabled/put.py b/python/apollo_openapi/paths/openapi_v1_users_enabled/put.py index 3220ef11..0b52aa13 100644 --- a/python/apollo_openapi/paths/openapi_v1_users_enabled/put.py +++ b/python/apollo_openapi/paths/openapi_v1_users_enabled/put.py @@ -30,6 +30,32 @@ from . import path +# Query params +OperatorSchema = schemas.StrSchema +RequestRequiredQueryParams = typing_extensions.TypedDict( + 'RequestRequiredQueryParams', + { + } +) +RequestOptionalQueryParams = typing_extensions.TypedDict( + 'RequestOptionalQueryParams', + { + 'operator': typing.Union[OperatorSchema, str, ], + }, + total=False +) + + +class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): + pass + + +request_query_operator = api_client.QueryParameter( + name="operator", + style=api_client.ParameterStyle.FORM, + schema=OperatorSchema, + explode=True, +) # body param SchemaForRequestBodyApplicationJson = OpenUserDTO @@ -110,6 +136,7 @@ def _change_user_enabled_oapg( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -123,6 +150,7 @@ def _change_user_enabled_oapg( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -138,6 +166,7 @@ def _change_user_enabled_oapg( body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -148,6 +177,7 @@ def _change_user_enabled_oapg( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -161,19 +191,34 @@ def _change_user_enabled_oapg( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', + query_params: RequestQueryParams = frozendict.frozendict(), 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, ): """ - 修改Portal用户启用状态(new added) + 修改用户启用状态(new added) :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 """ + self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) used_path = path.value + prefix_separator_iterator = None + for parameter in ( + request_query_operator, + ): + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: @@ -229,6 +274,7 @@ def change_user_enabled( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -242,6 +288,7 @@ def change_user_enabled( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -257,6 +304,7 @@ def change_user_enabled( body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -267,6 +315,7 @@ def change_user_enabled( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -280,6 +329,7 @@ def change_user_enabled( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -287,6 +337,7 @@ def change_user_enabled( ): return self._change_user_enabled_oapg( body=body, + query_params=query_params, content_type=content_type, accept_content_types=accept_content_types, stream=stream, @@ -303,6 +354,7 @@ def put( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -316,6 +368,7 @@ def put( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -331,6 +384,7 @@ def put( body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -341,6 +395,7 @@ def put( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -354,6 +409,7 @@ def put( self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -361,6 +417,7 @@ def put( ): return self._change_user_enabled_oapg( body=body, + query_params=query_params, content_type=content_type, accept_content_types=accept_content_types, stream=stream, diff --git a/python/apollo_openapi/paths/openapi_v1_users_enabled/put.pyi b/python/apollo_openapi/paths/openapi_v1_users_enabled/put.pyi index 5c3b3bae..23cbc95c 100644 --- a/python/apollo_openapi/paths/openapi_v1_users_enabled/put.pyi +++ b/python/apollo_openapi/paths/openapi_v1_users_enabled/put.pyi @@ -28,6 +28,32 @@ from apollo_openapi import schemas # noqa: F401 from apollo_openapi.model.open_user_dto import OpenUserDTO from apollo_openapi.model.exception_response import ExceptionResponse +# Query params +OperatorSchema = schemas.StrSchema +RequestRequiredQueryParams = typing_extensions.TypedDict( + 'RequestRequiredQueryParams', + { + } +) +RequestOptionalQueryParams = typing_extensions.TypedDict( + 'RequestOptionalQueryParams', + { + 'operator': typing.Union[OperatorSchema, str, ], + }, + total=False +) + + +class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): + pass + + +request_query_operator = api_client.QueryParameter( + name="operator", + style=api_client.ParameterStyle.FORM, + schema=OperatorSchema, + explode=True, +) # body param SchemaForRequestBodyApplicationJson = OpenUserDTO @@ -100,6 +126,7 @@ class BaseApi(api_client.Api): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -113,6 +140,7 @@ class BaseApi(api_client.Api): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -128,6 +156,7 @@ class BaseApi(api_client.Api): body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -138,6 +167,7 @@ class BaseApi(api_client.Api): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -151,19 +181,34 @@ class BaseApi(api_client.Api): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', + query_params: RequestQueryParams = frozendict.frozendict(), 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, ): """ - 修改Portal用户启用状态(new added) + 修改用户启用状态(new added) :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 """ + self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) used_path = path.value + prefix_separator_iterator = None + for parameter in ( + request_query_operator, + ): + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: @@ -219,6 +264,7 @@ class ChangeUserEnabled(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -232,6 +278,7 @@ class ChangeUserEnabled(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -247,6 +294,7 @@ class ChangeUserEnabled(BaseApi): body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -257,6 +305,7 @@ class ChangeUserEnabled(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -270,6 +319,7 @@ class ChangeUserEnabled(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -277,6 +327,7 @@ class ChangeUserEnabled(BaseApi): ): return self._change_user_enabled_oapg( body=body, + query_params=query_params, content_type=content_type, accept_content_types=accept_content_types, stream=stream, @@ -293,6 +344,7 @@ class ApiForput(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -306,6 +358,7 @@ class ApiForput(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -321,6 +374,7 @@ class ApiForput(BaseApi): body: typing.Union[SchemaForRequestBodyApplicationJson,], skip_deserialization: typing_extensions.Literal[True], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -331,6 +385,7 @@ class ApiForput(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = ..., + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -344,6 +399,7 @@ class ApiForput(BaseApi): self, body: typing.Union[SchemaForRequestBodyApplicationJson,], content_type: str = 'application/json', + query_params: RequestQueryParams = frozendict.frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, @@ -351,6 +407,7 @@ class ApiForput(BaseApi): ): return self._change_user_enabled_oapg( body=body, + query_params=query_params, content_type=content_type, accept_content_types=accept_content_types, stream=stream, diff --git a/python/apollo_openapi/paths/openapi_v1_users_user_id/__init__.py b/python/apollo_openapi/paths/openapi_v1_users_user_id/__init__.py new file mode 100644 index 00000000..bfb5689a --- /dev/null +++ b/python/apollo_openapi/paths/openapi_v1_users_user_id/__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_users_user_id import Api + +from apollo_openapi.paths import PathValues + +path = PathValues.OPENAPI_V1_USERS_USER_ID diff --git a/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py new file mode 100644 index 00000000..919afa1a --- /dev/null +++ b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py @@ -0,0 +1,336 @@ +# 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 apollo_openapi.model.exception_response import ExceptionResponse +from apollo_openapi.model.open_user_info_dto import OpenUserInfoDTO + +from . import path + +# Path params +UserIdSchema = schemas.StrSchema +RequestRequiredPathParams = typing_extensions.TypedDict( + 'RequestRequiredPathParams', + { + 'userId': typing.Union[UserIdSchema, str, ], + } +) +RequestOptionalPathParams = typing_extensions.TypedDict( + 'RequestOptionalPathParams', + { + }, + total=False +) + + +class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): + pass + + +request_path_user_id = api_client.PathParameter( + name="userId", + style=api_client.ParameterStyle.SIMPLE, + schema=UserIdSchema, + required=True, +) +_auth = [ + 'ApiKeyAuth', +] +SchemaFor200ResponseBodyApplicationJson = OpenUserInfoDTO + + +@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), + }, +) +SchemaFor400ResponseBodyApplicationJson = ExceptionResponse + + +@dataclass +class ApiResponseFor400(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor400ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_400 = api_client.OpenApiResponse( + response_cls=ApiResponseFor400, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), + }, +) +SchemaFor403ResponseBodyApplicationJson = ExceptionResponse + + +@dataclass +class ApiResponseFor403(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor403ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_403 = api_client.OpenApiResponse( + response_cls=ApiResponseFor403, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor403ResponseBodyApplicationJson), + }, +) +_status_code_to_response = { + '200': _response_for_200, + '400': _response_for_400, + '403': _response_for_403, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_user_by_user_id_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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, + ): + """ + 获取指定用户(new added) + :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 + """ + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value + + _path_params = {} + for parameter in ( + request_path_user_id, + ): + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _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 GetUserByUserId(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_user_by_user_id( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + path_params=path_params, + 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, + path_params: RequestPathParams = frozendict.frozendict(), + 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], + path_params: RequestPathParams = frozendict.frozendict(), + 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, + path_params: RequestPathParams = frozendict.frozendict(), + 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, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi new file mode 100644 index 00000000..2033be9d --- /dev/null +++ b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi @@ -0,0 +1,326 @@ +# 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 apollo_openapi.model.exception_response import ExceptionResponse +from apollo_openapi.model.open_user_info_dto import OpenUserInfoDTO + +# Path params +UserIdSchema = schemas.StrSchema +RequestRequiredPathParams = typing_extensions.TypedDict( + 'RequestRequiredPathParams', + { + 'userId': typing.Union[UserIdSchema, str, ], + } +) +RequestOptionalPathParams = typing_extensions.TypedDict( + 'RequestOptionalPathParams', + { + }, + total=False +) + + +class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): + pass + + +request_path_user_id = api_client.PathParameter( + name="userId", + style=api_client.ParameterStyle.SIMPLE, + schema=UserIdSchema, + required=True, +) +SchemaFor200ResponseBodyApplicationJson = OpenUserInfoDTO + + +@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), + }, +) +SchemaFor400ResponseBodyApplicationJson = ExceptionResponse + + +@dataclass +class ApiResponseFor400(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor400ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_400 = api_client.OpenApiResponse( + response_cls=ApiResponseFor400, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), + }, +) +SchemaFor403ResponseBodyApplicationJson = ExceptionResponse + + +@dataclass +class ApiResponseFor403(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor403ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_403 = api_client.OpenApiResponse( + response_cls=ApiResponseFor403, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor403ResponseBodyApplicationJson), + }, +) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_user_by_user_id_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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, + ): + """ + 获取指定用户(new added) + :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 + """ + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value + + _path_params = {} + for parameter in ( + request_path_user_id, + ): + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _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 GetUserByUserId(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_user_by_user_id( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id( + self, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + path_params=path_params, + 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, + path_params: RequestPathParams = frozendict.frozendict(), + 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], + path_params: RequestPathParams = frozendict.frozendict(), + 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, + path_params: RequestPathParams = frozendict.frozendict(), + 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, + path_params: RequestPathParams = frozendict.frozendict(), + 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_user_by_user_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/python/docs/apis/tags/PortalManagementApi.md b/python/docs/apis/tags/PortalManagementApi.md index 22013e18..8a6dc652 100644 --- a/python/docs/apis/tags/PortalManagementApi.md +++ b/python/docs/apis/tags/PortalManagementApi.md @@ -521,7 +521,7 @@ dict, frozendict.frozendict, | frozendict.frozendict, | | # **create_consumer** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} create_consumer(body) +> OpenConsumerInfoDTO create_consumer(open_consumer_create_request_dto) 创建开放平台消费者(new added) @@ -533,6 +533,8 @@ POST /openapi/v1/consumers ```python import apollo_openapi from apollo_openapi.apis.tags import portal_management_api +from apollo_openapi.model.open_consumer_create_request_dto import OpenConsumerCreateRequestDTO +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO 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. @@ -558,7 +560,17 @@ with apollo_openapi.ApiClient(configuration) as api_client: # example passing only required values which don't have defaults set query_params = { } - body = dict() + body = OpenConsumerCreateRequestDTO( + app_id="app_id_example", + allow_create_application=False, + allow_manage_users=False, + name="name_example", + org_id="org_id_example", + org_name="org_name_example", + owner_name="owner_name_example", + rate_limit_enabled=False, + rate_limit=0, + ) try: # 创建开放平台消费者(new added) api_response = api_instance.create_consumer( @@ -573,7 +585,17 @@ with apollo_openapi.ApiClient(configuration) as api_client: query_params = { 'expires': "expires_example", } - body = dict() + body = OpenConsumerCreateRequestDTO( + app_id="app_id_example", + allow_create_application=False, + allow_manage_users=False, + name="name_example", + org_id="org_id_example", + org_name="org_name_example", + owner_name="owner_name_example", + rate_limit_enabled=False, + rate_limit=0, + ) try: # 创建开放平台消费者(new added) api_response = api_instance.create_consumer( @@ -599,11 +621,10 @@ skip_deserialization | bool | default is False | when True, headers and body wil ### body # SchemaForRequestBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**OpenConsumerCreateRequestDTO**](../../models/OpenConsumerCreateRequestDTO.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### query_params #### RequestQueryParams @@ -637,11 +658,10 @@ body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | headers | Unset | headers were not defined | # SchemaFor200ResponseBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**OpenConsumerInfoDTO**](../../models/OpenConsumerInfoDTO.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Authorization @@ -2955,7 +2975,7 @@ dict, frozendict.frozendict, | frozendict.frozendict, | | # **get_consumer_list** -> [{str: (bool, date, datetime, dict, float, int, list, str, none_type)}] get_consumer_list() +> [OpenConsumerInfoDTO] get_consumer_list() 查询开放平台消费者列表(new added) @@ -2967,6 +2987,7 @@ GET /openapi/v1/consumers ```python import apollo_openapi from apollo_openapi.apis.tags import portal_management_api +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO 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. @@ -3060,14 +3081,7 @@ list, tuple, | tuple, | | ### Tuple Items Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -[items](#items) | dict, frozendict.frozendict, | frozendict.frozendict, | | - -# items - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +[**OpenConsumerInfoDTO**]({{complexTypePrefix}}OpenConsumerInfoDTO.md) | [**OpenConsumerInfoDTO**]({{complexTypePrefix}}OpenConsumerInfoDTO.md) | [**OpenConsumerInfoDTO**]({{complexTypePrefix}}OpenConsumerInfoDTO.md) | | ### Authorization diff --git a/python/docs/apis/tags/PortalUserManagementApi.md b/python/docs/apis/tags/UserManagementApi.md similarity index 70% rename from python/docs/apis/tags/PortalUserManagementApi.md rename to python/docs/apis/tags/UserManagementApi.md index c98f8250..453f9c22 100644 --- a/python/docs/apis/tags/PortalUserManagementApi.md +++ b/python/docs/apis/tags/UserManagementApi.md @@ -1,29 +1,30 @@ -# apollo_openapi.apis.tags.portal_user_management_api.PortalUserManagementApi +# apollo_openapi.apis.tags.user_management_api.UserManagementApi All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**change_user_enabled**](#change_user_enabled) | **put** /openapi/v1/users/enabled | 修改Portal用户启用状态(new added) -[**create_or_update_user**](#create_or_update_user) | **post** /openapi/v1/users | 创建或更新Portal用户(new added) +[**change_user_enabled**](#change_user_enabled) | **put** /openapi/v1/users/enabled | 修改用户启用状态(new added) +[**create_or_update_user**](#create_or_update_user) | **post** /openapi/v1/users | 创建或更新用户(new added) [**get_current_user**](#get_current_user) | **get** /openapi/v1/user | 获取当前Portal用户(new added) -[**search_users**](#search_users) | **get** /openapi/v1/users | 搜索Portal用户(new added) +[**get_user_by_user_id**](#get_user_by_user_id) | **get** /openapi/v1/users/{userId} | 获取指定用户(new added) +[**search_users**](#search_users) | **get** /openapi/v1/users | 搜索用户(new added) # **change_user_enabled** > change_user_enabled(open_user_dto) -修改Portal用户启用状态(new added) +修改用户启用状态(new added) -PUT /openapi/v1/users/enabled +PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator ### Example * Api Key Authentication (ApiKeyAuth): ```python import apollo_openapi -from apollo_openapi.apis.tags import portal_user_management_api +from apollo_openapi.apis.tags import user_management_api from apollo_openapi.model.open_user_dto import OpenUserDTO from apollo_openapi.model.exception_response import ExceptionResponse from pprint import pprint @@ -46,9 +47,11 @@ configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY' # 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 = portal_user_management_api.PortalUserManagementApi(api_client) + api_instance = user_management_api.UserManagementApi(api_client) # example passing only required values which don't have defaults set + query_params = { + } body = OpenUserDTO( username="username_example", user_display_name="user_display_name_example", @@ -57,18 +60,40 @@ with apollo_openapi.ApiClient(configuration) as api_client: enabled=1, ) try: - # 修改Portal用户启用状态(new added) + # 修改用户启用状态(new added) api_response = api_instance.change_user_enabled( + query_params=query_params, body=body, ) except apollo_openapi.ApiException as e: - print("Exception when calling PortalUserManagementApi->change_user_enabled: %s\n" % e) + print("Exception when calling UserManagementApi->change_user_enabled: %s\n" % e) + + # example passing only optional values + query_params = { + 'operator': "operator_example", + } + body = OpenUserDTO( + username="username_example", + user_display_name="user_display_name_example", + password="password_example", + email="email_example", + enabled=1, + ) + try: + # 修改用户启用状态(new added) + api_response = api_instance.change_user_enabled( + query_params=query_params, + body=body, + ) + except apollo_openapi.ApiException as e: + print("Exception when calling UserManagementApi->change_user_enabled: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +query_params | RequestQueryParams | | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file @@ -83,6 +108,21 @@ Type | Description | Notes [**OpenUserDTO**](../../models/OpenUserDTO.md) | | +### query_params +#### RequestQueryParams + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +operator | OperatorSchema | | optional + + +# OperatorSchema + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +str, | str, | | + ### Return Types, Responses Code | Class | Description @@ -135,16 +175,16 @@ Type | Description | Notes > create_or_update_user(open_user_dto) -创建或更新Portal用户(new added) +创建或更新用户(new added) -POST /openapi/v1/users +POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator ### Example * Api Key Authentication (ApiKeyAuth): ```python import apollo_openapi -from apollo_openapi.apis.tags import portal_user_management_api +from apollo_openapi.apis.tags import user_management_api from apollo_openapi.model.open_user_dto import OpenUserDTO from apollo_openapi.model.exception_response import ExceptionResponse from pprint import pprint @@ -167,7 +207,7 @@ configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY' # 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 = portal_user_management_api.PortalUserManagementApi(api_client) + api_instance = user_management_api.UserManagementApi(api_client) # example passing only required values which don't have defaults set query_params = { @@ -180,17 +220,18 @@ with apollo_openapi.ApiClient(configuration) as api_client: enabled=1, ) try: - # 创建或更新Portal用户(new added) + # 创建或更新用户(new added) api_response = api_instance.create_or_update_user( query_params=query_params, body=body, ) except apollo_openapi.ApiException as e: - print("Exception when calling PortalUserManagementApi->create_or_update_user: %s\n" % e) + print("Exception when calling UserManagementApi->create_or_update_user: %s\n" % e) # example passing only optional values query_params = { 'isCreate': False, + 'operator': "operator_example", } body = OpenUserDTO( username="username_example", @@ -200,13 +241,13 @@ with apollo_openapi.ApiClient(configuration) as api_client: enabled=1, ) try: - # 创建或更新Portal用户(new added) + # 创建或更新用户(new added) api_response = api_instance.create_or_update_user( query_params=query_params, body=body, ) except apollo_openapi.ApiException as e: - print("Exception when calling PortalUserManagementApi->create_or_update_user: %s\n" % e) + print("Exception when calling UserManagementApi->create_or_update_user: %s\n" % e) ``` ### Parameters @@ -234,6 +275,7 @@ Type | Description | Notes Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- isCreate | IsCreateSchema | | optional +operator | OperatorSchema | | optional # IsCreateSchema @@ -243,6 +285,13 @@ Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- bool, | BoolClass, | | if omitted the server will use the default value of False +# OperatorSchema + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +str, | str, | | + ### Return Types, Responses Code | Class | Description @@ -304,7 +353,7 @@ GET /openapi/v1/user * Api Key Authentication (ApiKeyAuth): ```python import apollo_openapi -from apollo_openapi.apis.tags import portal_user_management_api +from apollo_openapi.apis.tags import user_management_api from apollo_openapi.model.exception_response import ExceptionResponse from apollo_openapi.model.open_user_info_dto import OpenUserInfoDTO from pprint import pprint @@ -327,7 +376,7 @@ configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY' # 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 = portal_user_management_api.PortalUserManagementApi(api_client) + api_instance = user_management_api.UserManagementApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -335,7 +384,7 @@ with apollo_openapi.ApiClient(configuration) as api_client: api_response = api_instance.get_current_user() pprint(api_response) except apollo_openapi.ApiException as e: - print("Exception when calling PortalUserManagementApi->get_current_user: %s\n" % e) + print("Exception when calling UserManagementApi->get_current_user: %s\n" % e) ``` ### Parameters This endpoint does not need any parameter. @@ -388,6 +437,135 @@ Type | Description | Notes [**ExceptionResponse**](../../models/ExceptionResponse.md) | | +### 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) + +# **get_user_by_user_id** + +> OpenUserInfoDTO get_user_by_user_id(user_id) + +获取指定用户(new added) + +GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + +### Example + +* Api Key Authentication (ApiKeyAuth): +```python +import apollo_openapi +from apollo_openapi.apis.tags import user_management_api +from apollo_openapi.model.exception_response import ExceptionResponse +from apollo_openapi.model.open_user_info_dto import OpenUserInfoDTO +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 = user_management_api.UserManagementApi(api_client) + + # example passing only required values which don't have defaults set + path_params = { + 'userId': "userId_example", + } + try: + # 获取指定用户(new added) + api_response = api_instance.get_user_by_user_id( + path_params=path_params, + ) + pprint(api_response) + except apollo_openapi.ApiException as e: + print("Exception when calling UserManagementApi->get_user_by_user_id: %s\n" % e) +``` +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +path_params | RequestPathParams | | +accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client +stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file +timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client +skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned + +### path_params +#### RequestPathParams + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +userId | UserIdSchema | | + +# UserIdSchema + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +str, | str, | | + +### Return Types, Responses + +Code | Class | Description +------------- | ------------- | ------------- +n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned +200 | [ApiResponseFor200](#get_user_by_user_id.ApiResponseFor200) | 成功获取用户 +400 | [ApiResponseFor400](#get_user_by_user_id.ApiResponseFor400) | 请求参数错误或用户不存在 +403 | [ApiResponseFor403](#get_user_by_user_id.ApiResponseFor403) | 权限不足 + +#### get_user_by_user_id.ApiResponseFor200 +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +response | urllib3.HTTPResponse | Raw response | +body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +headers | Unset | headers were not defined | + +# SchemaFor200ResponseBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**OpenUserInfoDTO**](../../models/OpenUserInfoDTO.md) | | + + +#### get_user_by_user_id.ApiResponseFor400 +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +response | urllib3.HTTPResponse | Raw response | +body | typing.Union[SchemaFor400ResponseBodyApplicationJson, ] | | +headers | Unset | headers were not defined | + +# SchemaFor400ResponseBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**ExceptionResponse**](../../models/ExceptionResponse.md) | | + + +#### get_user_by_user_id.ApiResponseFor403 +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +response | urllib3.HTTPResponse | Raw response | +body | typing.Union[SchemaFor403ResponseBodyApplicationJson, ] | | +headers | Unset | headers were not defined | + +# SchemaFor403ResponseBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**ExceptionResponse**](../../models/ExceptionResponse.md) | | + + ### Authorization [ApiKeyAuth](../../../README.md#ApiKeyAuth) @@ -398,16 +576,16 @@ Type | Description | Notes > [OpenUserInfoDTO] search_users(keyword) -搜索Portal用户(new added) +搜索用户(new added) -GET /openapi/v1/users +GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 ### Example * Api Key Authentication (ApiKeyAuth): ```python import apollo_openapi -from apollo_openapi.apis.tags import portal_user_management_api +from apollo_openapi.apis.tags import user_management_api from apollo_openapi.model.exception_response import ExceptionResponse from apollo_openapi.model.open_user_info_dto import OpenUserInfoDTO from pprint import pprint @@ -430,20 +608,20 @@ configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY' # 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 = portal_user_management_api.PortalUserManagementApi(api_client) + api_instance = user_management_api.UserManagementApi(api_client) # example passing only required values which don't have defaults set query_params = { 'keyword': "keyword_example", } try: - # 搜索Portal用户(new added) + # 搜索用户(new added) api_response = api_instance.search_users( query_params=query_params, ) pprint(api_response) except apollo_openapi.ApiException as e: - print("Exception when calling PortalUserManagementApi->search_users: %s\n" % e) + print("Exception when calling UserManagementApi->search_users: %s\n" % e) # example passing only optional values query_params = { @@ -453,13 +631,13 @@ with apollo_openapi.ApiClient(configuration) as api_client: 'limit': 10, } try: - # 搜索Portal用户(new added) + # 搜索用户(new added) api_response = api_instance.search_users( query_params=query_params, ) pprint(api_response) except apollo_openapi.ApiException as e: - print("Exception when calling PortalUserManagementApi->search_users: %s\n" % e) + print("Exception when calling UserManagementApi->search_users: %s\n" % e) ``` ### Parameters @@ -517,7 +695,7 @@ Code | Class | Description n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned 200 | [ApiResponseFor200](#search_users.ApiResponseFor200) | 成功获取用户列表 401 | [ApiResponseFor401](#search_users.ApiResponseFor401) | 未登录或未授权访问 -403 | [ApiResponseFor403](#search_users.ApiResponseFor403) | 仅支持Portal用户登录态访问 +403 | [ApiResponseFor403](#search_users.ApiResponseFor403) | 权限不足 #### search_users.ApiResponseFor200 Name | Type | Description | Notes diff --git a/python/docs/models/OpenConsumerCreateRequestDTO.md b/python/docs/models/OpenConsumerCreateRequestDTO.md new file mode 100644 index 00000000..e5740884 --- /dev/null +++ b/python/docs/models/OpenConsumerCreateRequestDTO.md @@ -0,0 +1,22 @@ +# apollo_openapi.model.open_consumer_create_request_dto.OpenConsumerCreateRequestDTO + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +dict, frozendict.frozendict, | frozendict.frozendict, | | + +### Dictionary Keys +Key | Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**appId** | str, | str, | 第三方应用ID | [optional] +**allowCreateApplication** | bool, | BoolClass, | 是否允许该Consumer Token创建应用 | [optional] if omitted the server will use the default value of False +**allowManageUsers** | bool, | BoolClass, | 是否允许该Consumer Token管理用户 | [optional] if omitted the server will use the default value of False +**name** | str, | str, | 第三方应用名称 | [optional] +**orgId** | str, | str, | 部门ID | [optional] +**orgName** | str, | str, | 部门名称 | [optional] +**ownerName** | str, | str, | 负责人用户名 | [optional] +**rateLimitEnabled** | bool, | BoolClass, | 是否开启限流 | [optional] if omitted the server will use the default value of False +**rateLimit** | decimal.Decimal, int, | decimal.Decimal, | 限流QPS,0表示不限流 | [optional] if omitted the server will use the default value of 0 +**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/docs/models/OpenConsumerInfoDTO.md b/python/docs/models/OpenConsumerInfoDTO.md new file mode 100644 index 00000000..32096fe2 --- /dev/null +++ b/python/docs/models/OpenConsumerInfoDTO.md @@ -0,0 +1,24 @@ +# apollo_openapi.model.open_consumer_info_dto.OpenConsumerInfoDTO + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +dict, frozendict.frozendict, | frozendict.frozendict, | | + +### Dictionary Keys +Key | Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**appId** | str, | str, | 第三方应用ID | [optional] +**name** | str, | str, | 第三方应用名称 | [optional] +**orgId** | str, | str, | 部门ID | [optional] +**orgName** | str, | str, | 部门名称 | [optional] +**ownerName** | str, | str, | 负责人用户名 | [optional] +**ownerEmail** | str, | str, | 负责人邮箱 | [optional] +**consumerId** | decimal.Decimal, int, | decimal.Decimal, | Consumer ID | [optional] value must be a 64 bit integer +**token** | str, | str, | Consumer Token,仅在创建或按应用查询详情时返回 | [optional] +**allowCreateApplication** | bool, | BoolClass, | 是否允许该Consumer Token创建应用 | [optional] if omitted the server will use the default value of False +**allowManageUsers** | bool, | BoolClass, | 是否允许该Consumer Token管理用户 | [optional] if omitted the server will use the default value of False +**rateLimit** | decimal.Decimal, int, | decimal.Decimal, | 限流QPS,0表示不限流 | [optional] if omitted the server will use the default value of 0 +**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/setup.py b/python/setup.py index 8e72146d..c9b4d2b3 100644 --- a/python/setup.py +++ b/python/setup.py @@ -11,7 +11,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "apollo-openapi" -VERSION = "0.3.5" +VERSION = "0.3.6" # To install the library, run the following # # python setup.py install diff --git a/python/test/test_models/test_open_consumer_create_request_dto.py b/python/test/test_models/test_open_consumer_create_request_dto.py new file mode 100644 index 00000000..d88ed1d3 --- /dev/null +++ b/python/test/test_models/test_open_consumer_create_request_dto.py @@ -0,0 +1,24 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +import unittest + +import apollo_openapi +from apollo_openapi.model.open_consumer_create_request_dto import OpenConsumerCreateRequestDTO +from apollo_openapi import configuration + + +class TestOpenConsumerCreateRequestDTO(unittest.TestCase): + """OpenConsumerCreateRequestDTO unit test stubs""" + _configuration = configuration.Configuration() + + +if __name__ == '__main__': + unittest.main() diff --git a/python/test/test_models/test_open_consumer_info_dto.py b/python/test/test_models/test_open_consumer_info_dto.py new file mode 100644 index 00000000..559a81ed --- /dev/null +++ b/python/test/test_models/test_open_consumer_info_dto.py @@ -0,0 +1,24 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +import unittest + +import apollo_openapi +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO +from apollo_openapi import configuration + + +class TestOpenConsumerInfoDTO(unittest.TestCase): + """OpenConsumerInfoDTO unit test stubs""" + _configuration = configuration.Configuration() + + +if __name__ == '__main__': + unittest.main() diff --git a/python/test/test_paths/test_openapi_v1_users/test_get.py b/python/test/test_paths/test_openapi_v1_users/test_get.py index b6d9f9e4..5820c4c1 100644 --- a/python/test/test_paths/test_openapi_v1_users/test_get.py +++ b/python/test/test_paths/test_openapi_v1_users/test_get.py @@ -21,7 +21,7 @@ class TestOpenapiV1Users(ApiTestMixin, unittest.TestCase): """ OpenapiV1Users unit test stubs - 搜索Portal用户(new added) # noqa: E501 + 搜索用户(new added) # noqa: E501 """ _configuration = configuration.Configuration() diff --git a/python/test/test_paths/test_openapi_v1_users/test_post.py b/python/test/test_paths/test_openapi_v1_users/test_post.py index 0e5d19c5..a449ba39 100644 --- a/python/test/test_paths/test_openapi_v1_users/test_post.py +++ b/python/test/test_paths/test_openapi_v1_users/test_post.py @@ -21,7 +21,7 @@ class TestOpenapiV1Users(ApiTestMixin, unittest.TestCase): """ OpenapiV1Users unit test stubs - 创建或更新Portal用户(new added) # noqa: E501 + 创建或更新用户(new added) # noqa: E501 """ _configuration = configuration.Configuration() diff --git a/python/test/test_paths/test_openapi_v1_users_enabled/test_put.py b/python/test/test_paths/test_openapi_v1_users_enabled/test_put.py index 84c59575..00a17d5b 100644 --- a/python/test/test_paths/test_openapi_v1_users_enabled/test_put.py +++ b/python/test/test_paths/test_openapi_v1_users_enabled/test_put.py @@ -21,7 +21,7 @@ class TestOpenapiV1UsersEnabled(ApiTestMixin, unittest.TestCase): """ OpenapiV1UsersEnabled unit test stubs - 修改Portal用户启用状态(new added) # noqa: E501 + 修改用户启用状态(new added) # noqa: E501 """ _configuration = configuration.Configuration() diff --git a/python/test/test_paths/test_openapi_v1_users_user_id/__init__.py b/python/test/test_paths/test_openapi_v1_users_user_id/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/python/test/test_paths/test_openapi_v1_users_user_id/__init__.py @@ -0,0 +1 @@ + diff --git a/python/test/test_paths/test_openapi_v1_users_user_id/test_get.py b/python/test/test_paths/test_openapi_v1_users_user_id/test_get.py new file mode 100644 index 00000000..f2278426 --- /dev/null +++ b/python/test/test_paths/test_openapi_v1_users_user_id/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_users_user_id import get # noqa: E501 +from apollo_openapi import configuration, schemas, api_client + +from .. import ApiTestMixin + + +class TestOpenapiV1UsersUserId(ApiTestMixin, unittest.TestCase): + """ + OpenapiV1UsersUserId unit test stubs + 获取指定用户(new added) # 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/.openapi-generator/FILES b/rust/.openapi-generator/FILES index 3b1adb58..a7e986dd 100644 --- a/rust/.openapi-generator/FILES +++ b/rust/.openapi-generator/FILES @@ -12,6 +12,8 @@ docs/OpenAppNamespaceDto.md docs/OpenAppRoleUserDto.md docs/OpenClusterDto.md docs/OpenClusterNamespaceRoleUserDto.md +docs/OpenConsumerCreateRequestDto.md +docs/OpenConsumerInfoDto.md docs/OpenCreateAppDto.md docs/OpenCreateNamespaceDto.md docs/OpenEnvClusterDto.md @@ -56,6 +58,8 @@ src/models/open_app_namespace_dto.rs src/models/open_app_role_user_dto.rs src/models/open_cluster_dto.rs src/models/open_cluster_namespace_role_user_dto.rs +src/models/open_consumer_create_request_dto.rs +src/models/open_consumer_info_dto.rs src/models/open_create_app_dto.rs src/models/open_create_namespace_dto.rs src/models/open_env_cluster_dto.rs diff --git a/rust/Cargo.toml b/rust/Cargo.toml index f9f6d8b9..d167287b 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apollo-openapi" -version = "0.3.5" +version = "0.3.6" authors = ["OpenAPI Generator team and contributors"] description = "

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\"
" # Override this license by providing a License Object in the OpenAPI. diff --git a/rust/README.md b/rust/README.md index eec2009b..812caf4a 100644 --- a/rust/README.md +++ b/rust/README.md @@ -22,8 +22,8 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. -- API version: 0.3.5 -- Package version: 0.3.5 +- API version: 0.3.6 +- Package version: 0.3.6 - Build package: `org.openapitools.codegen.languages.RustClientCodegen` ## Installation @@ -53,6 +53,8 @@ Class | Method | HTTP request | Description - [OpenAppRoleUserDto](docs/OpenAppRoleUserDto.md) - [OpenClusterDto](docs/OpenClusterDto.md) - [OpenClusterNamespaceRoleUserDto](docs/OpenClusterNamespaceRoleUserDto.md) + - [OpenConsumerCreateRequestDto](docs/OpenConsumerCreateRequestDto.md) + - [OpenConsumerInfoDto](docs/OpenConsumerInfoDto.md) - [OpenCreateAppDto](docs/OpenCreateAppDto.md) - [OpenCreateNamespaceDto](docs/OpenCreateNamespaceDto.md) - [OpenEnvClusterDto](docs/OpenEnvClusterDto.md) diff --git a/rust/docs/OpenConsumerCreateRequestDto.md b/rust/docs/OpenConsumerCreateRequestDto.md new file mode 100644 index 00000000..7fb5dc6e --- /dev/null +++ b/rust/docs/OpenConsumerCreateRequestDto.md @@ -0,0 +1,17 @@ +# OpenConsumerCreateRequestDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_id** | Option<**String**> | 第三方应用ID | [optional] +**allow_create_application** | Option<**bool**> | 是否允许该Consumer Token创建应用 | [optional][default to false] +**allow_manage_users** | Option<**bool**> | 是否允许该Consumer Token管理用户 | [optional][default to false] +**name** | Option<**String**> | 第三方应用名称 | [optional] +**org_id** | Option<**String**> | 部门ID | [optional] +**org_name** | Option<**String**> | 部门名称 | [optional] +**owner_name** | Option<**String**> | 负责人用户名 | [optional] +**rate_limit_enabled** | Option<**bool**> | 是否开启限流 | [optional][default to false] +**rate_limit** | Option<**i32**> | 限流QPS,0表示不限流 | [optional][default to 0] + +[[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/docs/OpenConsumerInfoDto.md b/rust/docs/OpenConsumerInfoDto.md new file mode 100644 index 00000000..223842c2 --- /dev/null +++ b/rust/docs/OpenConsumerInfoDto.md @@ -0,0 +1,19 @@ +# OpenConsumerInfoDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_id** | Option<**String**> | 第三方应用ID | [optional] +**name** | Option<**String**> | 第三方应用名称 | [optional] +**org_id** | Option<**String**> | 部门ID | [optional] +**org_name** | Option<**String**> | 部门名称 | [optional] +**owner_name** | Option<**String**> | 负责人用户名 | [optional] +**owner_email** | Option<**String**> | 负责人邮箱 | [optional] +**consumer_id** | Option<**i64**> | Consumer ID | [optional] +**token** | Option<**String**> | Consumer Token,仅在创建或按应用查询详情时返回 | [optional] +**allow_create_application** | Option<**bool**> | 是否允许该Consumer Token创建应用 | [optional][default to false] +**allow_manage_users** | Option<**bool**> | 是否允许该Consumer Token管理用户 | [optional][default to false] +**rate_limit** | Option<**i32**> | 限流QPS,0表示不限流 | [optional][default to 0] + +[[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/apis/configuration.rs b/rust/src/apis/configuration.rs index a152649c..b24f67c4 100644 --- a/rust/src/apis/configuration.rs +++ b/rust/src/apis/configuration.rs @@ -40,7 +40,7 @@ impl Default for Configuration { fn default() -> Self { Configuration { base_path: "http://localhost".to_owned(), - user_agent: Some("OpenAPI-Generator/0.3.5/rust".to_owned()), + user_agent: Some("OpenAPI-Generator/0.3.6/rust".to_owned()), client: reqwest::Client::new(), basic_auth: None, oauth_access_token: None, diff --git a/rust/src/models/mod.rs b/rust/src/models/mod.rs index 2e9e710a..79cd150e 100644 --- a/rust/src/models/mod.rs +++ b/rust/src/models/mod.rs @@ -16,6 +16,10 @@ pub mod open_cluster_dto; pub use self::open_cluster_dto::OpenClusterDto; pub mod open_cluster_namespace_role_user_dto; pub use self::open_cluster_namespace_role_user_dto::OpenClusterNamespaceRoleUserDto; +pub mod open_consumer_create_request_dto; +pub use self::open_consumer_create_request_dto::OpenConsumerCreateRequestDto; +pub mod open_consumer_info_dto; +pub use self::open_consumer_info_dto::OpenConsumerInfoDto; pub mod open_create_app_dto; pub use self::open_create_app_dto::OpenCreateAppDto; pub mod open_create_namespace_dto; diff --git a/rust/src/models/open_consumer_create_request_dto.rs b/rust/src/models/open_consumer_create_request_dto.rs new file mode 100644 index 00000000..0f5772a7 --- /dev/null +++ b/rust/src/models/open_consumer_create_request_dto.rs @@ -0,0 +1,58 @@ +/* + * 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\"
+ * + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct OpenConsumerCreateRequestDto { + /// 第三方应用ID + #[serde(rename = "appId", skip_serializing_if = "Option::is_none")] + pub app_id: Option, + /// 是否允许该Consumer Token创建应用 + #[serde(rename = "allowCreateApplication", skip_serializing_if = "Option::is_none")] + pub allow_create_application: Option, + /// 是否允许该Consumer Token管理用户 + #[serde(rename = "allowManageUsers", skip_serializing_if = "Option::is_none")] + pub allow_manage_users: Option, + /// 第三方应用名称 + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// 部门ID + #[serde(rename = "orgId", skip_serializing_if = "Option::is_none")] + pub org_id: Option, + /// 部门名称 + #[serde(rename = "orgName", skip_serializing_if = "Option::is_none")] + pub org_name: Option, + /// 负责人用户名 + #[serde(rename = "ownerName", skip_serializing_if = "Option::is_none")] + pub owner_name: Option, + /// 是否开启限流 + #[serde(rename = "rateLimitEnabled", skip_serializing_if = "Option::is_none")] + pub rate_limit_enabled: Option, + /// 限流QPS,0表示不限流 + #[serde(rename = "rateLimit", skip_serializing_if = "Option::is_none")] + pub rate_limit: Option, +} + +impl OpenConsumerCreateRequestDto { + pub fn new() -> OpenConsumerCreateRequestDto { + OpenConsumerCreateRequestDto { + app_id: None, + allow_create_application: None, + allow_manage_users: None, + name: None, + org_id: None, + org_name: None, + owner_name: None, + rate_limit_enabled: None, + rate_limit: None, + } + } +} diff --git a/rust/src/models/open_consumer_info_dto.rs b/rust/src/models/open_consumer_info_dto.rs new file mode 100644 index 00000000..faefacb2 --- /dev/null +++ b/rust/src/models/open_consumer_info_dto.rs @@ -0,0 +1,66 @@ +/* + * 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\"
+ * + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct OpenConsumerInfoDto { + /// 第三方应用ID + #[serde(rename = "appId", skip_serializing_if = "Option::is_none")] + pub app_id: Option, + /// 第三方应用名称 + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// 部门ID + #[serde(rename = "orgId", skip_serializing_if = "Option::is_none")] + pub org_id: Option, + /// 部门名称 + #[serde(rename = "orgName", skip_serializing_if = "Option::is_none")] + pub org_name: Option, + /// 负责人用户名 + #[serde(rename = "ownerName", skip_serializing_if = "Option::is_none")] + pub owner_name: Option, + /// 负责人邮箱 + #[serde(rename = "ownerEmail", skip_serializing_if = "Option::is_none")] + pub owner_email: Option, + /// Consumer ID + #[serde(rename = "consumerId", skip_serializing_if = "Option::is_none")] + pub consumer_id: Option, + /// Consumer Token,仅在创建或按应用查询详情时返回 + #[serde(rename = "token", skip_serializing_if = "Option::is_none")] + pub token: Option, + /// 是否允许该Consumer Token创建应用 + #[serde(rename = "allowCreateApplication", skip_serializing_if = "Option::is_none")] + pub allow_create_application: Option, + /// 是否允许该Consumer Token管理用户 + #[serde(rename = "allowManageUsers", skip_serializing_if = "Option::is_none")] + pub allow_manage_users: Option, + /// 限流QPS,0表示不限流 + #[serde(rename = "rateLimit", skip_serializing_if = "Option::is_none")] + pub rate_limit: Option, +} + +impl OpenConsumerInfoDto { + pub fn new() -> OpenConsumerInfoDto { + OpenConsumerInfoDto { + app_id: None, + name: None, + org_id: None, + org_name: None, + owner_name: None, + owner_email: None, + consumer_id: None, + token: None, + allow_create_application: None, + allow_manage_users: None, + rate_limit: None, + } + } +} diff --git a/spring-boot2/.openapi-generator/FILES b/spring-boot2/.openapi-generator/FILES index ad41e54d..e0bd9dd3 100644 --- a/spring-boot2/.openapi-generator/FILES +++ b/spring-boot2/.openapi-generator/FILES @@ -43,12 +43,12 @@ src/main/java/com/apollo/openapi/server/api/PermissionManagementApiDelegate.java src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java -src/main/java/com/apollo/openapi/server/api/PortalUserManagementApi.java -src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiController.java -src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiDelegate.java src/main/java/com/apollo/openapi/server/api/ReleaseManagementApi.java src/main/java/com/apollo/openapi/server/api/ReleaseManagementApiController.java src/main/java/com/apollo/openapi/server/api/ReleaseManagementApiDelegate.java +src/main/java/com/apollo/openapi/server/api/UserManagementApi.java +src/main/java/com/apollo/openapi/server/api/UserManagementApiController.java +src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java src/main/java/com/apollo/openapi/server/config/HomeController.java src/main/java/com/apollo/openapi/server/config/SpringDocConfiguration.java src/main/java/com/apollo/openapi/server/model/ExceptionResponse.java @@ -60,6 +60,8 @@ src/main/java/com/apollo/openapi/server/model/OpenAppNamespaceDTO.java src/main/java/com/apollo/openapi/server/model/OpenAppRoleUserDTO.java src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java src/main/java/com/apollo/openapi/server/model/OpenClusterNamespaceRoleUserDTO.java +src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java +src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java src/main/java/com/apollo/openapi/server/model/OpenCreateAppDTO.java src/main/java/com/apollo/openapi/server/model/OpenCreateNamespaceDTO.java src/main/java/com/apollo/openapi/server/model/OpenEnvClusterDTO.java diff --git a/spring-boot2/pom.xml b/spring-boot2/pom.xml index 68035eed..ee31ff45 100644 --- a/spring-boot2/pom.xml +++ b/spring-boot2/pom.xml @@ -4,7 +4,7 @@ apollo-openapi-server jar apollo-openapi-server - 0.3.5 + 0.3.6 1.8 ${java.version} diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java index 60f732a3..0ba9df0e 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java @@ -5,6 +5,8 @@ */ package com.apollo.openapi.server.api; +import com.apollo.openapi.server.model.OpenConsumerCreateRequestDTO; +import com.apollo.openapi.server.model.OpenConsumerInfoDTO; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -181,7 +183,7 @@ default ResponseEntity checkSystemHealth( * POST /openapi/v1/consumers : 创建开放平台消费者(new added) * POST /openapi/v1/consumers * - * @param body (required) + * @param openConsumerCreateRequestDTO (required) * @param expires (optional) * @return 成功创建消费者 (status code 200) */ @@ -192,7 +194,7 @@ default ResponseEntity checkSystemHealth( tags = { "Portal Management" }, responses = { @ApiResponse(responseCode = "200", description = "成功创建消费者", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = Object.class)) + @Content(mediaType = "application/json", schema = @Schema(implementation = OpenConsumerInfoDTO.class)) }) }, security = { @@ -205,11 +207,11 @@ default ResponseEntity checkSystemHealth( produces = { "application/json" }, consumes = { "application/json" } ) - default ResponseEntity createConsumer( - @Parameter(name = "body", description = "", required = true) @Valid @RequestBody Object body, + default ResponseEntity createConsumer( + @Parameter(name = "OpenConsumerCreateRequestDTO", description = "", required = true) @Valid @RequestBody OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, @Parameter(name = "expires", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "expires", required = false) String expires ) { - return getDelegate().createConsumer(body, expires); + return getDelegate().createConsumer(openConsumerCreateRequestDTO, expires); } @@ -905,7 +907,7 @@ default ResponseEntity getAuditProperties( tags = { "Portal Management" }, responses = { @ApiResponse(responseCode = "200", description = "成功获取消费者列表", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Object.class))) + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OpenConsumerInfoDTO.class))) }) }, security = { @@ -917,7 +919,7 @@ default ResponseEntity getAuditProperties( value = "/openapi/v1/consumers", produces = { "application/json" } ) - default ResponseEntity> getConsumerList( + default ResponseEntity> getConsumerList( @Parameter(name = "page", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @Parameter(name = "size", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "size", required = false, defaultValue = "10") Integer size ) { diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java index 5f05e1e3..2e79d69c 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java @@ -1,5 +1,7 @@ package com.apollo.openapi.server.api; +import com.apollo.openapi.server.model.OpenConsumerCreateRequestDTO; +import com.apollo.openapi.server.model.OpenConsumerInfoDTO; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java index d4905115..8dca23d4 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java @@ -1,5 +1,7 @@ package com.apollo.openapi.server.api; +import com.apollo.openapi.server.model.OpenConsumerCreateRequestDTO; +import com.apollo.openapi.server.model.OpenConsumerInfoDTO; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -97,13 +99,22 @@ default ResponseEntity checkSystemHealth(String instanceId) { * POST /openapi/v1/consumers : 创建开放平台消费者(new added) * POST /openapi/v1/consumers * - * @param body (required) + * @param openConsumerCreateRequestDTO (required) * @param expires (optional) * @return 成功创建消费者 (status code 200) * @see PortalManagementApi#createConsumer */ - default ResponseEntity createConsumer(Object body, + default ResponseEntity createConsumer(OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO, String expires) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -505,12 +516,12 @@ default ResponseEntity getAuditProperties() { * @return 成功获取消费者列表 (status code 200) * @see PortalManagementApi#getConsumerList */ - default ResponseEntity> getConsumerList(Integer page, + default ResponseEntity> getConsumerList(Integer page, Integer size) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "[ \"{}\", \"{}\" ]"; + String exampleString = "[ { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }, { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" } ]"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java similarity index 63% rename from spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApi.java rename to spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java index e1ebbb49..f0b22c27 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApi.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java @@ -32,27 +32,28 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @Validated -@Tag(name = "Portal User Management", description = "Portal用户管理相关接口,主要供Portal UI在用户登录态下调用") -public interface PortalUserManagementApi { +@Tag(name = "User Management", description = "用户管理相关接口,支持Portal用户登录态和具备用户管理权限的Consumer Token调用") +public interface UserManagementApi { - default PortalUserManagementApiDelegate getDelegate() { - return new PortalUserManagementApiDelegate() {}; + default UserManagementApiDelegate getDelegate() { + return new UserManagementApiDelegate() {}; } /** - * PUT /openapi/v1/users/enabled : 修改Portal用户启用状态(new added) - * PUT /openapi/v1/users/enabled + * PUT /openapi/v1/users/enabled : 修改用户启用状态(new added) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * * @param openUserDTO (required) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @return 用户状态修改成功 (status code 200) * or 请求参数错误 (status code 400) * or 权限不足 (status code 403) */ @Operation( operationId = "changeUserEnabled", - summary = "修改Portal用户启用状态(new added)", - description = "PUT /openapi/v1/users/enabled", - tags = { "Portal User Management" }, + summary = "修改用户启用状态(new added)", + description = "PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator", + tags = { "User Management" }, responses = { @ApiResponse(responseCode = "200", description = "用户状态修改成功"), @ApiResponse(responseCode = "400", description = "请求参数错误", content = { @@ -73,27 +74,29 @@ default PortalUserManagementApiDelegate getDelegate() { consumes = { "application/json" } ) default ResponseEntity changeUserEnabled( - @Parameter(name = "OpenUserDTO", description = "", required = true) @Valid @RequestBody OpenUserDTO openUserDTO + @Parameter(name = "OpenUserDTO", description = "", required = true) @Valid @RequestBody OpenUserDTO openUserDTO, + @Parameter(name = "operator", description = "操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数", in = ParameterIn.QUERY) @Valid @RequestParam(value = "operator", required = false) String operator ) { - return getDelegate().changeUserEnabled(openUserDTO); + return getDelegate().changeUserEnabled(openUserDTO, operator); } /** - * POST /openapi/v1/users : 创建或更新Portal用户(new added) - * POST /openapi/v1/users + * POST /openapi/v1/users : 创建或更新用户(new added) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * * @param openUserDTO (required) * @param isCreate true 表示创建用户,false 表示更新用户 (optional, default to false) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @return 用户创建或更新成功 (status code 200) * or 请求参数错误 (status code 400) * or 权限不足 (status code 403) */ @Operation( operationId = "createOrUpdateUser", - summary = "创建或更新Portal用户(new added)", - description = "POST /openapi/v1/users", - tags = { "Portal User Management" }, + summary = "创建或更新用户(new added)", + description = "POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator", + tags = { "User Management" }, responses = { @ApiResponse(responseCode = "200", description = "用户创建或更新成功"), @ApiResponse(responseCode = "400", description = "请求参数错误", content = { @@ -115,9 +118,10 @@ default ResponseEntity changeUserEnabled( ) default ResponseEntity createOrUpdateUser( @Parameter(name = "OpenUserDTO", description = "", required = true) @Valid @RequestBody OpenUserDTO openUserDTO, - @Parameter(name = "isCreate", description = "true 表示创建用户,false 表示更新用户", in = ParameterIn.QUERY) @Valid @RequestParam(value = "isCreate", required = false, defaultValue = "false") Boolean isCreate + @Parameter(name = "isCreate", description = "true 表示创建用户,false 表示更新用户", in = ParameterIn.QUERY) @Valid @RequestParam(value = "isCreate", required = false, defaultValue = "false") Boolean isCreate, + @Parameter(name = "operator", description = "操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数", in = ParameterIn.QUERY) @Valid @RequestParam(value = "operator", required = false) String operator ) { - return getDelegate().createOrUpdateUser(openUserDTO, isCreate); + return getDelegate().createOrUpdateUser(openUserDTO, isCreate, operator); } @@ -133,7 +137,7 @@ default ResponseEntity createOrUpdateUser( operationId = "getCurrentUser", summary = "获取当前Portal用户(new added)", description = "GET /openapi/v1/user", - tags = { "Portal User Management" }, + tags = { "User Management" }, responses = { @ApiResponse(responseCode = "200", description = "成功获取当前用户", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = OpenUserInfoDTO.class)) @@ -162,8 +166,49 @@ default ResponseEntity getCurrentUser( /** - * GET /openapi/v1/users : 搜索Portal用户(new added) - * GET /openapi/v1/users + * GET /openapi/v1/users/{userId} : 获取指定用户(new added) + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * + * @param userId 用户ID (required) + * @return 成功获取用户 (status code 200) + * or 请求参数错误或用户不存在 (status code 400) + * or 权限不足 (status code 403) + */ + @Operation( + operationId = "getUserByUserId", + summary = "获取指定用户(new added)", + description = "GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问", + tags = { "User Management" }, + responses = { + @ApiResponse(responseCode = "200", description = "成功获取用户", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = OpenUserInfoDTO.class)) + }), + @ApiResponse(responseCode = "400", description = "请求参数错误或用户不存在", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "权限不足", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "ApiKeyAuth") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/openapi/v1/users/{userId}", + produces = { "application/json" } + ) + default ResponseEntity getUserByUserId( + @Parameter(name = "userId", description = "用户ID", required = true, in = ParameterIn.PATH) @PathVariable("userId") String userId + ) { + return getDelegate().getUserByUserId(userId); + } + + + /** + * GET /openapi/v1/users : 搜索用户(new added) + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 * * @param keyword 用户名、显示名或邮箱关键字 (required) * @param includeInactiveUsers 是否包含禁用用户 (optional, default to false) @@ -171,13 +216,13 @@ default ResponseEntity getCurrentUser( * @param limit 返回数量 (optional, default to 10) * @return 成功获取用户列表 (status code 200) * or 未登录或未授权访问 (status code 401) - * or 仅支持Portal用户登录态访问 (status code 403) + * or 权限不足 (status code 403) */ @Operation( operationId = "searchUsers", - summary = "搜索Portal用户(new added)", - description = "GET /openapi/v1/users", - tags = { "Portal User Management" }, + summary = "搜索用户(new added)", + description = "GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问", + tags = { "User Management" }, responses = { @ApiResponse(responseCode = "200", description = "成功获取用户列表", content = { @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OpenUserInfoDTO.class))) @@ -185,7 +230,7 @@ default ResponseEntity getCurrentUser( @ApiResponse(responseCode = "401", description = "未登录或未授权访问", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) }), - @ApiResponse(responseCode = "403", description = "仅支持Portal用户登录态访问", content = { + @ApiResponse(responseCode = "403", description = "权限不足", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) }) }, diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiController.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiController.java similarity index 79% rename from spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiController.java rename to spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiController.java index 03c22b57..28b21dbc 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiController.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiController.java @@ -30,16 +30,16 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @Controller @RequestMapping("${openapi.apolloOpen.base-path:}") -public class PortalUserManagementApiController implements PortalUserManagementApi { +public class UserManagementApiController implements UserManagementApi { - private final PortalUserManagementApiDelegate delegate; + private final UserManagementApiDelegate delegate; - public PortalUserManagementApiController(@Autowired(required = false) PortalUserManagementApiDelegate delegate) { - this.delegate = Optional.ofNullable(delegate).orElse(new PortalUserManagementApiDelegate() {}); + public UserManagementApiController(@Autowired(required = false) UserManagementApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new UserManagementApiDelegate() {}); } @Override - public PortalUserManagementApiDelegate getDelegate() { + public UserManagementApiDelegate getDelegate() { return delegate; } diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java similarity index 60% rename from spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiDelegate.java rename to spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java index f4acec97..ef75415f 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalUserManagementApiDelegate.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java @@ -15,44 +15,48 @@ import javax.annotation.Generated; /** - * A delegate to be called by the {@link PortalUserManagementApiController}}. + * A delegate to be called by the {@link UserManagementApiController}}. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. */ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public interface PortalUserManagementApiDelegate { +public interface UserManagementApiDelegate { default Optional getRequest() { return Optional.empty(); } /** - * PUT /openapi/v1/users/enabled : 修改Portal用户启用状态(new added) - * PUT /openapi/v1/users/enabled + * PUT /openapi/v1/users/enabled : 修改用户启用状态(new added) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * * @param openUserDTO (required) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @return 用户状态修改成功 (status code 200) * or 请求参数错误 (status code 400) * or 权限不足 (status code 403) - * @see PortalUserManagementApi#changeUserEnabled + * @see UserManagementApi#changeUserEnabled */ - default ResponseEntity changeUserEnabled(OpenUserDTO openUserDTO) { + default ResponseEntity changeUserEnabled(OpenUserDTO openUserDTO, + String operator) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } /** - * POST /openapi/v1/users : 创建或更新Portal用户(new added) - * POST /openapi/v1/users + * POST /openapi/v1/users : 创建或更新用户(new added) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator * * @param openUserDTO (required) * @param isCreate true 表示创建用户,false 表示更新用户 (optional, default to false) + * @param operator 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 (optional) * @return 用户创建或更新成功 (status code 200) * or 请求参数错误 (status code 400) * or 权限不足 (status code 403) - * @see PortalUserManagementApi#createOrUpdateUser + * @see UserManagementApi#createOrUpdateUser */ default ResponseEntity createOrUpdateUser(OpenUserDTO openUserDTO, - Boolean isCreate) { + Boolean isCreate, + String operator) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -64,7 +68,7 @@ default ResponseEntity createOrUpdateUser(OpenUserDTO openUserDTO, * @return 成功获取当前用户 (status code 200) * or 未登录或未授权访问 (status code 401) * or 仅支持Portal用户登录态访问 (status code 403) - * @see PortalUserManagementApi#getCurrentUser + * @see UserManagementApi#getCurrentUser */ default ResponseEntity getCurrentUser() { getRequest().ifPresent(request -> { @@ -81,8 +85,32 @@ default ResponseEntity getCurrentUser() { } /** - * GET /openapi/v1/users : 搜索Portal用户(new added) - * GET /openapi/v1/users + * GET /openapi/v1/users/{userId} : 获取指定用户(new added) + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * + * @param userId 用户ID (required) + * @return 成功获取用户 (status code 200) + * or 请求参数错误或用户不存在 (status code 400) + * or 权限不足 (status code 403) + * @see UserManagementApi#getUserByUserId + */ + default ResponseEntity getUserByUserId(String userId) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"name\" : \"name\", \"userId\" : \"userId\", \"email\" : \"email\", \"enabled\" : 0 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** + * GET /openapi/v1/users : 搜索用户(new added) + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 * * @param keyword 用户名、显示名或邮箱关键字 (required) * @param includeInactiveUsers 是否包含禁用用户 (optional, default to false) @@ -90,8 +118,8 @@ default ResponseEntity getCurrentUser() { * @param limit 返回数量 (optional, default to 10) * @return 成功获取用户列表 (status code 200) * or 未登录或未授权访问 (status code 401) - * or 仅支持Portal用户登录态访问 (status code 403) - * @see PortalUserManagementApi#searchUsers + * or 权限不足 (status code 403) + * @see UserManagementApi#searchUsers */ default ResponseEntity> searchUsers(String keyword, Boolean includeInactiveUsers, diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/config/SpringDocConfiguration.java b/spring-boot2/src/main/java/com/apollo/openapi/server/config/SpringDocConfiguration.java index 40a172ba..48cbea97 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/config/SpringDocConfiguration.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/config/SpringDocConfiguration.java @@ -20,7 +20,7 @@ OpenAPI apiInfo() { new Info() .title("Apollo OpenAPI") .description("

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\"
") - .version("0.3.5") + .version("0.3.6") ) .components( new Components() diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java new file mode 100644 index 00000000..abf8a4b7 --- /dev/null +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java @@ -0,0 +1,274 @@ +package com.apollo.openapi.server.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OpenConsumerCreateRequestDTO + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class OpenConsumerCreateRequestDTO { + + private String appId; + + private Boolean allowCreateApplication = false; + + private Boolean allowManageUsers = false; + + private String name; + + private String orgId; + + private String orgName; + + private String ownerName; + + private Boolean rateLimitEnabled = false; + + private Integer rateLimit = 0; + + public OpenConsumerCreateRequestDTO appId(String appId) { + this.appId = appId; + return this; + } + + /** + * 第三方应用ID + * @return appId + */ + + @Schema(name = "appId", description = "第三方应用ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("appId") + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public OpenConsumerCreateRequestDTO allowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + return this; + } + + /** + * 是否允许该Consumer Token创建应用 + * @return allowCreateApplication + */ + + @Schema(name = "allowCreateApplication", description = "是否允许该Consumer Token创建应用", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("allowCreateApplication") + public Boolean getAllowCreateApplication() { + return allowCreateApplication; + } + + public void setAllowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + } + + public OpenConsumerCreateRequestDTO allowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + return this; + } + + /** + * 是否允许该Consumer Token管理用户 + * @return allowManageUsers + */ + + @Schema(name = "allowManageUsers", description = "是否允许该Consumer Token管理用户", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("allowManageUsers") + public Boolean getAllowManageUsers() { + return allowManageUsers; + } + + public void setAllowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + } + + public OpenConsumerCreateRequestDTO name(String name) { + this.name = name; + return this; + } + + /** + * 第三方应用名称 + * @return name + */ + + @Schema(name = "name", description = "第三方应用名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public OpenConsumerCreateRequestDTO orgId(String orgId) { + this.orgId = orgId; + return this; + } + + /** + * 部门ID + * @return orgId + */ + + @Schema(name = "orgId", description = "部门ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public OpenConsumerCreateRequestDTO orgName(String orgName) { + this.orgName = orgName; + return this; + } + + /** + * 部门名称 + * @return orgName + */ + + @Schema(name = "orgName", description = "部门名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("orgName") + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public OpenConsumerCreateRequestDTO ownerName(String ownerName) { + this.ownerName = ownerName; + return this; + } + + /** + * 负责人用户名 + * @return ownerName + */ + + @Schema(name = "ownerName", description = "负责人用户名", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("ownerName") + public String getOwnerName() { + return ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public OpenConsumerCreateRequestDTO rateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + return this; + } + + /** + * 是否开启限流 + * @return rateLimitEnabled + */ + + @Schema(name = "rateLimitEnabled", description = "是否开启限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("rateLimitEnabled") + public Boolean getRateLimitEnabled() { + return rateLimitEnabled; + } + + public void setRateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + } + + public OpenConsumerCreateRequestDTO rateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + return this; + } + + /** + * 限流QPS,0表示不限流 + * @return rateLimit + */ + + @Schema(name = "rateLimit", description = "限流QPS,0表示不限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("rateLimit") + public Integer getRateLimit() { + return rateLimit; + } + + public void setRateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenConsumerCreateRequestDTO openConsumerCreateRequestDTO = (OpenConsumerCreateRequestDTO) o; + return Objects.equals(this.appId, openConsumerCreateRequestDTO.appId) && + Objects.equals(this.allowCreateApplication, openConsumerCreateRequestDTO.allowCreateApplication) && + Objects.equals(this.allowManageUsers, openConsumerCreateRequestDTO.allowManageUsers) && + Objects.equals(this.name, openConsumerCreateRequestDTO.name) && + Objects.equals(this.orgId, openConsumerCreateRequestDTO.orgId) && + Objects.equals(this.orgName, openConsumerCreateRequestDTO.orgName) && + Objects.equals(this.ownerName, openConsumerCreateRequestDTO.ownerName) && + Objects.equals(this.rateLimitEnabled, openConsumerCreateRequestDTO.rateLimitEnabled) && + Objects.equals(this.rateLimit, openConsumerCreateRequestDTO.rateLimit); + } + + @Override + public int hashCode() { + return Objects.hash(appId, allowCreateApplication, allowManageUsers, name, orgId, orgName, ownerName, rateLimitEnabled, rateLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenConsumerCreateRequestDTO {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); + sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" rateLimitEnabled: ").append(toIndentedString(rateLimitEnabled)).append("\n"); + sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java new file mode 100644 index 00000000..e1af5385 --- /dev/null +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java @@ -0,0 +1,322 @@ +package com.apollo.openapi.server.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OpenConsumerInfoDTO + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class OpenConsumerInfoDTO { + + private String appId; + + private String name; + + private String orgId; + + private String orgName; + + private String ownerName; + + private String ownerEmail; + + private Long consumerId; + + private String token; + + private Boolean allowCreateApplication = false; + + private Boolean allowManageUsers = false; + + private Integer rateLimit = 0; + + public OpenConsumerInfoDTO appId(String appId) { + this.appId = appId; + return this; + } + + /** + * 第三方应用ID + * @return appId + */ + + @Schema(name = "appId", description = "第三方应用ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("appId") + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public OpenConsumerInfoDTO name(String name) { + this.name = name; + return this; + } + + /** + * 第三方应用名称 + * @return name + */ + + @Schema(name = "name", description = "第三方应用名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public OpenConsumerInfoDTO orgId(String orgId) { + this.orgId = orgId; + return this; + } + + /** + * 部门ID + * @return orgId + */ + + @Schema(name = "orgId", description = "部门ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public OpenConsumerInfoDTO orgName(String orgName) { + this.orgName = orgName; + return this; + } + + /** + * 部门名称 + * @return orgName + */ + + @Schema(name = "orgName", description = "部门名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("orgName") + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public OpenConsumerInfoDTO ownerName(String ownerName) { + this.ownerName = ownerName; + return this; + } + + /** + * 负责人用户名 + * @return ownerName + */ + + @Schema(name = "ownerName", description = "负责人用户名", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("ownerName") + public String getOwnerName() { + return ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public OpenConsumerInfoDTO ownerEmail(String ownerEmail) { + this.ownerEmail = ownerEmail; + return this; + } + + /** + * 负责人邮箱 + * @return ownerEmail + */ + + @Schema(name = "ownerEmail", description = "负责人邮箱", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("ownerEmail") + public String getOwnerEmail() { + return ownerEmail; + } + + public void setOwnerEmail(String ownerEmail) { + this.ownerEmail = ownerEmail; + } + + public OpenConsumerInfoDTO consumerId(Long consumerId) { + this.consumerId = consumerId; + return this; + } + + /** + * Consumer ID + * @return consumerId + */ + + @Schema(name = "consumerId", description = "Consumer ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("consumerId") + public Long getConsumerId() { + return consumerId; + } + + public void setConsumerId(Long consumerId) { + this.consumerId = consumerId; + } + + public OpenConsumerInfoDTO token(String token) { + this.token = token; + return this; + } + + /** + * Consumer Token,仅在创建或按应用查询详情时返回 + * @return token + */ + + @Schema(name = "token", description = "Consumer Token,仅在创建或按应用查询详情时返回", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("token") + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public OpenConsumerInfoDTO allowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + return this; + } + + /** + * 是否允许该Consumer Token创建应用 + * @return allowCreateApplication + */ + + @Schema(name = "allowCreateApplication", description = "是否允许该Consumer Token创建应用", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("allowCreateApplication") + public Boolean getAllowCreateApplication() { + return allowCreateApplication; + } + + public void setAllowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + } + + public OpenConsumerInfoDTO allowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + return this; + } + + /** + * 是否允许该Consumer Token管理用户 + * @return allowManageUsers + */ + + @Schema(name = "allowManageUsers", description = "是否允许该Consumer Token管理用户", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("allowManageUsers") + public Boolean getAllowManageUsers() { + return allowManageUsers; + } + + public void setAllowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + } + + public OpenConsumerInfoDTO rateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + return this; + } + + /** + * 限流QPS,0表示不限流 + * @return rateLimit + */ + + @Schema(name = "rateLimit", description = "限流QPS,0表示不限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("rateLimit") + public Integer getRateLimit() { + return rateLimit; + } + + public void setRateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenConsumerInfoDTO openConsumerInfoDTO = (OpenConsumerInfoDTO) o; + return Objects.equals(this.appId, openConsumerInfoDTO.appId) && + Objects.equals(this.name, openConsumerInfoDTO.name) && + Objects.equals(this.orgId, openConsumerInfoDTO.orgId) && + Objects.equals(this.orgName, openConsumerInfoDTO.orgName) && + Objects.equals(this.ownerName, openConsumerInfoDTO.ownerName) && + Objects.equals(this.ownerEmail, openConsumerInfoDTO.ownerEmail) && + Objects.equals(this.consumerId, openConsumerInfoDTO.consumerId) && + Objects.equals(this.token, openConsumerInfoDTO.token) && + Objects.equals(this.allowCreateApplication, openConsumerInfoDTO.allowCreateApplication) && + Objects.equals(this.allowManageUsers, openConsumerInfoDTO.allowManageUsers) && + Objects.equals(this.rateLimit, openConsumerInfoDTO.rateLimit); + } + + @Override + public int hashCode() { + return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, token, allowCreateApplication, allowManageUsers, rateLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenConsumerInfoDTO {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" ownerEmail: ").append(toIndentedString(ownerEmail)).append("\n"); + sb.append(" consumerId: ").append(toIndentedString(consumerId)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); + sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); + sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/spring-boot2/src/main/resources/openapi.yaml b/spring-boot2/src/main/resources/openapi.yaml index f9615bd6..0eb55f82 100644 --- a/spring-boot2/src/main/resources/openapi.yaml +++ b/spring-boot2/src/main/resources/openapi.yaml @@ -17,7 +17,7 @@ info:
curl -X GET "http://localhost:8070/openapi/v1/apps" \
     -H "Authorization: your_token_here"
title: Apollo OpenAPI - version: 0.3.5 + version: 0.3.6 servers: - url: / security: @@ -49,8 +49,8 @@ tags: name: AccessKey Management - description: 权限管理相关接口,包括权限查询等功能 name: Permission Management -- description: Portal用户管理相关接口,主要供Portal UI在用户登录态下调用 - name: Portal User Management +- description: 用户管理相关接口,支持Portal用户登录态和具备用户管理权限的Consumer Token调用 + name: User Management - description: Portal UI 登录态管理接口,主要供当前版本 Portal 前端调用 name: Portal Management paths: @@ -5823,14 +5823,14 @@ paths: description: 仅支持Portal用户登录态访问 summary: 获取当前Portal用户(new added) tags: - - Portal User Management + - User Management x-accepts: application/json x-tags: - - tag: Portal User Management + - tag: User Management /openapi/v1/users: get: deprecated: false - description: GET /openapi/v1/users + description: GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 operationId: searchUsers parameters: - description: 用户名、显示名或邮箱关键字 @@ -5890,16 +5890,16 @@ paths: application/json: schema: $ref: '#/components/schemas/ExceptionResponse' - description: 仅支持Portal用户登录态访问 - summary: 搜索Portal用户(new added) + description: 权限不足 + summary: 搜索用户(new added) tags: - - Portal User Management + - User Management x-accepts: application/json x-tags: - - tag: Portal User Management + - tag: User Management post: deprecated: false - description: POST /openapi/v1/users + description: POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator operationId: createOrUpdateUser parameters: - description: true 表示创建用户,false 表示更新用户 @@ -5911,6 +5911,14 @@ paths: default: false type: boolean style: form + - description: 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 + explode: true + in: query + name: operator + required: false + schema: + type: string + style: form requestBody: content: application/json: @@ -5932,18 +5940,68 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' description: 权限不足 - summary: 创建或更新Portal用户(new added) + summary: 创建或更新用户(new added) tags: - - Portal User Management + - User Management x-content-type: application/json x-accepts: application/json x-tags: - - tag: Portal User Management + - tag: User Management + /openapi/v1/users/{userId}: + get: + deprecated: false + description: "GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的\ + Consumer Token访问" + operationId: getUserByUserId + parameters: + - description: 用户ID + explode: false + in: path + name: userId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OpenUserInfoDTO' + description: 成功获取用户 + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + description: 请求参数错误或用户不存在 + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + description: 权限不足 + summary: 获取指定用户(new added) + tags: + - User Management + x-accepts: application/json + x-tags: + - tag: User Management /openapi/v1/users/enabled: put: deprecated: false - description: PUT /openapi/v1/users/enabled + description: PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer + Token访问时需要具备ManageUsers权限并传入有效operator operationId: changeUserEnabled + parameters: + - description: 操作人用户名,Consumer Token访问时必填且必须是已存在用户;Portal用户登录态会忽略该参数 + explode: true + in: query + name: operator + required: false + schema: + type: string + style: form requestBody: content: application/json: @@ -5965,13 +6023,13 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' description: 权限不足 - summary: 修改Portal用户启用状态(new added) + summary: 修改用户启用状态(new added) tags: - - Portal User Management + - User Management x-content-type: application/json x-accepts: application/json x-tags: - - tag: Portal User Management + - tag: User Management /openapi/v1/apollo/audit/properties: get: deprecated: false @@ -6333,7 +6391,7 @@ paths: application/json: schema: items: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' type: array description: 成功获取消费者列表 summary: 查询开放平台消费者列表(new added) @@ -6359,14 +6417,14 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerCreateRequestDTO' required: true responses: "200": content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' description: 成功创建消费者 summary: 创建开放平台消费者(new added) tags: @@ -8603,6 +8661,102 @@ components: description: "" type: boolean type: object + OpenConsumerCreateRequestDTO: + example: + orgName: orgName + rateLimit: 0 + ownerName: ownerName + appId: appId + name: name + allowCreateApplication: false + allowManageUsers: false + rateLimitEnabled: false + orgId: orgId + properties: + appId: + description: 第三方应用ID + type: string + allowCreateApplication: + default: false + description: 是否允许该Consumer Token创建应用 + type: boolean + allowManageUsers: + default: false + description: 是否允许该Consumer Token管理用户 + type: boolean + name: + description: 第三方应用名称 + type: string + orgId: + description: 部门ID + type: string + orgName: + description: 部门名称 + type: string + ownerName: + description: 负责人用户名 + type: string + rateLimitEnabled: + default: false + description: 是否开启限流 + type: boolean + rateLimit: + default: 0 + description: 限流QPS,0表示不限流 + type: integer + type: object + OpenConsumerInfoDTO: + example: + orgName: orgName + rateLimit: 6 + ownerName: ownerName + consumerId: 0 + appId: appId + name: name + allowCreateApplication: false + allowManageUsers: false + orgId: orgId + ownerEmail: ownerEmail + token: token + properties: + appId: + description: 第三方应用ID + type: string + name: + description: 第三方应用名称 + type: string + orgId: + description: 部门ID + type: string + orgName: + description: 部门名称 + type: string + ownerName: + description: 负责人用户名 + type: string + ownerEmail: + description: 负责人邮箱 + type: string + consumerId: + description: Consumer ID + format: int64 + type: integer + token: + description: Consumer Token,仅在创建或按应用查询详情时返回 + type: string + allowCreateApplication: + default: false + description: 是否允许该Consumer Token创建应用 + type: boolean + allowManageUsers: + default: false + description: 是否允许该Consumer Token管理用户 + type: boolean + rateLimit: + default: 0 + description: 限流QPS,0表示不限流 + type: integer + type: object OpenUserInfoDTO: example: name: name diff --git a/tests/test_user_management_contract.py b/tests/test_user_management_contract.py new file mode 100644 index 00000000..26e39769 --- /dev/null +++ b/tests/test_user_management_contract.py @@ -0,0 +1,105 @@ +import unittest +from pathlib import Path + +import yaml + + +SPEC_FILES = ( + "apollo-openapi.yaml", + "java-client/api/openapi.yaml", + "spring-boot2/src/main/resources/openapi.yaml", +) + + +class UserManagementContractTest(unittest.TestCase): + + def setUp(self): + self.repo_root = Path(__file__).resolve().parents[1] + + def _load_spec(self, spec_file): + return yaml.safe_load((self.repo_root / spec_file).read_text()) + + def test_user_management_tag_renamed_in_all_specs(self): + for spec_file in SPEC_FILES: + spec = self._load_spec(spec_file) + tag_names = {tag["name"] for tag in spec["tags"]} + + with self.subTest(spec=spec_file): + self.assertIn("User Management", tag_names) + self.assertNotIn("Portal User Management", tag_names) + + operations = ( + spec["paths"]["/openapi/v1/user"]["get"], + spec["paths"]["/openapi/v1/users"]["get"], + spec["paths"]["/openapi/v1/users"]["post"], + spec["paths"]["/openapi/v1/users/{userId}"]["get"], + spec["paths"]["/openapi/v1/users/enabled"]["put"], + ) + for operation in operations: + self.assertEqual(["User Management"], operation["tags"]) + + def test_user_management_operations_support_consumer_manage_users_contract(self): + for spec_file in SPEC_FILES: + spec = self._load_spec(spec_file) + + with self.subTest(spec=spec_file): + users_by_id = spec["paths"]["/openapi/v1/users/{userId}"]["get"] + self.assertEqual("getUserByUserId", users_by_id["operationId"]) + user_id_param = self._find_parameter(users_by_id, "userId") + self.assertEqual("path", user_id_param["in"]) + self.assertTrue(user_id_param["required"]) + self.assertEqual("string", user_id_param["schema"]["type"]) + self.assertEqual( + "#/components/schemas/OpenUserInfoDTO", + users_by_id["responses"]["200"]["content"]["application/json"]["schema"]["$ref"], + ) + + create_or_update = spec["paths"]["/openapi/v1/users"]["post"] + change_enabled = spec["paths"]["/openapi/v1/users/enabled"]["put"] + for operation in (create_or_update, change_enabled): + operator_param = self._find_parameter(operation, "operator") + self.assertEqual("query", operator_param["in"]) + self.assertFalse(operator_param.get("required", False)) + + def test_consumer_management_uses_typed_schemas_with_manage_users_flag(self): + for spec_file in SPEC_FILES: + spec = self._load_spec(spec_file) + schemas = spec["components"]["schemas"] + + with self.subTest(spec=spec_file): + create_consumer = spec["paths"]["/openapi/v1/consumers"]["post"] + self.assertEqual( + "#/components/schemas/OpenConsumerCreateRequestDTO", + create_consumer["requestBody"]["content"]["application/json"]["schema"]["$ref"], + ) + self.assertEqual( + "#/components/schemas/OpenConsumerInfoDTO", + create_consumer["responses"]["200"]["content"]["application/json"]["schema"]["$ref"], + ) + + list_consumers = spec["paths"]["/openapi/v1/consumers"]["get"] + self.assertEqual( + "#/components/schemas/OpenConsumerInfoDTO", + list_consumers["responses"]["200"]["content"]["application/json"]["schema"]["items"]["$ref"], + ) + + for schema_name in ("OpenConsumerCreateRequestDTO", "OpenConsumerInfoDTO"): + properties = schemas[schema_name]["properties"] + self.assertEqual("boolean", properties["allowCreateApplication"]["type"]) + self.assertEqual("boolean", properties["allowManageUsers"]["type"]) + + def test_spring_server_api_uses_user_management_name(self): + api_dir = self.repo_root / "spring-boot2/src/main/java/com/apollo/openapi/server/api" + + self.assertTrue((api_dir / "UserManagementApi.java").exists()) + self.assertFalse((api_dir / "PortalUserManagementApi.java").exists()) + + def _find_parameter(self, operation, name): + for parameter in operation.get("parameters", ()): + if parameter.get("name") == name: + return parameter + self.fail(f"Parameter {name} not found") + + +if __name__ == "__main__": + unittest.main() diff --git a/typescript/.openapi-generator/FILES b/typescript/.openapi-generator/FILES index 65394d27..d39bc0fc 100644 --- a/typescript/.openapi-generator/FILES +++ b/typescript/.openapi-generator/FILES @@ -16,8 +16,8 @@ src/apis/NamespaceManagementApi.ts src/apis/OrganizationManagementApi.ts src/apis/PermissionManagementApi.ts src/apis/PortalManagementApi.ts -src/apis/PortalUserManagementApi.ts src/apis/ReleaseManagementApi.ts +src/apis/UserManagementApi.ts src/apis/index.ts src/index.ts src/models/ExceptionResponse.ts @@ -29,6 +29,8 @@ src/models/OpenAppNamespaceDTO.ts src/models/OpenAppRoleUserDTO.ts src/models/OpenClusterDTO.ts src/models/OpenClusterNamespaceRoleUserDTO.ts +src/models/OpenConsumerCreateRequestDTO.ts +src/models/OpenConsumerInfoDTO.ts src/models/OpenCreateAppDTO.ts src/models/OpenCreateNamespaceDTO.ts src/models/OpenEnvClusterDTO.ts diff --git a/typescript/README.md b/typescript/README.md index c5fde17d..9920ded4 100644 --- a/typescript/README.md +++ b/typescript/README.md @@ -1,4 +1,4 @@ -## apollo-openapi@0.3.5 +## apollo-openapi@0.3.6 This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: @@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co _published:_ ``` -npm install apollo-openapi@0.3.5 --save +npm install apollo-openapi@0.3.6 --save ``` _unPublished (not recommended):_ diff --git a/typescript/package.json b/typescript/package.json index 4cc82f65..9e37e712 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -1,6 +1,6 @@ { "name": "apollo-openapi", - "version": "0.3.5", + "version": "0.3.6", "description": "OpenAPI client for apollo-openapi", "author": "OpenAPI-Generator", "repository": { diff --git a/typescript/src/apis/PortalManagementApi.ts b/typescript/src/apis/PortalManagementApi.ts index 3cfbf916..3c22f9e1 100644 --- a/typescript/src/apis/PortalManagementApi.ts +++ b/typescript/src/apis/PortalManagementApi.ts @@ -13,6 +13,16 @@ import * as runtime from '../runtime'; +import type { + OpenConsumerCreateRequestDTO, + OpenConsumerInfoDTO, +} from '../models'; +import { + OpenConsumerCreateRequestDTOFromJSON, + OpenConsumerCreateRequestDTOToJSON, + OpenConsumerInfoDTOFromJSON, + OpenConsumerInfoDTOToJSON, +} from '../models'; export interface AddFavoriteRequest { body: object; @@ -36,7 +46,7 @@ export interface CheckSystemHealthRequest { } export interface CreateConsumerRequest { - body: object; + openConsumerCreateRequestDTO: OpenConsumerCreateRequestDTO; expires?: string; } @@ -383,9 +393,9 @@ export class PortalManagementApi extends runtime.BaseAPI { * POST /openapi/v1/consumers * 创建开放平台消费者(new added) */ - async createConsumerRaw(requestParameters: CreateConsumerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createConsumer.'); + async createConsumerRaw(requestParameters: CreateConsumerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.openConsumerCreateRequestDTO === null || requestParameters.openConsumerCreateRequestDTO === undefined) { + throw new runtime.RequiredError('openConsumerCreateRequestDTO','Required parameter requestParameters.openConsumerCreateRequestDTO was null or undefined when calling createConsumer.'); } const queryParameters: any = {}; @@ -407,17 +417,17 @@ export class PortalManagementApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: OpenConsumerCreateRequestDTOToJSON(requestParameters.openConsumerCreateRequestDTO), }, initOverrides); - return new runtime.JSONApiResponse(response); + return new runtime.JSONApiResponse(response, (jsonValue) => OpenConsumerInfoDTOFromJSON(jsonValue)); } /** * POST /openapi/v1/consumers * 创建开放平台消费者(new added) */ - async createConsumer(requestParameters: CreateConsumerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async createConsumer(requestParameters: CreateConsumerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createConsumerRaw(requestParameters, initOverrides); return await response.value(); } @@ -1268,7 +1278,7 @@ export class PortalManagementApi extends runtime.BaseAPI { * GET /openapi/v1/consumers * 查询开放平台消费者列表(new added) */ - async getConsumerListRaw(requestParameters: GetConsumerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async getConsumerListRaw(requestParameters: GetConsumerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { const queryParameters: any = {}; if (requestParameters.page !== undefined) { @@ -1292,14 +1302,14 @@ export class PortalManagementApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response); + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(OpenConsumerInfoDTOFromJSON)); } /** * GET /openapi/v1/consumers * 查询开放平台消费者列表(new added) */ - async getConsumerList(requestParameters: GetConsumerListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getConsumerList(requestParameters: GetConsumerListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getConsumerListRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/typescript/src/apis/PortalUserManagementApi.ts b/typescript/src/apis/UserManagementApi.ts similarity index 69% rename from typescript/src/apis/PortalUserManagementApi.ts rename to typescript/src/apis/UserManagementApi.ts index a6d922a8..58113538 100644 --- a/typescript/src/apis/PortalUserManagementApi.ts +++ b/typescript/src/apis/UserManagementApi.ts @@ -29,11 +29,17 @@ import { export interface ChangeUserEnabledRequest { openUserDTO: OpenUserDTO; + operator?: string; } export interface CreateOrUpdateUserRequest { openUserDTO: OpenUserDTO; isCreate?: boolean; + operator?: string; +} + +export interface GetUserByUserIdRequest { + userId: string; } export interface SearchUsersRequest { @@ -46,11 +52,11 @@ export interface SearchUsersRequest { /** * */ -export class PortalUserManagementApi extends runtime.BaseAPI { +export class UserManagementApi extends runtime.BaseAPI { /** - * PUT /openapi/v1/users/enabled - * 修改Portal用户启用状态(new added) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator + * 修改用户启用状态(new added) */ async changeUserEnabledRaw(requestParameters: ChangeUserEnabledRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.openUserDTO === null || requestParameters.openUserDTO === undefined) { @@ -59,6 +65,10 @@ export class PortalUserManagementApi extends runtime.BaseAPI { const queryParameters: any = {}; + if (requestParameters.operator !== undefined) { + queryParameters['operator'] = requestParameters.operator; + } + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; @@ -79,16 +89,16 @@ export class PortalUserManagementApi extends runtime.BaseAPI { } /** - * PUT /openapi/v1/users/enabled - * 修改Portal用户启用状态(new added) + * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator + * 修改用户启用状态(new added) */ async changeUserEnabled(requestParameters: ChangeUserEnabledRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.changeUserEnabledRaw(requestParameters, initOverrides); } /** - * POST /openapi/v1/users - * 创建或更新Portal用户(new added) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator + * 创建或更新用户(new added) */ async createOrUpdateUserRaw(requestParameters: CreateOrUpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.openUserDTO === null || requestParameters.openUserDTO === undefined) { @@ -101,6 +111,10 @@ export class PortalUserManagementApi extends runtime.BaseAPI { queryParameters['isCreate'] = requestParameters.isCreate; } + if (requestParameters.operator !== undefined) { + queryParameters['operator'] = requestParameters.operator; + } + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; @@ -121,8 +135,8 @@ export class PortalUserManagementApi extends runtime.BaseAPI { } /** - * POST /openapi/v1/users - * 创建或更新Portal用户(new added) + * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator + * 创建或更新用户(new added) */ async createOrUpdateUser(requestParameters: CreateOrUpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.createOrUpdateUserRaw(requestParameters, initOverrides); @@ -161,8 +175,44 @@ export class PortalUserManagementApi extends runtime.BaseAPI { } /** - * GET /openapi/v1/users - * 搜索Portal用户(new added) + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * 获取指定用户(new added) + */ + async getUserByUserIdRaw(requestParameters: GetUserByUserIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.userId === null || requestParameters.userId === undefined) { + throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getUserByUserId.'); + } + + 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/users/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => OpenUserInfoDTOFromJSON(jsonValue)); + } + + /** + * GET /openapi/v1/users/{userId},支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * 获取指定用户(new added) + */ + async getUserByUserId(requestParameters: GetUserByUserIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getUserByUserIdRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * 搜索用户(new added) */ async searchUsersRaw(requestParameters: SearchUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters.keyword === null || requestParameters.keyword === undefined) { @@ -204,8 +254,8 @@ export class PortalUserManagementApi extends runtime.BaseAPI { } /** - * GET /openapi/v1/users - * 搜索Portal用户(new added) + * GET /openapi/v1/users,支持Portal用户登录态或具备ManageUsers权限的Consumer Token访问 + * 搜索用户(new added) */ async searchUsers(requestParameters: SearchUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.searchUsersRaw(requestParameters, initOverrides); diff --git a/typescript/src/apis/index.ts b/typescript/src/apis/index.ts index 4df67ca9..89df5955 100644 --- a/typescript/src/apis/index.ts +++ b/typescript/src/apis/index.ts @@ -13,5 +13,5 @@ export * from './NamespaceManagementApi'; export * from './OrganizationManagementApi'; export * from './PermissionManagementApi'; export * from './PortalManagementApi'; -export * from './PortalUserManagementApi'; export * from './ReleaseManagementApi'; +export * from './UserManagementApi'; diff --git a/typescript/src/models/OpenConsumerCreateRequestDTO.ts b/typescript/src/models/OpenConsumerCreateRequestDTO.ts new file mode 100644 index 00000000..2f961a41 --- /dev/null +++ b/typescript/src/models/OpenConsumerCreateRequestDTO.ts @@ -0,0 +1,127 @@ +/* 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\"
+ * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface OpenConsumerCreateRequestDTO + */ +export interface OpenConsumerCreateRequestDTO { + /** + * 第三方应用ID + * @type {string} + * @memberof OpenConsumerCreateRequestDTO + */ + appId?: string; + /** + * 是否允许该Consumer Token创建应用 + * @type {boolean} + * @memberof OpenConsumerCreateRequestDTO + */ + allowCreateApplication?: boolean; + /** + * 是否允许该Consumer Token管理用户 + * @type {boolean} + * @memberof OpenConsumerCreateRequestDTO + */ + allowManageUsers?: boolean; + /** + * 第三方应用名称 + * @type {string} + * @memberof OpenConsumerCreateRequestDTO + */ + name?: string; + /** + * 部门ID + * @type {string} + * @memberof OpenConsumerCreateRequestDTO + */ + orgId?: string; + /** + * 部门名称 + * @type {string} + * @memberof OpenConsumerCreateRequestDTO + */ + orgName?: string; + /** + * 负责人用户名 + * @type {string} + * @memberof OpenConsumerCreateRequestDTO + */ + ownerName?: string; + /** + * 是否开启限流 + * @type {boolean} + * @memberof OpenConsumerCreateRequestDTO + */ + rateLimitEnabled?: boolean; + /** + * 限流QPS,0表示不限流 + * @type {number} + * @memberof OpenConsumerCreateRequestDTO + */ + rateLimit?: number; +} + +/** + * Check if a given object implements the OpenConsumerCreateRequestDTO interface. + */ +export function instanceOfOpenConsumerCreateRequestDTO(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function OpenConsumerCreateRequestDTOFromJSON(json: any): OpenConsumerCreateRequestDTO { + return OpenConsumerCreateRequestDTOFromJSONTyped(json, false); +} + +export function OpenConsumerCreateRequestDTOFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenConsumerCreateRequestDTO { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'appId': !exists(json, 'appId') ? undefined : json['appId'], + 'allowCreateApplication': !exists(json, 'allowCreateApplication') ? undefined : json['allowCreateApplication'], + 'allowManageUsers': !exists(json, 'allowManageUsers') ? undefined : json['allowManageUsers'], + 'name': !exists(json, 'name') ? undefined : json['name'], + 'orgId': !exists(json, 'orgId') ? undefined : json['orgId'], + 'orgName': !exists(json, 'orgName') ? undefined : json['orgName'], + 'ownerName': !exists(json, 'ownerName') ? undefined : json['ownerName'], + 'rateLimitEnabled': !exists(json, 'rateLimitEnabled') ? undefined : json['rateLimitEnabled'], + 'rateLimit': !exists(json, 'rateLimit') ? undefined : json['rateLimit'], + }; +} + +export function OpenConsumerCreateRequestDTOToJSON(value?: OpenConsumerCreateRequestDTO | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'appId': value.appId, + 'allowCreateApplication': value.allowCreateApplication, + 'allowManageUsers': value.allowManageUsers, + 'name': value.name, + 'orgId': value.orgId, + 'orgName': value.orgName, + 'ownerName': value.ownerName, + 'rateLimitEnabled': value.rateLimitEnabled, + 'rateLimit': value.rateLimit, + }; +} diff --git a/typescript/src/models/OpenConsumerInfoDTO.ts b/typescript/src/models/OpenConsumerInfoDTO.ts new file mode 100644 index 00000000..30f04bc3 --- /dev/null +++ b/typescript/src/models/OpenConsumerInfoDTO.ts @@ -0,0 +1,143 @@ +/* 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\"
+ * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface OpenConsumerInfoDTO + */ +export interface OpenConsumerInfoDTO { + /** + * 第三方应用ID + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + appId?: string; + /** + * 第三方应用名称 + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + name?: string; + /** + * 部门ID + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + orgId?: string; + /** + * 部门名称 + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + orgName?: string; + /** + * 负责人用户名 + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + ownerName?: string; + /** + * 负责人邮箱 + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + ownerEmail?: string; + /** + * Consumer ID + * @type {number} + * @memberof OpenConsumerInfoDTO + */ + consumerId?: number; + /** + * Consumer Token,仅在创建或按应用查询详情时返回 + * @type {string} + * @memberof OpenConsumerInfoDTO + */ + token?: string; + /** + * 是否允许该Consumer Token创建应用 + * @type {boolean} + * @memberof OpenConsumerInfoDTO + */ + allowCreateApplication?: boolean; + /** + * 是否允许该Consumer Token管理用户 + * @type {boolean} + * @memberof OpenConsumerInfoDTO + */ + allowManageUsers?: boolean; + /** + * 限流QPS,0表示不限流 + * @type {number} + * @memberof OpenConsumerInfoDTO + */ + rateLimit?: number; +} + +/** + * Check if a given object implements the OpenConsumerInfoDTO interface. + */ +export function instanceOfOpenConsumerInfoDTO(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function OpenConsumerInfoDTOFromJSON(json: any): OpenConsumerInfoDTO { + return OpenConsumerInfoDTOFromJSONTyped(json, false); +} + +export function OpenConsumerInfoDTOFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenConsumerInfoDTO { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'appId': !exists(json, 'appId') ? undefined : json['appId'], + 'name': !exists(json, 'name') ? undefined : json['name'], + 'orgId': !exists(json, 'orgId') ? undefined : json['orgId'], + 'orgName': !exists(json, 'orgName') ? undefined : json['orgName'], + 'ownerName': !exists(json, 'ownerName') ? undefined : json['ownerName'], + 'ownerEmail': !exists(json, 'ownerEmail') ? undefined : json['ownerEmail'], + 'consumerId': !exists(json, 'consumerId') ? undefined : json['consumerId'], + 'token': !exists(json, 'token') ? undefined : json['token'], + 'allowCreateApplication': !exists(json, 'allowCreateApplication') ? undefined : json['allowCreateApplication'], + 'allowManageUsers': !exists(json, 'allowManageUsers') ? undefined : json['allowManageUsers'], + 'rateLimit': !exists(json, 'rateLimit') ? undefined : json['rateLimit'], + }; +} + +export function OpenConsumerInfoDTOToJSON(value?: OpenConsumerInfoDTO | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'appId': value.appId, + 'name': value.name, + 'orgId': value.orgId, + 'orgName': value.orgName, + 'ownerName': value.ownerName, + 'ownerEmail': value.ownerEmail, + 'consumerId': value.consumerId, + 'token': value.token, + 'allowCreateApplication': value.allowCreateApplication, + 'allowManageUsers': value.allowManageUsers, + 'rateLimit': value.rateLimit, + }; +} diff --git a/typescript/src/models/index.ts b/typescript/src/models/index.ts index 7eafcc5c..9d440ed3 100644 --- a/typescript/src/models/index.ts +++ b/typescript/src/models/index.ts @@ -9,6 +9,8 @@ export * from './OpenAppNamespaceDTO'; export * from './OpenAppRoleUserDTO'; export * from './OpenClusterDTO'; export * from './OpenClusterNamespaceRoleUserDTO'; +export * from './OpenConsumerCreateRequestDTO'; +export * from './OpenConsumerInfoDTO'; export * from './OpenCreateAppDTO'; export * from './OpenCreateNamespaceDTO'; export * from './OpenEnvClusterDTO'; From 3723567ac911275e810bb6599083929e57d8c8d9 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sat, 6 Jun 2026 12:45:37 +0800 Subject: [PATCH 2/4] test: specify utf-8 for contract spec reads --- tests/test_user_management_contract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_user_management_contract.py b/tests/test_user_management_contract.py index 26e39769..56e777ca 100644 --- a/tests/test_user_management_contract.py +++ b/tests/test_user_management_contract.py @@ -17,7 +17,7 @@ def setUp(self): self.repo_root = Path(__file__).resolve().parents[1] def _load_spec(self, spec_file): - return yaml.safe_load((self.repo_root / spec_file).read_text()) + return yaml.safe_load((self.repo_root / spec_file).read_text(encoding="utf-8")) def test_user_management_tag_renamed_in_all_specs(self): for spec_file in SPEC_FILES: From 955e0c17038650907a905387b9b6ce62ed81d9f3 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sat, 6 Jun 2026 12:57:41 +0800 Subject: [PATCH 3/4] fix: refine consumer management contract --- CHANGELOG.md | 2 +- apollo-openapi.yaml | 6 +- java-client/api/openapi.yaml | 7 +- java-client/docs/OpenConsumerInfoDTO.md | 1 + java-client/docs/PortalManagementApi.md | 6 +- .../client/api/PortalManagementApi.java | 16 ++--- .../client/api/UserManagementApi.java | 65 +++++++++++++++++++ .../client/model/OpenConsumerInfoDTO.java | 32 ++++++++- .../client/api/PortalManagementApiTest.java | 2 +- .../client/api/UserManagementApiTest.java | 2 + .../client/model/OpenConsumerInfoDTOTest.java | 8 +++ .../model/open_consumer_info_dto.py | 14 +++- .../model/open_consumer_info_dto.pyi | 14 +++- .../get.py | 4 +- .../get.pyi | 4 +- python/docs/apis/tags/PortalManagementApi.md | 10 +-- python/docs/models/OpenConsumerInfoDTO.md | 1 + rust/docs/OpenConsumerInfoDto.md | 1 + rust/src/models/open_consumer_info_dto.rs | 4 ++ .../server/api/PortalManagementApi.java | 4 +- .../api/PortalManagementApiDelegate.java | 15 ++++- .../server/model/OpenConsumerInfoDTO.java | 28 +++++++- spring-boot2/src/main/resources/openapi.yaml | 7 +- tests/test_user_management_contract.py | 18 +++++ typescript/src/apis/PortalManagementApi.ts | 6 +- typescript/src/models/OpenConsumerInfoDTO.ts | 8 +++ 26 files changed, 246 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a955462c..f475c41c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add Consumer Token support notes to user management contracts, including `ManageUsers`-guarded user lookup and mutation operations. -- Add typed consumer management request and response schemas with the `allowManageUsers` flag. +- Add typed consumer management request and response schemas with `allowManageUsers` and `rateLimitEnabled` flags. ## [0.3.5] - 2026-05-31 diff --git a/apollo-openapi.yaml b/apollo-openapi.yaml index 9f95bd76..207289a5 100644 --- a/apollo-openapi.yaml +++ b/apollo-openapi.yaml @@ -5400,7 +5400,7 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' /openapi/v1/consumers/{token}/assign-role: post: summary: 给消费者授权(new added) @@ -6898,6 +6898,10 @@ components: type: integer description: 限流QPS,0表示不限流 default: 0 + rateLimitEnabled: + type: boolean + description: 是否开启限流 + default: false OpenUserInfoDTO: type: object properties: diff --git a/java-client/api/openapi.yaml b/java-client/api/openapi.yaml index 6f1ca891..93e77a16 100644 --- a/java-client/api/openapi.yaml +++ b/java-client/api/openapi.yaml @@ -6227,7 +6227,7 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' description: 成功获取消费者Token summary: 按应用ID查询消费者Token(new added) tags: @@ -8439,6 +8439,7 @@ components: name: name allowCreateApplication: false allowManageUsers: false + rateLimitEnabled: false orgId: orgId ownerEmail: ownerEmail token: token @@ -8480,6 +8481,10 @@ components: default: 0 description: 限流QPS,0表示不限流 type: integer + rateLimitEnabled: + default: false + description: 是否开启限流 + type: boolean type: object OpenUserInfoDTO: example: diff --git a/java-client/docs/OpenConsumerInfoDTO.md b/java-client/docs/OpenConsumerInfoDTO.md index 9a90b3bd..1ece029a 100644 --- a/java-client/docs/OpenConsumerInfoDTO.md +++ b/java-client/docs/OpenConsumerInfoDTO.md @@ -18,3 +18,4 @@ |**allowCreateApplication** | **Boolean** | 是否允许该Consumer Token创建应用 | [optional] | |**allowManageUsers** | **Boolean** | 是否允许该Consumer Token管理用户 | [optional] | |**rateLimit** | **Integer** | 限流QPS,0表示不限流 | [optional] | +|**rateLimitEnabled** | **Boolean** | 是否开启限流 | [optional] | diff --git a/java-client/docs/PortalManagementApi.md b/java-client/docs/PortalManagementApi.md index 3d6f4bcb..83c7023b 100644 --- a/java-client/docs/PortalManagementApi.md +++ b/java-client/docs/PortalManagementApi.md @@ -1832,7 +1832,7 @@ public class Example { # **getConsumerTokenByAppId** -> Object getConsumerTokenByAppId(appId) +> OpenConsumerInfoDTO getConsumerTokenByAppId(appId) 按应用ID查询消费者Token(new added) @@ -1862,7 +1862,7 @@ public class Example { PortalManagementApi apiInstance = new PortalManagementApi(defaultClient); String appId = "appId_example"; // String | try { - Object result = apiInstance.getConsumerTokenByAppId(appId); + OpenConsumerInfoDTO result = apiInstance.getConsumerTokenByAppId(appId); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PortalManagementApi#getConsumerTokenByAppId"); @@ -1883,7 +1883,7 @@ public class Example { ### Return type -**Object** +[**OpenConsumerInfoDTO**](OpenConsumerInfoDTO.md) ### Authorization diff --git a/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java index aef98e90..75a182bf 100644 --- a/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java @@ -3553,7 +3553,7 @@ private okhttp3.Call getConsumerTokenByAppIdValidateBeforeCall(String appId, fin * 按应用ID查询消费者Token(new added) * GET /openapi/v1/consumer-tokens/by-appId * @param appId (required) - * @return Object + * @return OpenConsumerInfoDTO * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3561,8 +3561,8 @@ private okhttp3.Call getConsumerTokenByAppIdValidateBeforeCall(String appId, fin
200 成功获取消费者Token -
*/ - public Object getConsumerTokenByAppId(String appId) throws ApiException { - ApiResponse localVarResp = getConsumerTokenByAppIdWithHttpInfo(appId); + public OpenConsumerInfoDTO getConsumerTokenByAppId(String appId) throws ApiException { + ApiResponse localVarResp = getConsumerTokenByAppIdWithHttpInfo(appId); return localVarResp.getData(); } @@ -3570,7 +3570,7 @@ public Object getConsumerTokenByAppId(String appId) throws ApiException { * 按应用ID查询消费者Token(new added) * GET /openapi/v1/consumer-tokens/by-appId * @param appId (required) - * @return ApiResponse<Object> + * @return ApiResponse<OpenConsumerInfoDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3578,9 +3578,9 @@ public Object getConsumerTokenByAppId(String appId) throws ApiException {
200 成功获取消费者Token -
*/ - public ApiResponse getConsumerTokenByAppIdWithHttpInfo(String appId) throws ApiException { + public ApiResponse getConsumerTokenByAppIdWithHttpInfo(String appId) throws ApiException { okhttp3.Call localVarCall = getConsumerTokenByAppIdValidateBeforeCall(appId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -3597,10 +3597,10 @@ public ApiResponse getConsumerTokenByAppIdWithHttpInfo(String appId) thr 200 成功获取消费者Token - */ - public okhttp3.Call getConsumerTokenByAppIdAsync(String appId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getConsumerTokenByAppIdAsync(String appId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getConsumerTokenByAppIdValidateBeforeCall(appId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java index 0237d861..cedc0795 100644 --- a/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java @@ -138,6 +138,14 @@ public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, String operat return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + /** + * Build call for changeUserEnabled. + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, final ApiCallback _callback) throws ApiException { + return changeUserEnabledCall(openUserDTO, null, _callback); + } + @SuppressWarnings("rawtypes") private okhttp3.Call changeUserEnabledValidateBeforeCall(OpenUserDTO openUserDTO, String operator, final ApiCallback _callback) throws ApiException { // verify the required parameter 'openUserDTO' is set @@ -167,6 +175,14 @@ public void changeUserEnabled(OpenUserDTO openUserDTO, String operator) throws A changeUserEnabledWithHttpInfo(openUserDTO, operator); } + /** + * 修改用户启用状态(new added) + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public void changeUserEnabled(OpenUserDTO openUserDTO) throws ApiException { + changeUserEnabled(openUserDTO, null); + } + /** * 修改用户启用状态(new added) * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator @@ -187,6 +203,14 @@ public ApiResponse changeUserEnabledWithHttpInfo(OpenUserDTO openUserDTO, return localVarApiClient.execute(localVarCall); } + /** + * 修改用户启用状态(new added) + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public ApiResponse changeUserEnabledWithHttpInfo(OpenUserDTO openUserDTO) throws ApiException { + return changeUserEnabledWithHttpInfo(openUserDTO, null); + } + /** * 修改用户启用状态(new added) (asynchronously) * PUT /openapi/v1/users/enabled,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator @@ -209,6 +233,15 @@ public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, String opera localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } + + /** + * 修改用户启用状态(new added) (asynchronously) + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, final ApiCallback _callback) throws ApiException { + return changeUserEnabledAsync(openUserDTO, null, _callback); + } + /** * Build call for createOrUpdateUser * @param openUserDTO (required) @@ -278,6 +311,14 @@ public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCr return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + /** + * Build call for createOrUpdateUser. + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback _callback) throws ApiException { + return createOrUpdateUserCall(openUserDTO, isCreate, null, _callback); + } + @SuppressWarnings("rawtypes") private okhttp3.Call createOrUpdateUserValidateBeforeCall(OpenUserDTO openUserDTO, Boolean isCreate, String operator, final ApiCallback _callback) throws ApiException { // verify the required parameter 'openUserDTO' is set @@ -308,6 +349,14 @@ public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate, String createOrUpdateUserWithHttpInfo(openUserDTO, isCreate, operator); } + /** + * 创建或更新用户(new added) + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException { + createOrUpdateUser(openUserDTO, isCreate, null); + } + /** * 创建或更新用户(new added) * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator @@ -329,6 +378,14 @@ public ApiResponse createOrUpdateUserWithHttpInfo(OpenUserDTO openUserDTO, return localVarApiClient.execute(localVarCall); } + /** + * 创建或更新用户(new added) + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public ApiResponse createOrUpdateUserWithHttpInfo(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException { + return createOrUpdateUserWithHttpInfo(openUserDTO, isCreate, null); + } + /** * 创建或更新用户(new added) (asynchronously) * POST /openapi/v1/users,Portal用户登录态使用当前登录用户作为operator;Consumer Token访问时需要具备ManageUsers权限并传入有效operator @@ -352,6 +409,14 @@ public okhttp3.Call createOrUpdateUserAsync(OpenUserDTO openUserDTO, Boolean isC localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } + + /** + * 创建或更新用户(new added) (asynchronously) + * This overload preserves the Java client API for callers that do not need the optional operator query parameter. + */ + public okhttp3.Call createOrUpdateUserAsync(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback _callback) throws ApiException { + return createOrUpdateUserAsync(openUserDTO, isCreate, null, _callback); + } /** * Build call for getCurrentUser * @param _callback Callback for upload/download progress diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java index e70f53c2..e0e9e7e6 100644 --- a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java +++ b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java @@ -95,6 +95,10 @@ public class OpenConsumerInfoDTO { @SerializedName(SERIALIZED_NAME_RATE_LIMIT) private Integer rateLimit = 0; + public static final String SERIALIZED_NAME_RATE_LIMIT_ENABLED = "rateLimitEnabled"; + @SerializedName(SERIALIZED_NAME_RATE_LIMIT_ENABLED) + private Boolean rateLimitEnabled = false; + public OpenConsumerInfoDTO() { } @@ -329,6 +333,27 @@ public void setRateLimit(Integer rateLimit) { } + public OpenConsumerInfoDTO rateLimitEnabled(Boolean rateLimitEnabled) { + + this.rateLimitEnabled = rateLimitEnabled; + return this; + } + + /** + * 是否开启限流 + * @return rateLimitEnabled + **/ + @javax.annotation.Nullable + public Boolean getRateLimitEnabled() { + return rateLimitEnabled; + } + + + public void setRateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + } + + @Override public boolean equals(Object o) { @@ -349,12 +374,13 @@ public boolean equals(Object o) { Objects.equals(this.token, openConsumerInfoDTO.token) && Objects.equals(this.allowCreateApplication, openConsumerInfoDTO.allowCreateApplication) && Objects.equals(this.allowManageUsers, openConsumerInfoDTO.allowManageUsers) && - Objects.equals(this.rateLimit, openConsumerInfoDTO.rateLimit); + Objects.equals(this.rateLimit, openConsumerInfoDTO.rateLimit) && + Objects.equals(this.rateLimitEnabled, openConsumerInfoDTO.rateLimitEnabled); } @Override public int hashCode() { - return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, token, allowCreateApplication, allowManageUsers, rateLimit); + return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, token, allowCreateApplication, allowManageUsers, rateLimit, rateLimitEnabled); } @Override @@ -372,6 +398,7 @@ public String toString() { sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append(" rateLimitEnabled: ").append(toIndentedString(rateLimitEnabled)).append("\n"); sb.append("}"); return sb.toString(); } @@ -405,6 +432,7 @@ private String toIndentedString(Object o) { openapiFields.add("allowCreateApplication"); openapiFields.add("allowManageUsers"); openapiFields.add("rateLimit"); + openapiFields.add("rateLimitEnabled"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); diff --git a/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java index 57ae5706..077790fb 100644 --- a/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java @@ -428,7 +428,7 @@ public void getConsumerListTest() throws ApiException { @Test public void getConsumerTokenByAppIdTest() throws ApiException { String appId = null; - Object response = api.getConsumerTokenByAppId(appId); + OpenConsumerInfoDTO response = api.getConsumerTokenByAppId(appId); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java index 8b2c15b1..ecc24cfe 100644 --- a/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java @@ -43,6 +43,7 @@ public class UserManagementApiTest { public void changeUserEnabledTest() throws ApiException { OpenUserDTO openUserDTO = null; String operator = null; + api.changeUserEnabled(openUserDTO); api.changeUserEnabled(openUserDTO, operator); // TODO: test validations } @@ -59,6 +60,7 @@ public void createOrUpdateUserTest() throws ApiException { OpenUserDTO openUserDTO = null; Boolean isCreate = null; String operator = null; + api.createOrUpdateUser(openUserDTO, isCreate); api.createOrUpdateUser(openUserDTO, isCreate, operator); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java index 37b3dfed..4bf9d7ea 100644 --- a/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java +++ b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java @@ -124,4 +124,12 @@ public void rateLimitTest() { // TODO: test rateLimit } + /** + * Test the property 'rateLimitEnabled' + */ + @Test + public void rateLimitEnabledTest() { + // TODO: test rateLimitEnabled + } + } diff --git a/python/apollo_openapi/model/open_consumer_info_dto.py b/python/apollo_openapi/model/open_consumer_info_dto.py index a0fd4450..b0cfefd5 100644 --- a/python/apollo_openapi/model/open_consumer_info_dto.py +++ b/python/apollo_openapi/model/open_consumer_info_dto.py @@ -46,6 +46,7 @@ class properties: allowCreateApplication = schemas.BoolSchema allowManageUsers = schemas.BoolSchema rateLimit = schemas.IntSchema + rateLimitEnabled = schemas.BoolSchema __annotations__ = { "appId": appId, "name": name, @@ -58,6 +59,7 @@ class properties: "allowCreateApplication": allowCreateApplication, "allowManageUsers": allowManageUsers, "rateLimit": rateLimit, + "rateLimitEnabled": rateLimitEnabled, } @typing.overload @@ -93,10 +95,13 @@ def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> Me @typing.overload def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> MetaOapg.properties.rateLimitEnabled: ... + @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -134,10 +139,13 @@ def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, schemas.Unset]: ... + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> typing.Union[MetaOapg.properties.rateLimitEnabled, 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["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): return super().get_item_oapg(name) @@ -155,6 +163,7 @@ def __new__( allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, schemas.Unset] = schemas.unset, + rateLimitEnabled: typing.Union[MetaOapg.properties.rateLimitEnabled, bool, 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], ) -> 'OpenConsumerInfoDTO': @@ -172,6 +181,7 @@ def __new__( allowCreateApplication=allowCreateApplication, allowManageUsers=allowManageUsers, rateLimit=rateLimit, + rateLimitEnabled=rateLimitEnabled, _configuration=_configuration, **kwargs, ) diff --git a/python/apollo_openapi/model/open_consumer_info_dto.pyi b/python/apollo_openapi/model/open_consumer_info_dto.pyi index a0fd4450..b0cfefd5 100644 --- a/python/apollo_openapi/model/open_consumer_info_dto.pyi +++ b/python/apollo_openapi/model/open_consumer_info_dto.pyi @@ -46,6 +46,7 @@ class OpenConsumerInfoDTO( allowCreateApplication = schemas.BoolSchema allowManageUsers = schemas.BoolSchema rateLimit = schemas.IntSchema + rateLimitEnabled = schemas.BoolSchema __annotations__ = { "appId": appId, "name": name, @@ -58,6 +59,7 @@ class OpenConsumerInfoDTO( "allowCreateApplication": allowCreateApplication, "allowManageUsers": allowManageUsers, "rateLimit": rateLimit, + "rateLimitEnabled": rateLimitEnabled, } @typing.overload @@ -93,10 +95,13 @@ class OpenConsumerInfoDTO( @typing.overload def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> MetaOapg.properties.rateLimitEnabled: ... + @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -134,10 +139,13 @@ class OpenConsumerInfoDTO( @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, schemas.Unset]: ... + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> typing.Union[MetaOapg.properties.rateLimitEnabled, 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["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "token", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): return super().get_item_oapg(name) @@ -155,6 +163,7 @@ class OpenConsumerInfoDTO( allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, schemas.Unset] = schemas.unset, + rateLimitEnabled: typing.Union[MetaOapg.properties.rateLimitEnabled, bool, 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], ) -> 'OpenConsumerInfoDTO': @@ -172,6 +181,7 @@ class OpenConsumerInfoDTO( allowCreateApplication=allowCreateApplication, allowManageUsers=allowManageUsers, rateLimit=rateLimit, + rateLimitEnabled=rateLimitEnabled, _configuration=_configuration, **kwargs, ) diff --git a/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.py b/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.py index e686fef7..9e70bf8d 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.py +++ b/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.py @@ -25,6 +25,8 @@ from apollo_openapi import schemas # noqa: F401 +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO + from . import path # Query params @@ -57,7 +59,7 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) _auth = [ 'ApiKeyAuth', ] -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema +SchemaFor200ResponseBodyApplicationJson = OpenConsumerInfoDTO @dataclass diff --git a/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.pyi b/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.pyi index 0d65bd82..087cf92f 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.pyi +++ b/python/apollo_openapi/paths/openapi_v1_consumer_tokens_by_app_id/get.pyi @@ -25,6 +25,8 @@ import frozendict # noqa: F401 from apollo_openapi import schemas # noqa: F401 +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO + # Query params AppIdSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -52,7 +54,7 @@ request_query_app_id = api_client.QueryParameter( required=True, explode=True, ) -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema +SchemaFor200ResponseBodyApplicationJson = OpenConsumerInfoDTO @dataclass diff --git a/python/docs/apis/tags/PortalManagementApi.md b/python/docs/apis/tags/PortalManagementApi.md index 8a6dc652..00cd908c 100644 --- a/python/docs/apis/tags/PortalManagementApi.md +++ b/python/docs/apis/tags/PortalManagementApi.md @@ -3091,7 +3091,7 @@ Class Name | Input Type | Accessed Type | Description | Notes # **get_consumer_token_by_app_id** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} get_consumer_token_by_app_id(app_id) +> OpenConsumerInfoDTO get_consumer_token_by_app_id(app_id) 按应用ID查询消费者Token(new added) @@ -3103,6 +3103,7 @@ GET /openapi/v1/consumer-tokens/by-appId ```python import apollo_openapi from apollo_openapi.apis.tags import portal_management_api +from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO 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. @@ -3178,11 +3179,10 @@ body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | headers | Unset | headers were not defined | # SchemaFor200ResponseBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**OpenConsumerInfoDTO**](../../models/OpenConsumerInfoDTO.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Authorization diff --git a/python/docs/models/OpenConsumerInfoDTO.md b/python/docs/models/OpenConsumerInfoDTO.md index 32096fe2..8595323d 100644 --- a/python/docs/models/OpenConsumerInfoDTO.md +++ b/python/docs/models/OpenConsumerInfoDTO.md @@ -19,6 +19,7 @@ Key | Input Type | Accessed Type | Description | Notes **allowCreateApplication** | bool, | BoolClass, | 是否允许该Consumer Token创建应用 | [optional] if omitted the server will use the default value of False **allowManageUsers** | bool, | BoolClass, | 是否允许该Consumer Token管理用户 | [optional] if omitted the server will use the default value of False **rateLimit** | decimal.Decimal, int, | decimal.Decimal, | 限流QPS,0表示不限流 | [optional] if omitted the server will use the default value of 0 +**rateLimitEnabled** | bool, | BoolClass, | 是否开启限流 | [optional] if omitted the server will use the default value of False **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/rust/docs/OpenConsumerInfoDto.md b/rust/docs/OpenConsumerInfoDto.md index 223842c2..b995a1e8 100644 --- a/rust/docs/OpenConsumerInfoDto.md +++ b/rust/docs/OpenConsumerInfoDto.md @@ -15,5 +15,6 @@ Name | Type | Description | Notes **allow_create_application** | Option<**bool**> | 是否允许该Consumer Token创建应用 | [optional][default to false] **allow_manage_users** | Option<**bool**> | 是否允许该Consumer Token管理用户 | [optional][default to false] **rate_limit** | Option<**i32**> | 限流QPS,0表示不限流 | [optional][default to 0] +**rate_limit_enabled** | Option<**bool**> | 是否开启限流 | [optional][default to false] [[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_consumer_info_dto.rs b/rust/src/models/open_consumer_info_dto.rs index faefacb2..63d48d5a 100644 --- a/rust/src/models/open_consumer_info_dto.rs +++ b/rust/src/models/open_consumer_info_dto.rs @@ -45,6 +45,9 @@ pub struct OpenConsumerInfoDto { /// 限流QPS,0表示不限流 #[serde(rename = "rateLimit", skip_serializing_if = "Option::is_none")] pub rate_limit: Option, + /// 是否开启限流 + #[serde(rename = "rateLimitEnabled", skip_serializing_if = "Option::is_none")] + pub rate_limit_enabled: Option, } impl OpenConsumerInfoDto { @@ -61,6 +64,7 @@ impl OpenConsumerInfoDto { allow_create_application: None, allow_manage_users: None, rate_limit: None, + rate_limit_enabled: None, } } } diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java index 0ba9df0e..9d057a84 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java @@ -941,7 +941,7 @@ default ResponseEntity> getConsumerList( tags = { "Portal Management" }, responses = { @ApiResponse(responseCode = "200", description = "成功获取消费者Token", content = { - @Content(mediaType = "application/json", schema = @Schema(implementation = Object.class)) + @Content(mediaType = "application/json", schema = @Schema(implementation = OpenConsumerInfoDTO.class)) }) }, security = { @@ -953,7 +953,7 @@ default ResponseEntity> getConsumerList( value = "/openapi/v1/consumer-tokens/by-appId", produces = { "application/json" } ) - default ResponseEntity getConsumerTokenByAppId( + default ResponseEntity getConsumerTokenByAppId( @NotNull @Parameter(name = "appId", description = "", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "appId", required = true) String appId ) { return getDelegate().getConsumerTokenByAppId(appId); diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java index 8dca23d4..f7d87004 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java @@ -109,7 +109,7 @@ default ResponseEntity createConsumer(OpenConsumerCreateReq getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; + String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } @@ -521,7 +521,7 @@ default ResponseEntity> getConsumerList(Integer page, getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "[ { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }, { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" } ]"; + String exampleString = "[ { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }, { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" } ]"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } @@ -539,7 +539,16 @@ default ResponseEntity> getConsumerList(Integer page, * @return 成功获取消费者Token (status code 200) * @see PortalManagementApi#getConsumerTokenByAppId */ - default ResponseEntity getConsumerTokenByAppId(String appId) { + default ResponseEntity getConsumerTokenByAppId(String appId) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; + 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/OpenConsumerInfoDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java index e1af5385..217f6b48 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java @@ -43,6 +43,8 @@ public class OpenConsumerInfoDTO { private Integer rateLimit = 0; + private Boolean rateLimitEnabled = false; + public OpenConsumerInfoDTO appId(String appId) { this.appId = appId; return this; @@ -263,6 +265,26 @@ public void setRateLimit(Integer rateLimit) { this.rateLimit = rateLimit; } + public OpenConsumerInfoDTO rateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + return this; + } + + /** + * 是否开启限流 + * @return rateLimitEnabled + */ + + @Schema(name = "rateLimitEnabled", description = "是否开启限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("rateLimitEnabled") + public Boolean getRateLimitEnabled() { + return rateLimitEnabled; + } + + public void setRateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -282,12 +304,13 @@ public boolean equals(Object o) { Objects.equals(this.token, openConsumerInfoDTO.token) && Objects.equals(this.allowCreateApplication, openConsumerInfoDTO.allowCreateApplication) && Objects.equals(this.allowManageUsers, openConsumerInfoDTO.allowManageUsers) && - Objects.equals(this.rateLimit, openConsumerInfoDTO.rateLimit); + Objects.equals(this.rateLimit, openConsumerInfoDTO.rateLimit) && + Objects.equals(this.rateLimitEnabled, openConsumerInfoDTO.rateLimitEnabled); } @Override public int hashCode() { - return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, token, allowCreateApplication, allowManageUsers, rateLimit); + return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, token, allowCreateApplication, allowManageUsers, rateLimit, rateLimitEnabled); } @Override @@ -305,6 +328,7 @@ public String toString() { sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append(" rateLimitEnabled: ").append(toIndentedString(rateLimitEnabled)).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 0eb55f82..0a8c868f 100644 --- a/spring-boot2/src/main/resources/openapi.yaml +++ b/spring-boot2/src/main/resources/openapi.yaml @@ -6451,7 +6451,7 @@ paths: content: application/json: schema: - type: object + $ref: '#/components/schemas/OpenConsumerInfoDTO' description: 成功获取消费者Token summary: 按应用ID查询消费者Token(new added) tags: @@ -8715,6 +8715,7 @@ components: name: name allowCreateApplication: false allowManageUsers: false + rateLimitEnabled: false orgId: orgId ownerEmail: ownerEmail token: token @@ -8756,6 +8757,10 @@ components: default: 0 description: 限流QPS,0表示不限流 type: integer + rateLimitEnabled: + default: false + description: 是否开启限流 + type: boolean type: object OpenUserInfoDTO: example: diff --git a/tests/test_user_management_contract.py b/tests/test_user_management_contract.py index 56e777ca..2f687555 100644 --- a/tests/test_user_management_contract.py +++ b/tests/test_user_management_contract.py @@ -83,10 +83,18 @@ def test_consumer_management_uses_typed_schemas_with_manage_users_flag(self): list_consumers["responses"]["200"]["content"]["application/json"]["schema"]["items"]["$ref"], ) + consumer_token = spec["paths"]["/openapi/v1/consumer-tokens/by-appId"]["get"] + self.assertEqual( + "#/components/schemas/OpenConsumerInfoDTO", + consumer_token["responses"]["200"]["content"]["application/json"]["schema"]["$ref"], + ) + for schema_name in ("OpenConsumerCreateRequestDTO", "OpenConsumerInfoDTO"): properties = schemas[schema_name]["properties"] self.assertEqual("boolean", properties["allowCreateApplication"]["type"]) self.assertEqual("boolean", properties["allowManageUsers"]["type"]) + self.assertEqual("boolean", + schemas["OpenConsumerInfoDTO"]["properties"]["rateLimitEnabled"]["type"]) def test_spring_server_api_uses_user_management_name(self): api_dir = self.repo_root / "spring-boot2/src/main/java/com/apollo/openapi/server/api" @@ -94,6 +102,16 @@ def test_spring_server_api_uses_user_management_name(self): self.assertTrue((api_dir / "UserManagementApi.java").exists()) self.assertFalse((api_dir / "PortalUserManagementApi.java").exists()) + def test_java_client_preserves_optional_operator_overloads(self): + api_file = self.repo_root / ( + "java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java") + content = api_file.read_text(encoding="utf-8") + + self.assertIn("changeUserEnabled(OpenUserDTO openUserDTO) throws ApiException", content) + self.assertIn( + "createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException", + content) + def _find_parameter(self, operation, name): for parameter in operation.get("parameters", ()): if parameter.get("name") == name: diff --git a/typescript/src/apis/PortalManagementApi.ts b/typescript/src/apis/PortalManagementApi.ts index 3c22f9e1..6e9a5786 100644 --- a/typescript/src/apis/PortalManagementApi.ts +++ b/typescript/src/apis/PortalManagementApi.ts @@ -1318,7 +1318,7 @@ export class PortalManagementApi extends runtime.BaseAPI { * GET /openapi/v1/consumer-tokens/by-appId * 按应用ID查询消费者Token(new added) */ - async getConsumerTokenByAppIdRaw(requestParameters: GetConsumerTokenByAppIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getConsumerTokenByAppIdRaw(requestParameters: GetConsumerTokenByAppIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.appId === null || requestParameters.appId === undefined) { throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling getConsumerTokenByAppId.'); } @@ -1342,14 +1342,14 @@ export class PortalManagementApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response); + return new runtime.JSONApiResponse(response, (jsonValue) => OpenConsumerInfoDTOFromJSON(jsonValue)); } /** * GET /openapi/v1/consumer-tokens/by-appId * 按应用ID查询消费者Token(new added) */ - async getConsumerTokenByAppId(requestParameters: GetConsumerTokenByAppIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async getConsumerTokenByAppId(requestParameters: GetConsumerTokenByAppIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getConsumerTokenByAppIdRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/typescript/src/models/OpenConsumerInfoDTO.ts b/typescript/src/models/OpenConsumerInfoDTO.ts index 30f04bc3..605815c7 100644 --- a/typescript/src/models/OpenConsumerInfoDTO.ts +++ b/typescript/src/models/OpenConsumerInfoDTO.ts @@ -84,6 +84,12 @@ export interface OpenConsumerInfoDTO { * @memberof OpenConsumerInfoDTO */ rateLimit?: number; + /** + * 是否开启限流 + * @type {boolean} + * @memberof OpenConsumerInfoDTO + */ + rateLimitEnabled?: boolean; } /** @@ -116,6 +122,7 @@ export function OpenConsumerInfoDTOFromJSONTyped(json: any, ignoreDiscriminator: 'allowCreateApplication': !exists(json, 'allowCreateApplication') ? undefined : json['allowCreateApplication'], 'allowManageUsers': !exists(json, 'allowManageUsers') ? undefined : json['allowManageUsers'], 'rateLimit': !exists(json, 'rateLimit') ? undefined : json['rateLimit'], + 'rateLimitEnabled': !exists(json, 'rateLimitEnabled') ? undefined : json['rateLimitEnabled'], }; } @@ -139,5 +146,6 @@ export function OpenConsumerInfoDTOToJSON(value?: OpenConsumerInfoDTO | null): a 'allowCreateApplication': value.allowCreateApplication, 'allowManageUsers': value.allowManageUsers, 'rateLimit': value.rateLimit, + 'rateLimitEnabled': value.rateLimitEnabled, }; } From 0a6ac879a17c5bb581ac00dc6705730d9ce866b9 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sat, 6 Jun 2026 13:11:21 +0800 Subject: [PATCH 4/4] fix: refine consumer management contract --- CHANGELOG.md | 2 +- apollo-openapi.yaml | 52 +- java-client/.openapi-generator/FILES | 3 + java-client/README.md | 1 + java-client/api/openapi.yaml | 66 ++- .../docs/NamespaceBranchManagementApi.md | 7 +- java-client/docs/OpenConsumerSummaryDTO.md | 20 + java-client/docs/PortalManagementApi.md | 6 +- java-client/docs/ReleaseManagementApi.md | 9 +- java-client/docs/UserManagementApi.md | 1 + .../java/org/openapitools/client/JSON.java | 1 + .../client/api/PortalManagementApi.java | 17 +- .../client/api/UserManagementApi.java | 4 + .../model/OpenConsumerCreateRequestDTO.java | 2 + .../client/model/OpenConsumerInfoDTO.java | 4 +- .../client/model/OpenConsumerSummaryDTO.java | 503 ++++++++++++++++++ .../api/AccessKeyManagementApiTest.java | 4 - .../api/NamespaceBranchManagementApiTest.java | 1 - .../client/api/PortalManagementApiTest.java | 3 +- .../client/api/ReleaseManagementApiTest.java | 2 - .../client/api/UserManagementApiTest.java | 4 - .../model/OpenConsumerSummaryDTOTest.java | 127 +++++ python/.openapi-generator/FILES | 4 + python/README.md | 1 + .../model/open_consumer_create_request_dto.py | 10 +- .../open_consumer_create_request_dto.pyi | 7 +- .../model/open_consumer_info_dto.py | 10 +- .../model/open_consumer_info_dto.pyi | 7 +- .../model/open_consumer_summary_dto.py | 185 +++++++ .../model/open_consumer_summary_dto.pyi | 182 +++++++ python/apollo_openapi/models/__init__.py | 1 + .../paths/openapi_v1_consumers/get.py | 10 +- .../paths/openapi_v1_consumers/get.pyi | 10 +- .../paths/openapi_v1_users_user_id/get.py | 20 + .../paths/openapi_v1_users_user_id/get.pyi | 19 + python/docs/apis/tags/PortalManagementApi.md | 6 +- python/docs/apis/tags/UserManagementApi.md | 14 + python/docs/models/OpenConsumerSummaryDTO.md | 24 + .../test_open_consumer_summary_dto.py | 24 + rust/.openapi-generator/FILES | 2 + rust/README.md | 1 + rust/docs/OpenConsumerSummaryDto.md | 19 + rust/src/models/mod.rs | 2 + rust/src/models/open_consumer_summary_dto.rs | 66 +++ spring-boot2/.openapi-generator/FILES | 1 + .../server/api/PortalManagementApi.java | 5 +- .../api/PortalManagementApiController.java | 1 + .../api/PortalManagementApiDelegate.java | 9 +- .../openapi/server/api/UserManagementApi.java | 4 + .../server/api/UserManagementApiDelegate.java | 3 +- .../model/OpenConsumerCreateRequestDTO.java | 3 +- .../server/model/OpenConsumerInfoDTO.java | 5 +- .../server/model/OpenConsumerSummaryDTO.java | 323 +++++++++++ spring-boot2/src/main/resources/openapi.yaml | 66 ++- tests/test_user_management_contract.py | 31 +- typescript/.openapi-generator/FILES | 1 + typescript/src/apis/PortalManagementApi.ts | 9 +- .../src/models/OpenConsumerSummaryDTO.ts | 143 +++++ typescript/src/models/index.ts | 1 + 59 files changed, 1999 insertions(+), 69 deletions(-) create mode 100644 java-client/docs/OpenConsumerSummaryDTO.md create mode 100644 java-client/src/main/java/org/openapitools/client/model/OpenConsumerSummaryDTO.java create mode 100644 java-client/src/test/java/org/openapitools/client/model/OpenConsumerSummaryDTOTest.java create mode 100644 python/apollo_openapi/model/open_consumer_summary_dto.py create mode 100644 python/apollo_openapi/model/open_consumer_summary_dto.pyi create mode 100644 python/docs/models/OpenConsumerSummaryDTO.md create mode 100644 python/test/test_models/test_open_consumer_summary_dto.py create mode 100644 rust/docs/OpenConsumerSummaryDto.md create mode 100644 rust/src/models/open_consumer_summary_dto.rs create mode 100644 spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerSummaryDTO.java create mode 100644 typescript/src/models/OpenConsumerSummaryDTO.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index f475c41c..253d382d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add Consumer Token support notes to user management contracts, including `ManageUsers`-guarded user lookup and mutation operations. -- Add typed consumer management request and response schemas with `allowManageUsers` and `rateLimitEnabled` flags. +- Add typed consumer management request, detail, and summary schemas with `allowManageUsers` and `rateLimitEnabled` flags. ## [0.3.5] - 2026-05-31 diff --git a/apollo-openapi.yaml b/apollo-openapi.yaml index 207289a5..14f75937 100644 --- a/apollo-openapi.yaml +++ b/apollo-openapi.yaml @@ -5018,6 +5018,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ExceptionResponse' + '401': + description: 未登录或未认证 + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' '403': description: 权限不足 content: @@ -5379,7 +5385,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/OpenConsumerInfoDTO' + $ref: '#/components/schemas/OpenConsumerSummaryDTO' /openapi/v1/consumer-tokens/by-appId: get: summary: 按应用ID查询消费者Token(new added) @@ -6857,6 +6863,7 @@ components: rateLimit: type: integer description: 限流QPS,0表示不限流 + minimum: 0 default: 0 OpenConsumerInfoDTO: type: object @@ -6897,6 +6904,49 @@ components: rateLimit: type: integer description: 限流QPS,0表示不限流 + minimum: 0 + default: 0 + rateLimitEnabled: + type: boolean + description: 是否开启限流 + default: false + OpenConsumerSummaryDTO: + type: object + properties: + appId: + type: string + description: 第三方应用ID + name: + type: string + description: 第三方应用名称 + orgId: + type: string + description: 部门ID + orgName: + type: string + description: 部门名称 + ownerName: + type: string + description: 负责人用户名 + ownerEmail: + type: string + description: 负责人邮箱 + consumerId: + type: integer + format: int64 + description: Consumer ID + allowCreateApplication: + type: boolean + description: 是否允许该Consumer Token创建应用 + default: false + allowManageUsers: + type: boolean + description: 是否允许该Consumer Token管理用户 + default: false + rateLimit: + type: integer + description: 限流QPS,0表示不限流 + minimum: 0 default: 0 rateLimitEnabled: type: boolean diff --git a/java-client/.openapi-generator/FILES b/java-client/.openapi-generator/FILES index 8cd1caec..de29599a 100644 --- a/java-client/.openapi-generator/FILES +++ b/java-client/.openapi-generator/FILES @@ -27,6 +27,7 @@ docs/OpenClusterDTO.md docs/OpenClusterNamespaceRoleUserDTO.md docs/OpenConsumerCreateRequestDTO.md docs/OpenConsumerInfoDTO.md +docs/OpenConsumerSummaryDTO.md docs/OpenCreateAppDTO.md docs/OpenCreateNamespaceDTO.md docs/OpenEnvClusterDTO.md @@ -115,6 +116,7 @@ src/main/java/org/openapitools/client/model/OpenClusterDTO.java src/main/java/org/openapitools/client/model/OpenClusterNamespaceRoleUserDTO.java src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java +src/main/java/org/openapitools/client/model/OpenConsumerSummaryDTO.java src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java src/main/java/org/openapitools/client/model/OpenCreateNamespaceDTO.java src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java @@ -171,6 +173,7 @@ src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java src/test/java/org/openapitools/client/model/OpenClusterNamespaceRoleUserDTOTest.java src/test/java/org/openapitools/client/model/OpenConsumerCreateRequestDTOTest.java src/test/java/org/openapitools/client/model/OpenConsumerInfoDTOTest.java +src/test/java/org/openapitools/client/model/OpenConsumerSummaryDTOTest.java src/test/java/org/openapitools/client/model/OpenCreateAppDTOTest.java src/test/java/org/openapitools/client/model/OpenCreateNamespaceDTOTest.java src/test/java/org/openapitools/client/model/OpenEnvClusterDTOTest.java diff --git a/java-client/README.md b/java-client/README.md index 6b97a85d..9b17103d 100644 --- a/java-client/README.md +++ b/java-client/README.md @@ -290,6 +290,7 @@ Class | Method | HTTP request | Description - [OpenClusterNamespaceRoleUserDTO](docs/OpenClusterNamespaceRoleUserDTO.md) - [OpenConsumerCreateRequestDTO](docs/OpenConsumerCreateRequestDTO.md) - [OpenConsumerInfoDTO](docs/OpenConsumerInfoDTO.md) + - [OpenConsumerSummaryDTO](docs/OpenConsumerSummaryDTO.md) - [OpenCreateAppDTO](docs/OpenCreateAppDTO.md) - [OpenCreateNamespaceDTO](docs/OpenCreateNamespaceDTO.md) - [OpenEnvClusterDTO](docs/OpenEnvClusterDTO.md) diff --git a/java-client/api/openapi.yaml b/java-client/api/openapi.yaml index 93e77a16..429a43db 100644 --- a/java-client/api/openapi.yaml +++ b/java-client/api/openapi.yaml @@ -5775,6 +5775,12 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' description: 请求参数错误或用户不存在 + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + description: 未登录或未认证 "403": content: application/json: @@ -6171,7 +6177,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/OpenConsumerInfoDTO' + $ref: '#/components/schemas/OpenConsumerSummaryDTO' type: array description: 成功获取消费者列表 summary: 查询开放平台消费者列表(new added) @@ -8427,12 +8433,13 @@ components: rateLimit: default: 0 description: 限流QPS,0表示不限流 + minimum: 0 type: integer type: object OpenConsumerInfoDTO: example: orgName: orgName - rateLimit: 6 + rateLimit: 0 ownerName: ownerName consumerId: 0 appId: appId @@ -8480,6 +8487,61 @@ components: rateLimit: default: 0 description: 限流QPS,0表示不限流 + minimum: 0 + type: integer + rateLimitEnabled: + default: false + description: 是否开启限流 + type: boolean + type: object + OpenConsumerSummaryDTO: + example: + orgName: orgName + rateLimit: 0 + ownerName: ownerName + consumerId: 0 + appId: appId + name: name + allowCreateApplication: false + allowManageUsers: false + rateLimitEnabled: false + orgId: orgId + ownerEmail: ownerEmail + properties: + appId: + description: 第三方应用ID + type: string + name: + description: 第三方应用名称 + type: string + orgId: + description: 部门ID + type: string + orgName: + description: 部门名称 + type: string + ownerName: + description: 负责人用户名 + type: string + ownerEmail: + description: 负责人邮箱 + type: string + consumerId: + description: Consumer ID + format: int64 + type: integer + allowCreateApplication: + default: false + description: 是否允许该Consumer Token创建应用 + type: boolean + allowManageUsers: + default: false + description: 是否允许该Consumer Token管理用户 + type: boolean + rateLimit: + default: 0 + description: 限流QPS,0表示不限流 + minimum: 0 type: integer rateLimitEnabled: default: false diff --git a/java-client/docs/NamespaceBranchManagementApi.md b/java-client/docs/NamespaceBranchManagementApi.md index be9b03f7..db24275a 100644 --- a/java-client/docs/NamespaceBranchManagementApi.md +++ b/java-client/docs/NamespaceBranchManagementApi.md @@ -493,12 +493,11 @@ public class Example { # **updateBranchRules** > updateBranchRules(appId, env, clusterName, namespaceName, branchName, openGrayReleaseRuleDTO, operator) -The pre-0.3.1 overload -`updateBranchRules(appId, env, clusterName, namespaceName, branchName, operator, openGrayReleaseRuleDTO)` -is still available and delegates to this method. - 更新分支灰度发布规则 (original openapi) +Compatibility: the Java client also preserves the pre-0.3.1 overload with `operator` +before `openGrayReleaseRuleDTO`. + PUT /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/rules ### Example diff --git a/java-client/docs/OpenConsumerSummaryDTO.md b/java-client/docs/OpenConsumerSummaryDTO.md new file mode 100644 index 00000000..bb29f62b --- /dev/null +++ b/java-client/docs/OpenConsumerSummaryDTO.md @@ -0,0 +1,20 @@ + + +# OpenConsumerSummaryDTO + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**appId** | **String** | 第三方应用ID | [optional] | +|**name** | **String** | 第三方应用名称 | [optional] | +|**orgId** | **String** | 部门ID | [optional] | +|**orgName** | **String** | 部门名称 | [optional] | +|**ownerName** | **String** | 负责人用户名 | [optional] | +|**ownerEmail** | **String** | 负责人邮箱 | [optional] | +|**consumerId** | **Long** | Consumer ID | [optional] | +|**allowCreateApplication** | **Boolean** | 是否允许该Consumer Token创建应用 | [optional] | +|**allowManageUsers** | **Boolean** | 是否允许该Consumer Token管理用户 | [optional] | +|**rateLimit** | **Integer** | 限流QPS,0表示不限流 | [optional] | +|**rateLimitEnabled** | **Boolean** | 是否开启限流 | [optional] | diff --git a/java-client/docs/PortalManagementApi.md b/java-client/docs/PortalManagementApi.md index 83c7023b..976fdd87 100644 --- a/java-client/docs/PortalManagementApi.md +++ b/java-client/docs/PortalManagementApi.md @@ -1761,7 +1761,7 @@ This endpoint does not need any parameter. # **getConsumerList** -> List<OpenConsumerInfoDTO> getConsumerList(page, size) +> List<OpenConsumerSummaryDTO> getConsumerList(page, size) 查询开放平台消费者列表(new added) @@ -1792,7 +1792,7 @@ public class Example { Integer page = 0; // Integer | Integer size = 10; // Integer | try { - List result = apiInstance.getConsumerList(page, size); + List result = apiInstance.getConsumerList(page, size); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PortalManagementApi#getConsumerList"); @@ -1814,7 +1814,7 @@ public class Example { ### Return type -[**List<OpenConsumerInfoDTO>**](OpenConsumerInfoDTO.md) +[**List<OpenConsumerSummaryDTO>**](OpenConsumerSummaryDTO.md) ### Authorization diff --git a/java-client/docs/ReleaseManagementApi.md b/java-client/docs/ReleaseManagementApi.md index 2a6c0112..a55bb782 100644 --- a/java-client/docs/ReleaseManagementApi.md +++ b/java-client/docs/ReleaseManagementApi.md @@ -415,6 +415,9 @@ public class Example { 获取发布详情 (new added) +Compatibility: the Java client also preserves the pre-0.3.5 overloads that +accept `Integer releaseId`. + GET /openapi/v1/envs/{env}/releases/{releaseId} ### Example @@ -560,11 +563,11 @@ public class Example { # **rollback** > rollback(env, releaseId, operator, toReleaseId) -The pre-0.3.1 overload `rollback(env, releaseId, operator)` is still available -and delegates to the same endpoint without `toReleaseId`. - 回滚发布 (original openapi) +Compatibility: the Java client also preserves the pre-0.3.5 overloads without +`toReleaseId`. + 回滚到指定的发布版本 ### Example diff --git a/java-client/docs/UserManagementApi.md b/java-client/docs/UserManagementApi.md index 222048df..ff94a1b7 100644 --- a/java-client/docs/UserManagementApi.md +++ b/java-client/docs/UserManagementApi.md @@ -293,6 +293,7 @@ public class Example { |-------------|-------------|------------------| | **200** | 成功获取用户 | - | | **400** | 请求参数错误或用户不存在 | - | +| **401** | 未登录或未认证 | - | | **403** | 权限不足 | - | diff --git a/java-client/src/main/java/org/openapitools/client/JSON.java b/java-client/src/main/java/org/openapitools/client/JSON.java index 6b49254f..4caedc44 100644 --- a/java-client/src/main/java/org/openapitools/client/JSON.java +++ b/java-client/src/main/java/org/openapitools/client/JSON.java @@ -103,6 +103,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenClusterNamespaceRoleUserDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenConsumerCreateRequestDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenConsumerInfoDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenConsumerSummaryDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenCreateAppDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenCreateNamespaceDTO.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OpenEnvClusterDTO.CustomTypeAdapterFactory()); diff --git a/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java index 75a182bf..b39bad00 100644 --- a/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/PortalManagementApi.java @@ -29,6 +29,7 @@ import java.io.File; import org.openapitools.client.model.OpenConsumerCreateRequestDTO; import org.openapitools.client.model.OpenConsumerInfoDTO; +import org.openapitools.client.model.OpenConsumerSummaryDTO; import java.lang.reflect.Type; import java.util.ArrayList; @@ -3425,7 +3426,7 @@ private okhttp3.Call getConsumerListValidateBeforeCall(Integer page, Integer siz * GET /openapi/v1/consumers * @param page (optional, default to 0) * @param size (optional, default to 10) - * @return List<OpenConsumerInfoDTO> + * @return List<OpenConsumerSummaryDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3433,8 +3434,8 @@ private okhttp3.Call getConsumerListValidateBeforeCall(Integer page, Integer siz
200 成功获取消费者列表 -
*/ - public List getConsumerList(Integer page, Integer size) throws ApiException { - ApiResponse> localVarResp = getConsumerListWithHttpInfo(page, size); + public List getConsumerList(Integer page, Integer size) throws ApiException { + ApiResponse> localVarResp = getConsumerListWithHttpInfo(page, size); return localVarResp.getData(); } @@ -3443,7 +3444,7 @@ public List getConsumerList(Integer page, Integer size) thr * GET /openapi/v1/consumers * @param page (optional, default to 0) * @param size (optional, default to 10) - * @return ApiResponse<List<OpenConsumerInfoDTO>> + * @return ApiResponse<List<OpenConsumerSummaryDTO>> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3451,9 +3452,9 @@ public List getConsumerList(Integer page, Integer size) thr
200 成功获取消费者列表 -
*/ - public ApiResponse> getConsumerListWithHttpInfo(Integer page, Integer size) throws ApiException { + public ApiResponse> getConsumerListWithHttpInfo(Integer page, Integer size) throws ApiException { okhttp3.Call localVarCall = getConsumerListValidateBeforeCall(page, size, null); - Type localVarReturnType = new TypeToken>(){}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -3471,10 +3472,10 @@ public ApiResponse> getConsumerListWithHttpInfo(Intege 200 成功获取消费者列表 - */ - public okhttp3.Call getConsumerListAsync(Integer page, Integer size, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getConsumerListAsync(Integer page, Integer size, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getConsumerListValidateBeforeCall(page, size, _callback); - Type localVarReturnType = new TypeToken>(){}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java b/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java index cedc0795..bd478fda 100644 --- a/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java +++ b/java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java @@ -549,6 +549,7 @@ public okhttp3.Call getCurrentUserAsync(final ApiCallback _call Status Code Description Response Headers 200 成功获取用户 - 400 请求参数错误或用户不存在 - + 401 未登录或未认证 - 403 权限不足 - */ @@ -619,6 +620,7 @@ private okhttp3.Call getUserByUserIdValidateBeforeCall(String userId, final ApiC Status Code Description Response Headers 200 成功获取用户 - 400 请求参数错误或用户不存在 - + 401 未登录或未认证 - 403 权限不足 - */ @@ -638,6 +640,7 @@ public OpenUserInfoDTO getUserByUserId(String userId) throws ApiException { Status Code Description Response Headers 200 成功获取用户 - 400 请求参数错误或用户不存在 - + 401 未登录或未认证 - 403 权限不足 - */ @@ -659,6 +662,7 @@ public ApiResponse getUserByUserIdWithHttpInfo(String userId) t Status Code Description Response Headers 200 成功获取用户 - 400 请求参数错误或用户不存在 - + 401 未登录或未认证 - 403 权限不足 - */ diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java index 0271ad39..900170de 100644 --- a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java +++ b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerCreateRequestDTO.java @@ -266,6 +266,7 @@ public OpenConsumerCreateRequestDTO rateLimit(Integer rateLimit) { /** * 限流QPS,0表示不限流 + * minimum: 0 * @return rateLimit **/ @javax.annotation.Nullable @@ -365,6 +366,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (!OpenConsumerCreateRequestDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenConsumerCreateRequestDTO is not found in the empty JSON string", OpenConsumerCreateRequestDTO.openapiRequiredFields.toString())); } + return; } Set> entries = jsonObj.entrySet(); diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java index e0e9e7e6..64ec748e 100644 --- a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java +++ b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerInfoDTO.java @@ -320,6 +320,7 @@ public OpenConsumerInfoDTO rateLimit(Integer rateLimit) { /** * 限流QPS,0表示不限流 + * minimum: 0 * @return rateLimit **/ @javax.annotation.Nullable @@ -394,7 +395,7 @@ public String toString() { sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); sb.append(" ownerEmail: ").append(toIndentedString(ownerEmail)).append("\n"); sb.append(" consumerId: ").append(toIndentedString(consumerId)).append("\n"); - sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" token: ").append(token == null ? "null" : "***redacted***").append("\n"); sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); @@ -449,6 +450,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (!OpenConsumerInfoDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenConsumerInfoDTO is not found in the empty JSON string", OpenConsumerInfoDTO.openapiRequiredFields.toString())); } + return; } Set> entries = jsonObj.entrySet(); diff --git a/java-client/src/main/java/org/openapitools/client/model/OpenConsumerSummaryDTO.java b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerSummaryDTO.java new file mode 100644 index 00000000..aa848e25 --- /dev/null +++ b/java-client/src/main/java/org/openapitools/client/model/OpenConsumerSummaryDTO.java @@ -0,0 +1,503 @@ +/* + * 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\"
+ * + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OpenConsumerSummaryDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OpenConsumerSummaryDTO { + public static final String SERIALIZED_NAME_APP_ID = "appId"; + @SerializedName(SERIALIZED_NAME_APP_ID) + private String appId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ORG_ID = "orgId"; + @SerializedName(SERIALIZED_NAME_ORG_ID) + private String orgId; + + public static final String SERIALIZED_NAME_ORG_NAME = "orgName"; + @SerializedName(SERIALIZED_NAME_ORG_NAME) + private String orgName; + + public static final String SERIALIZED_NAME_OWNER_NAME = "ownerName"; + @SerializedName(SERIALIZED_NAME_OWNER_NAME) + private String ownerName; + + public static final String SERIALIZED_NAME_OWNER_EMAIL = "ownerEmail"; + @SerializedName(SERIALIZED_NAME_OWNER_EMAIL) + private String ownerEmail; + + public static final String SERIALIZED_NAME_CONSUMER_ID = "consumerId"; + @SerializedName(SERIALIZED_NAME_CONSUMER_ID) + private Long consumerId; + + public static final String SERIALIZED_NAME_ALLOW_CREATE_APPLICATION = "allowCreateApplication"; + @SerializedName(SERIALIZED_NAME_ALLOW_CREATE_APPLICATION) + private Boolean allowCreateApplication = false; + + public static final String SERIALIZED_NAME_ALLOW_MANAGE_USERS = "allowManageUsers"; + @SerializedName(SERIALIZED_NAME_ALLOW_MANAGE_USERS) + private Boolean allowManageUsers = false; + + public static final String SERIALIZED_NAME_RATE_LIMIT = "rateLimit"; + @SerializedName(SERIALIZED_NAME_RATE_LIMIT) + private Integer rateLimit = 0; + + public static final String SERIALIZED_NAME_RATE_LIMIT_ENABLED = "rateLimitEnabled"; + @SerializedName(SERIALIZED_NAME_RATE_LIMIT_ENABLED) + private Boolean rateLimitEnabled = false; + + public OpenConsumerSummaryDTO() { + } + + public OpenConsumerSummaryDTO appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * 第三方应用ID + * @return appId + **/ + @javax.annotation.Nullable + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public OpenConsumerSummaryDTO name(String name) { + + this.name = name; + return this; + } + + /** + * 第三方应用名称 + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public OpenConsumerSummaryDTO orgId(String orgId) { + + this.orgId = orgId; + return this; + } + + /** + * 部门ID + * @return orgId + **/ + @javax.annotation.Nullable + public String getOrgId() { + return orgId; + } + + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + + public OpenConsumerSummaryDTO orgName(String orgName) { + + this.orgName = orgName; + return this; + } + + /** + * 部门名称 + * @return orgName + **/ + @javax.annotation.Nullable + public String getOrgName() { + return orgName; + } + + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + + public OpenConsumerSummaryDTO ownerName(String ownerName) { + + this.ownerName = ownerName; + return this; + } + + /** + * 负责人用户名 + * @return ownerName + **/ + @javax.annotation.Nullable + public String getOwnerName() { + return ownerName; + } + + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + + public OpenConsumerSummaryDTO ownerEmail(String ownerEmail) { + + this.ownerEmail = ownerEmail; + return this; + } + + /** + * 负责人邮箱 + * @return ownerEmail + **/ + @javax.annotation.Nullable + public String getOwnerEmail() { + return ownerEmail; + } + + + public void setOwnerEmail(String ownerEmail) { + this.ownerEmail = ownerEmail; + } + + + public OpenConsumerSummaryDTO consumerId(Long consumerId) { + + this.consumerId = consumerId; + return this; + } + + /** + * Consumer ID + * @return consumerId + **/ + @javax.annotation.Nullable + public Long getConsumerId() { + return consumerId; + } + + + public void setConsumerId(Long consumerId) { + this.consumerId = consumerId; + } + + + public OpenConsumerSummaryDTO allowCreateApplication(Boolean allowCreateApplication) { + + this.allowCreateApplication = allowCreateApplication; + return this; + } + + /** + * 是否允许该Consumer Token创建应用 + * @return allowCreateApplication + **/ + @javax.annotation.Nullable + public Boolean getAllowCreateApplication() { + return allowCreateApplication; + } + + + public void setAllowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + } + + + public OpenConsumerSummaryDTO allowManageUsers(Boolean allowManageUsers) { + + this.allowManageUsers = allowManageUsers; + return this; + } + + /** + * 是否允许该Consumer Token管理用户 + * @return allowManageUsers + **/ + @javax.annotation.Nullable + public Boolean getAllowManageUsers() { + return allowManageUsers; + } + + + public void setAllowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + } + + + public OpenConsumerSummaryDTO rateLimit(Integer rateLimit) { + + this.rateLimit = rateLimit; + return this; + } + + /** + * 限流QPS,0表示不限流 + * minimum: 0 + * @return rateLimit + **/ + @javax.annotation.Nullable + public Integer getRateLimit() { + return rateLimit; + } + + + public void setRateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + } + + + public OpenConsumerSummaryDTO rateLimitEnabled(Boolean rateLimitEnabled) { + + this.rateLimitEnabled = rateLimitEnabled; + return this; + } + + /** + * 是否开启限流 + * @return rateLimitEnabled + **/ + @javax.annotation.Nullable + public Boolean getRateLimitEnabled() { + return rateLimitEnabled; + } + + + public void setRateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenConsumerSummaryDTO openConsumerSummaryDTO = (OpenConsumerSummaryDTO) o; + return Objects.equals(this.appId, openConsumerSummaryDTO.appId) && + Objects.equals(this.name, openConsumerSummaryDTO.name) && + Objects.equals(this.orgId, openConsumerSummaryDTO.orgId) && + Objects.equals(this.orgName, openConsumerSummaryDTO.orgName) && + Objects.equals(this.ownerName, openConsumerSummaryDTO.ownerName) && + Objects.equals(this.ownerEmail, openConsumerSummaryDTO.ownerEmail) && + Objects.equals(this.consumerId, openConsumerSummaryDTO.consumerId) && + Objects.equals(this.allowCreateApplication, openConsumerSummaryDTO.allowCreateApplication) && + Objects.equals(this.allowManageUsers, openConsumerSummaryDTO.allowManageUsers) && + Objects.equals(this.rateLimit, openConsumerSummaryDTO.rateLimit) && + Objects.equals(this.rateLimitEnabled, openConsumerSummaryDTO.rateLimitEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, allowCreateApplication, allowManageUsers, rateLimit, rateLimitEnabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenConsumerSummaryDTO {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" ownerEmail: ").append(toIndentedString(ownerEmail)).append("\n"); + sb.append(" consumerId: ").append(toIndentedString(consumerId)).append("\n"); + sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); + sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); + sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append(" rateLimitEnabled: ").append(toIndentedString(rateLimitEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("appId"); + openapiFields.add("name"); + openapiFields.add("orgId"); + openapiFields.add("orgName"); + openapiFields.add("ownerName"); + openapiFields.add("ownerEmail"); + openapiFields.add("consumerId"); + openapiFields.add("allowCreateApplication"); + openapiFields.add("allowManageUsers"); + openapiFields.add("rateLimit"); + openapiFields.add("rateLimitEnabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OpenConsumerSummaryDTO + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OpenConsumerSummaryDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenConsumerSummaryDTO is not found in the empty JSON string", OpenConsumerSummaryDTO.openapiRequiredFields.toString())); + } + return; + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!OpenConsumerSummaryDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenConsumerSummaryDTO` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + } + } + 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("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("orgId") != null && !jsonObj.get("orgId").isJsonNull()) && !jsonObj.get("orgId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orgId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orgId").toString())); + } + if ((jsonObj.get("orgName") != null && !jsonObj.get("orgName").isJsonNull()) && !jsonObj.get("orgName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orgName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orgName").toString())); + } + if ((jsonObj.get("ownerName") != null && !jsonObj.get("ownerName").isJsonNull()) && !jsonObj.get("ownerName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ownerName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ownerName").toString())); + } + if ((jsonObj.get("ownerEmail") != null && !jsonObj.get("ownerEmail").isJsonNull()) && !jsonObj.get("ownerEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ownerEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ownerEmail").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OpenConsumerSummaryDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OpenConsumerSummaryDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OpenConsumerSummaryDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OpenConsumerSummaryDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OpenConsumerSummaryDTO read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OpenConsumerSummaryDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of OpenConsumerSummaryDTO + * @throws IOException if the JSON string is invalid with respect to OpenConsumerSummaryDTO + */ + public static OpenConsumerSummaryDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OpenConsumerSummaryDTO.class); + } + + /** + * Convert an instance of OpenConsumerSummaryDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/java-client/src/test/java/org/openapitools/client/api/AccessKeyManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/AccessKeyManagementApiTest.java index 6f43023a..b8f0c588 100644 --- a/java-client/src/test/java/org/openapitools/client/api/AccessKeyManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/AccessKeyManagementApiTest.java @@ -75,9 +75,7 @@ public void disableAccessKeyTest() throws ApiException { String appId = null; String env = null; Long accessKeyId = null; - String operator = null; api.disableAccessKey(appId, env, accessKeyId); - api.disableAccessKey(appId, env, accessKeyId, operator); // TODO: test validations } @@ -94,9 +92,7 @@ public void enableAccessKeyTest() throws ApiException { String env = null; Long accessKeyId = null; Integer mode = null; - String operator = null; api.enableAccessKey(appId, env, accessKeyId, mode); - api.enableAccessKey(appId, env, accessKeyId, mode, operator); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/api/NamespaceBranchManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/NamespaceBranchManagementApiTest.java index 8edabda3..64c2f53f 100644 --- a/java-client/src/test/java/org/openapitools/client/api/NamespaceBranchManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/NamespaceBranchManagementApiTest.java @@ -164,7 +164,6 @@ public void updateBranchRulesTest() throws ApiException { String branchName = null; OpenGrayReleaseRuleDTO openGrayReleaseRuleDTO = null; String operator = null; - api.updateBranchRules(appId, env, clusterName, namespaceName, branchName, openGrayReleaseRuleDTO, operator); api.updateBranchRules(appId, env, clusterName, namespaceName, branchName, operator, openGrayReleaseRuleDTO); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java index 077790fb..14d1fa17 100644 --- a/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/PortalManagementApiTest.java @@ -16,6 +16,7 @@ import java.io.File; import org.openapitools.client.model.OpenConsumerCreateRequestDTO; import org.openapitools.client.model.OpenConsumerInfoDTO; +import org.openapitools.client.model.OpenConsumerSummaryDTO; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -414,7 +415,7 @@ public void getAuditPropertiesTest() throws ApiException { public void getConsumerListTest() throws ApiException { Integer page = null; Integer size = null; - List response = api.getConsumerList(page, size); + List response = api.getConsumerList(page, size); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/api/ReleaseManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/ReleaseManagementApiTest.java index 6e8111d3..c0d14a4f 100644 --- a/java-client/src/test/java/org/openapitools/client/api/ReleaseManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/ReleaseManagementApiTest.java @@ -172,8 +172,6 @@ public void rollbackTest() throws ApiException { String env = null; Long releaseId = null; String operator = null; - Long toReleaseId = null; - api.rollback(env, releaseId, operator, toReleaseId); api.rollback(env, releaseId, operator); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java b/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java index ecc24cfe..32d92a03 100644 --- a/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java +++ b/java-client/src/test/java/org/openapitools/client/api/UserManagementApiTest.java @@ -42,9 +42,7 @@ public class UserManagementApiTest { @Test public void changeUserEnabledTest() throws ApiException { OpenUserDTO openUserDTO = null; - String operator = null; api.changeUserEnabled(openUserDTO); - api.changeUserEnabled(openUserDTO, operator); // TODO: test validations } @@ -59,9 +57,7 @@ public void changeUserEnabledTest() throws ApiException { public void createOrUpdateUserTest() throws ApiException { OpenUserDTO openUserDTO = null; Boolean isCreate = null; - String operator = null; api.createOrUpdateUser(openUserDTO, isCreate); - api.createOrUpdateUser(openUserDTO, isCreate, operator); // TODO: test validations } diff --git a/java-client/src/test/java/org/openapitools/client/model/OpenConsumerSummaryDTOTest.java b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerSummaryDTOTest.java new file mode 100644 index 00000000..9170919e --- /dev/null +++ b/java-client/src/test/java/org/openapitools/client/model/OpenConsumerSummaryDTOTest.java @@ -0,0 +1,127 @@ +/* + * 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\"
+ * + * + * + * 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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OpenConsumerSummaryDTO + */ +public class OpenConsumerSummaryDTOTest { + private final OpenConsumerSummaryDTO model = new OpenConsumerSummaryDTO(); + + /** + * Model tests for OpenConsumerSummaryDTO + */ + @Test + public void testOpenConsumerSummaryDTO() { + // TODO: test OpenConsumerSummaryDTO + } + + /** + * Test the property 'appId' + */ + @Test + public void appIdTest() { + // TODO: test appId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'orgId' + */ + @Test + public void orgIdTest() { + // TODO: test orgId + } + + /** + * Test the property 'orgName' + */ + @Test + public void orgNameTest() { + // TODO: test orgName + } + + /** + * Test the property 'ownerName' + */ + @Test + public void ownerNameTest() { + // TODO: test ownerName + } + + /** + * Test the property 'ownerEmail' + */ + @Test + public void ownerEmailTest() { + // TODO: test ownerEmail + } + + /** + * Test the property 'consumerId' + */ + @Test + public void consumerIdTest() { + // TODO: test consumerId + } + + /** + * Test the property 'allowCreateApplication' + */ + @Test + public void allowCreateApplicationTest() { + // TODO: test allowCreateApplication + } + + /** + * Test the property 'allowManageUsers' + */ + @Test + public void allowManageUsersTest() { + // TODO: test allowManageUsers + } + + /** + * Test the property 'rateLimit' + */ + @Test + public void rateLimitTest() { + // TODO: test rateLimit + } + + /** + * Test the property 'rateLimitEnabled' + */ + @Test + public void rateLimitEnabledTest() { + // TODO: test rateLimitEnabled + } + +} diff --git a/python/.openapi-generator/FILES b/python/.openapi-generator/FILES index 44c1557f..684af19d 100644 --- a/python/.openapi-generator/FILES +++ b/python/.openapi-generator/FILES @@ -48,6 +48,8 @@ apollo_openapi/model/open_consumer_create_request_dto.py apollo_openapi/model/open_consumer_create_request_dto.pyi apollo_openapi/model/open_consumer_info_dto.py apollo_openapi/model/open_consumer_info_dto.pyi +apollo_openapi/model/open_consumer_summary_dto.py +apollo_openapi/model/open_consumer_summary_dto.pyi apollo_openapi/model/open_create_app_dto.py apollo_openapi/model/open_create_app_dto.pyi apollo_openapi/model/open_create_namespace_dto.py @@ -140,6 +142,7 @@ docs/models/OpenClusterDTO.md docs/models/OpenClusterNamespaceRoleUserDTO.md docs/models/OpenConsumerCreateRequestDTO.md docs/models/OpenConsumerInfoDTO.md +docs/models/OpenConsumerSummaryDTO.md docs/models/OpenCreateAppDTO.md docs/models/OpenCreateNamespaceDTO.md docs/models/OpenEnvClusterDTO.md @@ -190,6 +193,7 @@ test/test_models/test_open_cluster_dto.py test/test_models/test_open_cluster_namespace_role_user_dto.py test/test_models/test_open_consumer_create_request_dto.py test/test_models/test_open_consumer_info_dto.py +test/test_models/test_open_consumer_summary_dto.py test/test_models/test_open_create_app_dto.py test/test_models/test_open_create_namespace_dto.py test/test_models/test_open_env_cluster_dto.py diff --git a/python/README.md b/python/README.md index ee9c6f02..11ac7486 100644 --- a/python/README.md +++ b/python/README.md @@ -349,6 +349,7 @@ Class | Method | HTTP request | Description - [OpenClusterNamespaceRoleUserDTO](docs/models/OpenClusterNamespaceRoleUserDTO.md) - [OpenConsumerCreateRequestDTO](docs/models/OpenConsumerCreateRequestDTO.md) - [OpenConsumerInfoDTO](docs/models/OpenConsumerInfoDTO.md) + - [OpenConsumerSummaryDTO](docs/models/OpenConsumerSummaryDTO.md) - [OpenCreateAppDTO](docs/models/OpenCreateAppDTO.md) - [OpenCreateNamespaceDTO](docs/models/OpenCreateNamespaceDTO.md) - [OpenEnvClusterDTO](docs/models/OpenEnvClusterDTO.md) diff --git a/python/apollo_openapi/model/open_consumer_create_request_dto.py b/python/apollo_openapi/model/open_consumer_create_request_dto.py index b6548ca0..26779136 100644 --- a/python/apollo_openapi/model/open_consumer_create_request_dto.py +++ b/python/apollo_openapi/model/open_consumer_create_request_dto.py @@ -43,7 +43,15 @@ class properties: orgName = schemas.StrSchema ownerName = schemas.StrSchema rateLimitEnabled = schemas.BoolSchema - rateLimit = schemas.IntSchema + + + class rateLimit( + schemas.IntSchema + ): + + + class MetaOapg: + inclusive_minimum = 0 __annotations__ = { "appId": appId, "allowCreateApplication": allowCreateApplication, diff --git a/python/apollo_openapi/model/open_consumer_create_request_dto.pyi b/python/apollo_openapi/model/open_consumer_create_request_dto.pyi index b6548ca0..26fe6747 100644 --- a/python/apollo_openapi/model/open_consumer_create_request_dto.pyi +++ b/python/apollo_openapi/model/open_consumer_create_request_dto.pyi @@ -43,7 +43,12 @@ class OpenConsumerCreateRequestDTO( orgName = schemas.StrSchema ownerName = schemas.StrSchema rateLimitEnabled = schemas.BoolSchema - rateLimit = schemas.IntSchema + + + class rateLimit( + schemas.IntSchema + ): + pass __annotations__ = { "appId": appId, "allowCreateApplication": allowCreateApplication, diff --git a/python/apollo_openapi/model/open_consumer_info_dto.py b/python/apollo_openapi/model/open_consumer_info_dto.py index b0cfefd5..cbbd983f 100644 --- a/python/apollo_openapi/model/open_consumer_info_dto.py +++ b/python/apollo_openapi/model/open_consumer_info_dto.py @@ -45,7 +45,15 @@ class properties: token = schemas.StrSchema allowCreateApplication = schemas.BoolSchema allowManageUsers = schemas.BoolSchema - rateLimit = schemas.IntSchema + + + class rateLimit( + schemas.IntSchema + ): + + + class MetaOapg: + inclusive_minimum = 0 rateLimitEnabled = schemas.BoolSchema __annotations__ = { "appId": appId, diff --git a/python/apollo_openapi/model/open_consumer_info_dto.pyi b/python/apollo_openapi/model/open_consumer_info_dto.pyi index b0cfefd5..74edb892 100644 --- a/python/apollo_openapi/model/open_consumer_info_dto.pyi +++ b/python/apollo_openapi/model/open_consumer_info_dto.pyi @@ -45,7 +45,12 @@ class OpenConsumerInfoDTO( token = schemas.StrSchema allowCreateApplication = schemas.BoolSchema allowManageUsers = schemas.BoolSchema - rateLimit = schemas.IntSchema + + + class rateLimit( + schemas.IntSchema + ): + pass rateLimitEnabled = schemas.BoolSchema __annotations__ = { "appId": appId, diff --git a/python/apollo_openapi/model/open_consumer_summary_dto.py b/python/apollo_openapi/model/open_consumer_summary_dto.py new file mode 100644 index 00000000..cbd782aa --- /dev/null +++ b/python/apollo_openapi/model/open_consumer_summary_dto.py @@ -0,0 +1,185 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +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 OpenConsumerSummaryDTO( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + appId = schemas.StrSchema + name = schemas.StrSchema + orgId = schemas.StrSchema + orgName = schemas.StrSchema + ownerName = schemas.StrSchema + ownerEmail = schemas.StrSchema + consumerId = schemas.Int64Schema + allowCreateApplication = schemas.BoolSchema + allowManageUsers = schemas.BoolSchema + + + class rateLimit( + schemas.IntSchema + ): + + + class MetaOapg: + inclusive_minimum = 0 + rateLimitEnabled = schemas.BoolSchema + __annotations__ = { + "appId": appId, + "name": name, + "orgId": orgId, + "orgName": orgName, + "ownerName": ownerName, + "ownerEmail": ownerEmail, + "consumerId": consumerId, + "allowCreateApplication": allowCreateApplication, + "allowManageUsers": allowManageUsers, + "rateLimit": rateLimit, + "rateLimitEnabled": rateLimitEnabled, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgId"]) -> MetaOapg.properties.orgId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgName"]) -> MetaOapg.properties.orgName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerName"]) -> MetaOapg.properties.ownerName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerEmail"]) -> MetaOapg.properties.ownerEmail: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["consumerId"]) -> MetaOapg.properties.consumerId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowCreateApplication"]) -> MetaOapg.properties.allowCreateApplication: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> MetaOapg.properties.allowManageUsers: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> MetaOapg.properties.rateLimitEnabled: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @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["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgId"]) -> typing.Union[MetaOapg.properties.orgId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgName"]) -> typing.Union[MetaOapg.properties.orgName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerName"]) -> typing.Union[MetaOapg.properties.ownerName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerEmail"]) -> typing.Union[MetaOapg.properties.ownerEmail, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["consumerId"]) -> typing.Union[MetaOapg.properties.consumerId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowCreateApplication"]) -> typing.Union[MetaOapg.properties.allowCreateApplication, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> typing.Union[MetaOapg.properties.allowManageUsers, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> typing.Union[MetaOapg.properties.rateLimitEnabled, 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["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + orgId: typing.Union[MetaOapg.properties.orgId, str, schemas.Unset] = schemas.unset, + orgName: typing.Union[MetaOapg.properties.orgName, str, schemas.Unset] = schemas.unset, + ownerName: typing.Union[MetaOapg.properties.ownerName, str, schemas.Unset] = schemas.unset, + ownerEmail: typing.Union[MetaOapg.properties.ownerEmail, str, schemas.Unset] = schemas.unset, + consumerId: typing.Union[MetaOapg.properties.consumerId, decimal.Decimal, int, schemas.Unset] = schemas.unset, + allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, + allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, + rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, schemas.Unset] = schemas.unset, + rateLimitEnabled: typing.Union[MetaOapg.properties.rateLimitEnabled, bool, 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], + ) -> 'OpenConsumerSummaryDTO': + return super().__new__( + cls, + *_args, + appId=appId, + name=name, + orgId=orgId, + orgName=orgName, + ownerName=ownerName, + ownerEmail=ownerEmail, + consumerId=consumerId, + allowCreateApplication=allowCreateApplication, + allowManageUsers=allowManageUsers, + rateLimit=rateLimit, + rateLimitEnabled=rateLimitEnabled, + _configuration=_configuration, + **kwargs, + ) diff --git a/python/apollo_openapi/model/open_consumer_summary_dto.pyi b/python/apollo_openapi/model/open_consumer_summary_dto.pyi new file mode 100644 index 00000000..e3aeab06 --- /dev/null +++ b/python/apollo_openapi/model/open_consumer_summary_dto.pyi @@ -0,0 +1,182 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +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 OpenConsumerSummaryDTO( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + appId = schemas.StrSchema + name = schemas.StrSchema + orgId = schemas.StrSchema + orgName = schemas.StrSchema + ownerName = schemas.StrSchema + ownerEmail = schemas.StrSchema + consumerId = schemas.Int64Schema + allowCreateApplication = schemas.BoolSchema + allowManageUsers = schemas.BoolSchema + + + class rateLimit( + schemas.IntSchema + ): + pass + rateLimitEnabled = schemas.BoolSchema + __annotations__ = { + "appId": appId, + "name": name, + "orgId": orgId, + "orgName": orgName, + "ownerName": ownerName, + "ownerEmail": ownerEmail, + "consumerId": consumerId, + "allowCreateApplication": allowCreateApplication, + "allowManageUsers": allowManageUsers, + "rateLimit": rateLimit, + "rateLimitEnabled": rateLimitEnabled, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["appId"]) -> MetaOapg.properties.appId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgId"]) -> MetaOapg.properties.orgId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["orgName"]) -> MetaOapg.properties.orgName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerName"]) -> MetaOapg.properties.ownerName: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ownerEmail"]) -> MetaOapg.properties.ownerEmail: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["consumerId"]) -> MetaOapg.properties.consumerId: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowCreateApplication"]) -> MetaOapg.properties.allowCreateApplication: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["allowManageUsers"]) -> MetaOapg.properties.allowManageUsers: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimit"]) -> MetaOapg.properties.rateLimit: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> MetaOapg.properties.rateLimitEnabled: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @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["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgId"]) -> typing.Union[MetaOapg.properties.orgId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["orgName"]) -> typing.Union[MetaOapg.properties.orgName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerName"]) -> typing.Union[MetaOapg.properties.ownerName, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ownerEmail"]) -> typing.Union[MetaOapg.properties.ownerEmail, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["consumerId"]) -> typing.Union[MetaOapg.properties.consumerId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowCreateApplication"]) -> typing.Union[MetaOapg.properties.allowCreateApplication, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["allowManageUsers"]) -> typing.Union[MetaOapg.properties.allowManageUsers, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimit"]) -> typing.Union[MetaOapg.properties.rateLimit, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["rateLimitEnabled"]) -> typing.Union[MetaOapg.properties.rateLimitEnabled, 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["appId", "name", "orgId", "orgName", "ownerName", "ownerEmail", "consumerId", "allowCreateApplication", "allowManageUsers", "rateLimit", "rateLimitEnabled", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + appId: typing.Union[MetaOapg.properties.appId, str, schemas.Unset] = schemas.unset, + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + orgId: typing.Union[MetaOapg.properties.orgId, str, schemas.Unset] = schemas.unset, + orgName: typing.Union[MetaOapg.properties.orgName, str, schemas.Unset] = schemas.unset, + ownerName: typing.Union[MetaOapg.properties.ownerName, str, schemas.Unset] = schemas.unset, + ownerEmail: typing.Union[MetaOapg.properties.ownerEmail, str, schemas.Unset] = schemas.unset, + consumerId: typing.Union[MetaOapg.properties.consumerId, decimal.Decimal, int, schemas.Unset] = schemas.unset, + allowCreateApplication: typing.Union[MetaOapg.properties.allowCreateApplication, bool, schemas.Unset] = schemas.unset, + allowManageUsers: typing.Union[MetaOapg.properties.allowManageUsers, bool, schemas.Unset] = schemas.unset, + rateLimit: typing.Union[MetaOapg.properties.rateLimit, decimal.Decimal, int, schemas.Unset] = schemas.unset, + rateLimitEnabled: typing.Union[MetaOapg.properties.rateLimitEnabled, bool, 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], + ) -> 'OpenConsumerSummaryDTO': + return super().__new__( + cls, + *_args, + appId=appId, + name=name, + orgId=orgId, + orgName=orgName, + ownerName=ownerName, + ownerEmail=ownerEmail, + consumerId=consumerId, + allowCreateApplication=allowCreateApplication, + allowManageUsers=allowManageUsers, + rateLimit=rateLimit, + rateLimitEnabled=rateLimitEnabled, + _configuration=_configuration, + **kwargs, + ) diff --git a/python/apollo_openapi/models/__init__.py b/python/apollo_openapi/models/__init__.py index f30770ba..9201f39c 100644 --- a/python/apollo_openapi/models/__init__.py +++ b/python/apollo_openapi/models/__init__.py @@ -23,6 +23,7 @@ from apollo_openapi.model.open_cluster_namespace_role_user_dto import OpenClusterNamespaceRoleUserDTO from apollo_openapi.model.open_consumer_create_request_dto import OpenConsumerCreateRequestDTO from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO +from apollo_openapi.model.open_consumer_summary_dto import OpenConsumerSummaryDTO from apollo_openapi.model.open_create_app_dto import OpenCreateAppDTO from apollo_openapi.model.open_create_namespace_dto import OpenCreateNamespaceDTO from apollo_openapi.model.open_env_cluster_dto import OpenEnvClusterDTO diff --git a/python/apollo_openapi/paths/openapi_v1_consumers/get.py b/python/apollo_openapi/paths/openapi_v1_consumers/get.py index 92b4c625..3d499c5d 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumers/get.py +++ b/python/apollo_openapi/paths/openapi_v1_consumers/get.py @@ -25,7 +25,7 @@ from apollo_openapi import schemas # noqa: F401 -from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO +from apollo_openapi.model.open_consumer_summary_dto import OpenConsumerSummaryDTO from . import path @@ -76,12 +76,12 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: @staticmethod - def items() -> typing.Type['OpenConsumerInfoDTO']: - return OpenConsumerInfoDTO + def items() -> typing.Type['OpenConsumerSummaryDTO']: + return OpenConsumerSummaryDTO def __new__( cls, - _arg: typing.Union[typing.Tuple['OpenConsumerInfoDTO'], typing.List['OpenConsumerInfoDTO']], + _arg: typing.Union[typing.Tuple['OpenConsumerSummaryDTO'], typing.List['OpenConsumerSummaryDTO']], _configuration: typing.Optional[schemas.Configuration] = None, ) -> 'SchemaFor200ResponseBodyApplicationJson': return super().__new__( @@ -90,7 +90,7 @@ def __new__( _configuration=_configuration, ) - def __getitem__(self, i: int) -> 'OpenConsumerInfoDTO': + def __getitem__(self, i: int) -> 'OpenConsumerSummaryDTO': return super().__getitem__(i) diff --git a/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi b/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi index 769cfda4..eb33c2d4 100644 --- a/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi +++ b/python/apollo_openapi/paths/openapi_v1_consumers/get.pyi @@ -25,7 +25,7 @@ import frozendict # noqa: F401 from apollo_openapi import schemas # noqa: F401 -from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO +from apollo_openapi.model.open_consumer_summary_dto import OpenConsumerSummaryDTO # Query params PageSchema = schemas.IntSchema @@ -71,12 +71,12 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: @staticmethod - def items() -> typing.Type['OpenConsumerInfoDTO']: - return OpenConsumerInfoDTO + def items() -> typing.Type['OpenConsumerSummaryDTO']: + return OpenConsumerSummaryDTO def __new__( cls, - _arg: typing.Union[typing.Tuple['OpenConsumerInfoDTO'], typing.List['OpenConsumerInfoDTO']], + _arg: typing.Union[typing.Tuple['OpenConsumerSummaryDTO'], typing.List['OpenConsumerSummaryDTO']], _configuration: typing.Optional[schemas.Configuration] = None, ) -> 'SchemaFor200ResponseBodyApplicationJson': return super().__new__( @@ -85,7 +85,7 @@ class SchemaFor200ResponseBodyApplicationJson( _configuration=_configuration, ) - def __getitem__(self, i: int) -> 'OpenConsumerInfoDTO': + def __getitem__(self, i: int) -> 'OpenConsumerSummaryDTO': return super().__getitem__(i) diff --git a/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py index 919afa1a..e1142f85 100644 --- a/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py +++ b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.py @@ -97,6 +97,25 @@ class ApiResponseFor400(api_client.ApiResponse): schema=SchemaFor400ResponseBodyApplicationJson), }, ) +SchemaFor401ResponseBodyApplicationJson = ExceptionResponse + + +@dataclass +class ApiResponseFor401(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor401ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_401 = api_client.OpenApiResponse( + response_cls=ApiResponseFor401, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), + }, +) SchemaFor403ResponseBodyApplicationJson = ExceptionResponse @@ -119,6 +138,7 @@ class ApiResponseFor403(api_client.ApiResponse): _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, + '401': _response_for_401, '403': _response_for_403, } _all_accept_content_types = ( diff --git a/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi index 2033be9d..f829f7b9 100644 --- a/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi +++ b/python/apollo_openapi/paths/openapi_v1_users_user_id/get.pyi @@ -92,6 +92,25 @@ _response_for_400 = api_client.OpenApiResponse( schema=SchemaFor400ResponseBodyApplicationJson), }, ) +SchemaFor401ResponseBodyApplicationJson = ExceptionResponse + + +@dataclass +class ApiResponseFor401(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor401ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_401 = api_client.OpenApiResponse( + response_cls=ApiResponseFor401, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), + }, +) SchemaFor403ResponseBodyApplicationJson = ExceptionResponse diff --git a/python/docs/apis/tags/PortalManagementApi.md b/python/docs/apis/tags/PortalManagementApi.md index 00cd908c..0ba39a1f 100644 --- a/python/docs/apis/tags/PortalManagementApi.md +++ b/python/docs/apis/tags/PortalManagementApi.md @@ -2975,7 +2975,7 @@ dict, frozendict.frozendict, | frozendict.frozendict, | | # **get_consumer_list** -> [OpenConsumerInfoDTO] get_consumer_list() +> [OpenConsumerSummaryDTO] get_consumer_list() 查询开放平台消费者列表(new added) @@ -2987,7 +2987,7 @@ GET /openapi/v1/consumers ```python import apollo_openapi from apollo_openapi.apis.tags import portal_management_api -from apollo_openapi.model.open_consumer_info_dto import OpenConsumerInfoDTO +from apollo_openapi.model.open_consumer_summary_dto import OpenConsumerSummaryDTO 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. @@ -3081,7 +3081,7 @@ list, tuple, | tuple, | | ### Tuple Items Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -[**OpenConsumerInfoDTO**]({{complexTypePrefix}}OpenConsumerInfoDTO.md) | [**OpenConsumerInfoDTO**]({{complexTypePrefix}}OpenConsumerInfoDTO.md) | [**OpenConsumerInfoDTO**]({{complexTypePrefix}}OpenConsumerInfoDTO.md) | | +[**OpenConsumerSummaryDTO**]({{complexTypePrefix}}OpenConsumerSummaryDTO.md) | [**OpenConsumerSummaryDTO**]({{complexTypePrefix}}OpenConsumerSummaryDTO.md) | [**OpenConsumerSummaryDTO**]({{complexTypePrefix}}OpenConsumerSummaryDTO.md) | | ### Authorization diff --git a/python/docs/apis/tags/UserManagementApi.md b/python/docs/apis/tags/UserManagementApi.md index 453f9c22..1672e29f 100644 --- a/python/docs/apis/tags/UserManagementApi.md +++ b/python/docs/apis/tags/UserManagementApi.md @@ -525,6 +525,7 @@ Code | Class | Description n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned 200 | [ApiResponseFor200](#get_user_by_user_id.ApiResponseFor200) | 成功获取用户 400 | [ApiResponseFor400](#get_user_by_user_id.ApiResponseFor400) | 请求参数错误或用户不存在 +401 | [ApiResponseFor401](#get_user_by_user_id.ApiResponseFor401) | 未登录或未认证 403 | [ApiResponseFor403](#get_user_by_user_id.ApiResponseFor403) | 权限不足 #### get_user_by_user_id.ApiResponseFor200 @@ -553,6 +554,19 @@ Type | Description | Notes [**ExceptionResponse**](../../models/ExceptionResponse.md) | | +#### get_user_by_user_id.ApiResponseFor401 +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +response | urllib3.HTTPResponse | Raw response | +body | typing.Union[SchemaFor401ResponseBodyApplicationJson, ] | | +headers | Unset | headers were not defined | + +# SchemaFor401ResponseBodyApplicationJson +Type | Description | Notes +------------- | ------------- | ------------- +[**ExceptionResponse**](../../models/ExceptionResponse.md) | | + + #### get_user_by_user_id.ApiResponseFor403 Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- diff --git a/python/docs/models/OpenConsumerSummaryDTO.md b/python/docs/models/OpenConsumerSummaryDTO.md new file mode 100644 index 00000000..08268ad3 --- /dev/null +++ b/python/docs/models/OpenConsumerSummaryDTO.md @@ -0,0 +1,24 @@ +# apollo_openapi.model.open_consumer_summary_dto.OpenConsumerSummaryDTO + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +dict, frozendict.frozendict, | frozendict.frozendict, | | + +### Dictionary Keys +Key | Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**appId** | str, | str, | 第三方应用ID | [optional] +**name** | str, | str, | 第三方应用名称 | [optional] +**orgId** | str, | str, | 部门ID | [optional] +**orgName** | str, | str, | 部门名称 | [optional] +**ownerName** | str, | str, | 负责人用户名 | [optional] +**ownerEmail** | str, | str, | 负责人邮箱 | [optional] +**consumerId** | decimal.Decimal, int, | decimal.Decimal, | Consumer ID | [optional] value must be a 64 bit integer +**allowCreateApplication** | bool, | BoolClass, | 是否允许该Consumer Token创建应用 | [optional] if omitted the server will use the default value of False +**allowManageUsers** | bool, | BoolClass, | 是否允许该Consumer Token管理用户 | [optional] if omitted the server will use the default value of False +**rateLimit** | decimal.Decimal, int, | decimal.Decimal, | 限流QPS,0表示不限流 | [optional] if omitted the server will use the default value of 0 +**rateLimitEnabled** | bool, | BoolClass, | 是否开启限流 | [optional] if omitted the server will use the default value of False +**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_models/test_open_consumer_summary_dto.py b/python/test/test_models/test_open_consumer_summary_dto.py new file mode 100644 index 00000000..76399f12 --- /dev/null +++ b/python/test/test_models/test_open_consumer_summary_dto.py @@ -0,0 +1,24 @@ +# 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 + + Generated by: https://openapi-generator.tech +""" + +import unittest + +import apollo_openapi +from apollo_openapi.model.open_consumer_summary_dto import OpenConsumerSummaryDTO +from apollo_openapi import configuration + + +class TestOpenConsumerSummaryDTO(unittest.TestCase): + """OpenConsumerSummaryDTO unit test stubs""" + _configuration = configuration.Configuration() + + +if __name__ == '__main__': + unittest.main() diff --git a/rust/.openapi-generator/FILES b/rust/.openapi-generator/FILES index a7e986dd..6e635f7d 100644 --- a/rust/.openapi-generator/FILES +++ b/rust/.openapi-generator/FILES @@ -14,6 +14,7 @@ docs/OpenClusterDto.md docs/OpenClusterNamespaceRoleUserDto.md docs/OpenConsumerCreateRequestDto.md docs/OpenConsumerInfoDto.md +docs/OpenConsumerSummaryDto.md docs/OpenCreateAppDto.md docs/OpenCreateNamespaceDto.md docs/OpenEnvClusterDto.md @@ -60,6 +61,7 @@ src/models/open_cluster_dto.rs src/models/open_cluster_namespace_role_user_dto.rs src/models/open_consumer_create_request_dto.rs src/models/open_consumer_info_dto.rs +src/models/open_consumer_summary_dto.rs src/models/open_create_app_dto.rs src/models/open_create_namespace_dto.rs src/models/open_env_cluster_dto.rs diff --git a/rust/README.md b/rust/README.md index 812caf4a..ba71cf00 100644 --- a/rust/README.md +++ b/rust/README.md @@ -55,6 +55,7 @@ Class | Method | HTTP request | Description - [OpenClusterNamespaceRoleUserDto](docs/OpenClusterNamespaceRoleUserDto.md) - [OpenConsumerCreateRequestDto](docs/OpenConsumerCreateRequestDto.md) - [OpenConsumerInfoDto](docs/OpenConsumerInfoDto.md) + - [OpenConsumerSummaryDto](docs/OpenConsumerSummaryDto.md) - [OpenCreateAppDto](docs/OpenCreateAppDto.md) - [OpenCreateNamespaceDto](docs/OpenCreateNamespaceDto.md) - [OpenEnvClusterDto](docs/OpenEnvClusterDto.md) diff --git a/rust/docs/OpenConsumerSummaryDto.md b/rust/docs/OpenConsumerSummaryDto.md new file mode 100644 index 00000000..a8469f06 --- /dev/null +++ b/rust/docs/OpenConsumerSummaryDto.md @@ -0,0 +1,19 @@ +# OpenConsumerSummaryDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_id** | Option<**String**> | 第三方应用ID | [optional] +**name** | Option<**String**> | 第三方应用名称 | [optional] +**org_id** | Option<**String**> | 部门ID | [optional] +**org_name** | Option<**String**> | 部门名称 | [optional] +**owner_name** | Option<**String**> | 负责人用户名 | [optional] +**owner_email** | Option<**String**> | 负责人邮箱 | [optional] +**consumer_id** | Option<**i64**> | Consumer ID | [optional] +**allow_create_application** | Option<**bool**> | 是否允许该Consumer Token创建应用 | [optional][default to false] +**allow_manage_users** | Option<**bool**> | 是否允许该Consumer Token管理用户 | [optional][default to false] +**rate_limit** | Option<**i32**> | 限流QPS,0表示不限流 | [optional][default to 0] +**rate_limit_enabled** | Option<**bool**> | 是否开启限流 | [optional][default to false] + +[[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/mod.rs b/rust/src/models/mod.rs index 79cd150e..3be8d585 100644 --- a/rust/src/models/mod.rs +++ b/rust/src/models/mod.rs @@ -20,6 +20,8 @@ pub mod open_consumer_create_request_dto; pub use self::open_consumer_create_request_dto::OpenConsumerCreateRequestDto; pub mod open_consumer_info_dto; pub use self::open_consumer_info_dto::OpenConsumerInfoDto; +pub mod open_consumer_summary_dto; +pub use self::open_consumer_summary_dto::OpenConsumerSummaryDto; pub mod open_create_app_dto; pub use self::open_create_app_dto::OpenCreateAppDto; pub mod open_create_namespace_dto; diff --git a/rust/src/models/open_consumer_summary_dto.rs b/rust/src/models/open_consumer_summary_dto.rs new file mode 100644 index 00000000..71d54983 --- /dev/null +++ b/rust/src/models/open_consumer_summary_dto.rs @@ -0,0 +1,66 @@ +/* + * 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\"
+ * + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct OpenConsumerSummaryDto { + /// 第三方应用ID + #[serde(rename = "appId", skip_serializing_if = "Option::is_none")] + pub app_id: Option, + /// 第三方应用名称 + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// 部门ID + #[serde(rename = "orgId", skip_serializing_if = "Option::is_none")] + pub org_id: Option, + /// 部门名称 + #[serde(rename = "orgName", skip_serializing_if = "Option::is_none")] + pub org_name: Option, + /// 负责人用户名 + #[serde(rename = "ownerName", skip_serializing_if = "Option::is_none")] + pub owner_name: Option, + /// 负责人邮箱 + #[serde(rename = "ownerEmail", skip_serializing_if = "Option::is_none")] + pub owner_email: Option, + /// Consumer ID + #[serde(rename = "consumerId", skip_serializing_if = "Option::is_none")] + pub consumer_id: Option, + /// 是否允许该Consumer Token创建应用 + #[serde(rename = "allowCreateApplication", skip_serializing_if = "Option::is_none")] + pub allow_create_application: Option, + /// 是否允许该Consumer Token管理用户 + #[serde(rename = "allowManageUsers", skip_serializing_if = "Option::is_none")] + pub allow_manage_users: Option, + /// 限流QPS,0表示不限流 + #[serde(rename = "rateLimit", skip_serializing_if = "Option::is_none")] + pub rate_limit: Option, + /// 是否开启限流 + #[serde(rename = "rateLimitEnabled", skip_serializing_if = "Option::is_none")] + pub rate_limit_enabled: Option, +} + +impl OpenConsumerSummaryDto { + pub fn new() -> OpenConsumerSummaryDto { + OpenConsumerSummaryDto { + app_id: None, + name: None, + org_id: None, + org_name: None, + owner_name: None, + owner_email: None, + consumer_id: None, + allow_create_application: None, + allow_manage_users: None, + rate_limit: None, + rate_limit_enabled: None, + } + } +} diff --git a/spring-boot2/.openapi-generator/FILES b/spring-boot2/.openapi-generator/FILES index e0bd9dd3..83a4e864 100644 --- a/spring-boot2/.openapi-generator/FILES +++ b/spring-boot2/.openapi-generator/FILES @@ -62,6 +62,7 @@ src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java src/main/java/com/apollo/openapi/server/model/OpenClusterNamespaceRoleUserDTO.java src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java +src/main/java/com/apollo/openapi/server/model/OpenConsumerSummaryDTO.java src/main/java/com/apollo/openapi/server/model/OpenCreateAppDTO.java src/main/java/com/apollo/openapi/server/model/OpenCreateNamespaceDTO.java src/main/java/com/apollo/openapi/server/model/OpenEnvClusterDTO.java diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java index 9d057a84..e05674b9 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApi.java @@ -7,6 +7,7 @@ import com.apollo.openapi.server.model.OpenConsumerCreateRequestDTO; import com.apollo.openapi.server.model.OpenConsumerInfoDTO; +import com.apollo.openapi.server.model.OpenConsumerSummaryDTO; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -907,7 +908,7 @@ default ResponseEntity getAuditProperties( tags = { "Portal Management" }, responses = { @ApiResponse(responseCode = "200", description = "成功获取消费者列表", content = { - @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OpenConsumerInfoDTO.class))) + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = OpenConsumerSummaryDTO.class))) }) }, security = { @@ -919,7 +920,7 @@ default ResponseEntity getAuditProperties( value = "/openapi/v1/consumers", produces = { "application/json" } ) - default ResponseEntity> getConsumerList( + default ResponseEntity> getConsumerList( @Parameter(name = "page", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @Parameter(name = "size", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "size", required = false, defaultValue = "10") Integer size ) { diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java index 2e79d69c..85d9f097 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiController.java @@ -2,6 +2,7 @@ import com.apollo.openapi.server.model.OpenConsumerCreateRequestDTO; import com.apollo.openapi.server.model.OpenConsumerInfoDTO; +import com.apollo.openapi.server.model.OpenConsumerSummaryDTO; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java index f7d87004..fdbf9df5 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/PortalManagementApiDelegate.java @@ -2,6 +2,7 @@ import com.apollo.openapi.server.model.OpenConsumerCreateRequestDTO; import com.apollo.openapi.server.model.OpenConsumerInfoDTO; +import com.apollo.openapi.server.model.OpenConsumerSummaryDTO; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -109,7 +110,7 @@ default ResponseEntity createConsumer(OpenConsumerCreateReq getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; + String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 0, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } @@ -516,12 +517,12 @@ default ResponseEntity getAuditProperties() { * @return 成功获取消费者列表 (status code 200) * @see PortalManagementApi#getConsumerList */ - default ResponseEntity> getConsumerList(Integer page, + default ResponseEntity> getConsumerList(Integer page, Integer size) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "[ { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }, { \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" } ]"; + String exampleString = "[ { \"orgName\" : \"orgName\", \"rateLimit\" : 0, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\" }, { \"orgName\" : \"orgName\", \"rateLimit\" : 0, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\" } ]"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } @@ -543,7 +544,7 @@ default ResponseEntity getConsumerTokenByAppId(String appId getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 6, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; + String exampleString = "{ \"orgName\" : \"orgName\", \"rateLimit\" : 0, \"ownerName\" : \"ownerName\", \"consumerId\" : 0, \"appId\" : \"appId\", \"name\" : \"name\", \"allowCreateApplication\" : false, \"allowManageUsers\" : false, \"rateLimitEnabled\" : false, \"orgId\" : \"orgId\", \"ownerEmail\" : \"ownerEmail\", \"token\" : \"token\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java index f0b22c27..89a9bea1 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApi.java @@ -172,6 +172,7 @@ default ResponseEntity getCurrentUser( * @param userId 用户ID (required) * @return 成功获取用户 (status code 200) * or 请求参数错误或用户不存在 (status code 400) + * or 未登录或未认证 (status code 401) * or 权限不足 (status code 403) */ @Operation( @@ -186,6 +187,9 @@ default ResponseEntity getCurrentUser( @ApiResponse(responseCode = "400", description = "请求参数错误或用户不存在", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) }), + @ApiResponse(responseCode = "401", description = "未登录或未认证", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) + }), @ApiResponse(responseCode = "403", description = "权限不足", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class)) }) diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java index ef75415f..c80b8111 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/api/UserManagementApiDelegate.java @@ -15,7 +15,7 @@ import javax.annotation.Generated; /** - * A delegate to be called by the {@link UserManagementApiController}}. + * A delegate to be called by the {@link UserManagementApiController}. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. */ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @@ -91,6 +91,7 @@ default ResponseEntity getCurrentUser() { * @param userId 用户ID (required) * @return 成功获取用户 (status code 200) * or 请求参数错误或用户不存在 (status code 400) + * or 未登录或未认证 (status code 401) * or 权限不足 (status code 403) * @see UserManagementApi#getUserByUserId */ diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java index abf8a4b7..b10b42b2 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerCreateRequestDTO.java @@ -206,9 +206,10 @@ public OpenConsumerCreateRequestDTO rateLimit(Integer rateLimit) { /** * 限流QPS,0表示不限流 + * minimum: 0 * @return rateLimit */ - + @Min(0) @Schema(name = "rateLimit", description = "限流QPS,0表示不限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("rateLimit") public Integer getRateLimit() { diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java index 217f6b48..a64ee711 100644 --- a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java @@ -252,9 +252,10 @@ public OpenConsumerInfoDTO rateLimit(Integer rateLimit) { /** * 限流QPS,0表示不限流 + * minimum: 0 * @return rateLimit */ - + @Min(0) @Schema(name = "rateLimit", description = "限流QPS,0表示不限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("rateLimit") public Integer getRateLimit() { @@ -324,7 +325,7 @@ public String toString() { sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); sb.append(" ownerEmail: ").append(toIndentedString(ownerEmail)).append("\n"); sb.append(" consumerId: ").append(toIndentedString(consumerId)).append("\n"); - sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" token: ").append(token == null ? "null" : "***redacted***").append("\n"); sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); diff --git a/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerSummaryDTO.java b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerSummaryDTO.java new file mode 100644 index 00000000..123ba6e4 --- /dev/null +++ b/spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerSummaryDTO.java @@ -0,0 +1,323 @@ +package com.apollo.openapi.server.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OpenConsumerSummaryDTO + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class OpenConsumerSummaryDTO { + + private String appId; + + private String name; + + private String orgId; + + private String orgName; + + private String ownerName; + + private String ownerEmail; + + private Long consumerId; + + private Boolean allowCreateApplication = false; + + private Boolean allowManageUsers = false; + + private Integer rateLimit = 0; + + private Boolean rateLimitEnabled = false; + + public OpenConsumerSummaryDTO appId(String appId) { + this.appId = appId; + return this; + } + + /** + * 第三方应用ID + * @return appId + */ + + @Schema(name = "appId", description = "第三方应用ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("appId") + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public OpenConsumerSummaryDTO name(String name) { + this.name = name; + return this; + } + + /** + * 第三方应用名称 + * @return name + */ + + @Schema(name = "name", description = "第三方应用名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public OpenConsumerSummaryDTO orgId(String orgId) { + this.orgId = orgId; + return this; + } + + /** + * 部门ID + * @return orgId + */ + + @Schema(name = "orgId", description = "部门ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public OpenConsumerSummaryDTO orgName(String orgName) { + this.orgName = orgName; + return this; + } + + /** + * 部门名称 + * @return orgName + */ + + @Schema(name = "orgName", description = "部门名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("orgName") + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public OpenConsumerSummaryDTO ownerName(String ownerName) { + this.ownerName = ownerName; + return this; + } + + /** + * 负责人用户名 + * @return ownerName + */ + + @Schema(name = "ownerName", description = "负责人用户名", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("ownerName") + public String getOwnerName() { + return ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public OpenConsumerSummaryDTO ownerEmail(String ownerEmail) { + this.ownerEmail = ownerEmail; + return this; + } + + /** + * 负责人邮箱 + * @return ownerEmail + */ + + @Schema(name = "ownerEmail", description = "负责人邮箱", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("ownerEmail") + public String getOwnerEmail() { + return ownerEmail; + } + + public void setOwnerEmail(String ownerEmail) { + this.ownerEmail = ownerEmail; + } + + public OpenConsumerSummaryDTO consumerId(Long consumerId) { + this.consumerId = consumerId; + return this; + } + + /** + * Consumer ID + * @return consumerId + */ + + @Schema(name = "consumerId", description = "Consumer ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("consumerId") + public Long getConsumerId() { + return consumerId; + } + + public void setConsumerId(Long consumerId) { + this.consumerId = consumerId; + } + + public OpenConsumerSummaryDTO allowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + return this; + } + + /** + * 是否允许该Consumer Token创建应用 + * @return allowCreateApplication + */ + + @Schema(name = "allowCreateApplication", description = "是否允许该Consumer Token创建应用", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("allowCreateApplication") + public Boolean getAllowCreateApplication() { + return allowCreateApplication; + } + + public void setAllowCreateApplication(Boolean allowCreateApplication) { + this.allowCreateApplication = allowCreateApplication; + } + + public OpenConsumerSummaryDTO allowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + return this; + } + + /** + * 是否允许该Consumer Token管理用户 + * @return allowManageUsers + */ + + @Schema(name = "allowManageUsers", description = "是否允许该Consumer Token管理用户", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("allowManageUsers") + public Boolean getAllowManageUsers() { + return allowManageUsers; + } + + public void setAllowManageUsers(Boolean allowManageUsers) { + this.allowManageUsers = allowManageUsers; + } + + public OpenConsumerSummaryDTO rateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + return this; + } + + /** + * 限流QPS,0表示不限流 + * minimum: 0 + * @return rateLimit + */ + @Min(0) + @Schema(name = "rateLimit", description = "限流QPS,0表示不限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("rateLimit") + public Integer getRateLimit() { + return rateLimit; + } + + public void setRateLimit(Integer rateLimit) { + this.rateLimit = rateLimit; + } + + public OpenConsumerSummaryDTO rateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + return this; + } + + /** + * 是否开启限流 + * @return rateLimitEnabled + */ + + @Schema(name = "rateLimitEnabled", description = "是否开启限流", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("rateLimitEnabled") + public Boolean getRateLimitEnabled() { + return rateLimitEnabled; + } + + public void setRateLimitEnabled(Boolean rateLimitEnabled) { + this.rateLimitEnabled = rateLimitEnabled; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenConsumerSummaryDTO openConsumerSummaryDTO = (OpenConsumerSummaryDTO) o; + return Objects.equals(this.appId, openConsumerSummaryDTO.appId) && + Objects.equals(this.name, openConsumerSummaryDTO.name) && + Objects.equals(this.orgId, openConsumerSummaryDTO.orgId) && + Objects.equals(this.orgName, openConsumerSummaryDTO.orgName) && + Objects.equals(this.ownerName, openConsumerSummaryDTO.ownerName) && + Objects.equals(this.ownerEmail, openConsumerSummaryDTO.ownerEmail) && + Objects.equals(this.consumerId, openConsumerSummaryDTO.consumerId) && + Objects.equals(this.allowCreateApplication, openConsumerSummaryDTO.allowCreateApplication) && + Objects.equals(this.allowManageUsers, openConsumerSummaryDTO.allowManageUsers) && + Objects.equals(this.rateLimit, openConsumerSummaryDTO.rateLimit) && + Objects.equals(this.rateLimitEnabled, openConsumerSummaryDTO.rateLimitEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(appId, name, orgId, orgName, ownerName, ownerEmail, consumerId, allowCreateApplication, allowManageUsers, rateLimit, rateLimitEnabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenConsumerSummaryDTO {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" ownerEmail: ").append(toIndentedString(ownerEmail)).append("\n"); + sb.append(" consumerId: ").append(toIndentedString(consumerId)).append("\n"); + sb.append(" allowCreateApplication: ").append(toIndentedString(allowCreateApplication)).append("\n"); + sb.append(" allowManageUsers: ").append(toIndentedString(allowManageUsers)).append("\n"); + sb.append(" rateLimit: ").append(toIndentedString(rateLimit)).append("\n"); + sb.append(" rateLimitEnabled: ").append(toIndentedString(rateLimitEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/spring-boot2/src/main/resources/openapi.yaml b/spring-boot2/src/main/resources/openapi.yaml index 0a8c868f..41204497 100644 --- a/spring-boot2/src/main/resources/openapi.yaml +++ b/spring-boot2/src/main/resources/openapi.yaml @@ -5975,6 +5975,12 @@ paths: schema: $ref: '#/components/schemas/ExceptionResponse' description: 请求参数错误或用户不存在 + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ExceptionResponse' + description: 未登录或未认证 "403": content: application/json: @@ -6391,7 +6397,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/OpenConsumerInfoDTO' + $ref: '#/components/schemas/OpenConsumerSummaryDTO' type: array description: 成功获取消费者列表 summary: 查询开放平台消费者列表(new added) @@ -8703,12 +8709,13 @@ components: rateLimit: default: 0 description: 限流QPS,0表示不限流 + minimum: 0 type: integer type: object OpenConsumerInfoDTO: example: orgName: orgName - rateLimit: 6 + rateLimit: 0 ownerName: ownerName consumerId: 0 appId: appId @@ -8756,6 +8763,61 @@ components: rateLimit: default: 0 description: 限流QPS,0表示不限流 + minimum: 0 + type: integer + rateLimitEnabled: + default: false + description: 是否开启限流 + type: boolean + type: object + OpenConsumerSummaryDTO: + example: + orgName: orgName + rateLimit: 0 + ownerName: ownerName + consumerId: 0 + appId: appId + name: name + allowCreateApplication: false + allowManageUsers: false + rateLimitEnabled: false + orgId: orgId + ownerEmail: ownerEmail + properties: + appId: + description: 第三方应用ID + type: string + name: + description: 第三方应用名称 + type: string + orgId: + description: 部门ID + type: string + orgName: + description: 部门名称 + type: string + ownerName: + description: 负责人用户名 + type: string + ownerEmail: + description: 负责人邮箱 + type: string + consumerId: + description: Consumer ID + format: int64 + type: integer + allowCreateApplication: + default: false + description: 是否允许该Consumer Token创建应用 + type: boolean + allowManageUsers: + default: false + description: 是否允许该Consumer Token管理用户 + type: boolean + rateLimit: + default: 0 + description: 限流QPS,0表示不限流 + minimum: 0 type: integer rateLimitEnabled: default: false diff --git a/tests/test_user_management_contract.py b/tests/test_user_management_contract.py index 2f687555..dc808f89 100644 --- a/tests/test_user_management_contract.py +++ b/tests/test_user_management_contract.py @@ -1,3 +1,4 @@ +import re import unittest from pathlib import Path @@ -79,7 +80,7 @@ def test_consumer_management_uses_typed_schemas_with_manage_users_flag(self): list_consumers = spec["paths"]["/openapi/v1/consumers"]["get"] self.assertEqual( - "#/components/schemas/OpenConsumerInfoDTO", + "#/components/schemas/OpenConsumerSummaryDTO", list_consumers["responses"]["200"]["content"]["application/json"]["schema"]["items"]["$ref"], ) @@ -89,12 +90,16 @@ def test_consumer_management_uses_typed_schemas_with_manage_users_flag(self): consumer_token["responses"]["200"]["content"]["application/json"]["schema"]["$ref"], ) - for schema_name in ("OpenConsumerCreateRequestDTO", "OpenConsumerInfoDTO"): + for schema_name in ( + "OpenConsumerCreateRequestDTO", "OpenConsumerInfoDTO", "OpenConsumerSummaryDTO"): properties = schemas[schema_name]["properties"] self.assertEqual("boolean", properties["allowCreateApplication"]["type"]) self.assertEqual("boolean", properties["allowManageUsers"]["type"]) + self.assertEqual(0, properties["rateLimit"]["minimum"]) self.assertEqual("boolean", schemas["OpenConsumerInfoDTO"]["properties"]["rateLimitEnabled"]["type"]) + self.assertNotIn("token", schemas["OpenConsumerSummaryDTO"]["properties"]) + self.assertIn("token", schemas["OpenConsumerInfoDTO"]["properties"]) def test_spring_server_api_uses_user_management_name(self): api_dir = self.repo_root / "spring-boot2/src/main/java/com/apollo/openapi/server/api" @@ -112,6 +117,28 @@ def test_java_client_preserves_optional_operator_overloads(self): "createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException", content) + def test_consumer_java_models_handle_null_json_and_redact_tokens(self): + model_dir = self.repo_root / "java-client/src/main/java/org/openapitools/client/model" + for model_name in ( + "OpenConsumerCreateRequestDTO", "OpenConsumerInfoDTO", "OpenConsumerSummaryDTO"): + content = (model_dir / f"{model_name}.java").read_text(encoding="utf-8") + + with self.subTest(model=model_name): + self.assertRegex(content, re.compile( + r"if \(jsonObj == null\) \{.*?return;.*?\}\s+" + r"Set> entries = jsonObj\.entrySet\(\);", + re.DOTALL)) + + client_info = (model_dir / "OpenConsumerInfoDTO.java").read_text(encoding="utf-8") + self.assertIn('token == null ? "null" : "***redacted***"', client_info) + self.assertNotIn('token: ").append(toIndentedString(token))', client_info) + + spring_info = (self.repo_root / + "spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenConsumerInfoDTO.java" + ).read_text(encoding="utf-8") + self.assertIn('token == null ? "null" : "***redacted***"', spring_info) + self.assertNotIn('token: ").append(toIndentedString(token))', spring_info) + def _find_parameter(self, operation, name): for parameter in operation.get("parameters", ()): if parameter.get("name") == name: diff --git a/typescript/.openapi-generator/FILES b/typescript/.openapi-generator/FILES index d39bc0fc..e690bb3d 100644 --- a/typescript/.openapi-generator/FILES +++ b/typescript/.openapi-generator/FILES @@ -31,6 +31,7 @@ src/models/OpenClusterDTO.ts src/models/OpenClusterNamespaceRoleUserDTO.ts src/models/OpenConsumerCreateRequestDTO.ts src/models/OpenConsumerInfoDTO.ts +src/models/OpenConsumerSummaryDTO.ts src/models/OpenCreateAppDTO.ts src/models/OpenCreateNamespaceDTO.ts src/models/OpenEnvClusterDTO.ts diff --git a/typescript/src/apis/PortalManagementApi.ts b/typescript/src/apis/PortalManagementApi.ts index 6e9a5786..585762ba 100644 --- a/typescript/src/apis/PortalManagementApi.ts +++ b/typescript/src/apis/PortalManagementApi.ts @@ -16,12 +16,15 @@ import * as runtime from '../runtime'; import type { OpenConsumerCreateRequestDTO, OpenConsumerInfoDTO, + OpenConsumerSummaryDTO, } from '../models'; import { OpenConsumerCreateRequestDTOFromJSON, OpenConsumerCreateRequestDTOToJSON, OpenConsumerInfoDTOFromJSON, OpenConsumerInfoDTOToJSON, + OpenConsumerSummaryDTOFromJSON, + OpenConsumerSummaryDTOToJSON, } from '../models'; export interface AddFavoriteRequest { @@ -1278,7 +1281,7 @@ export class PortalManagementApi extends runtime.BaseAPI { * GET /openapi/v1/consumers * 查询开放平台消费者列表(new added) */ - async getConsumerListRaw(requestParameters: GetConsumerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async getConsumerListRaw(requestParameters: GetConsumerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { const queryParameters: any = {}; if (requestParameters.page !== undefined) { @@ -1302,14 +1305,14 @@ export class PortalManagementApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(OpenConsumerInfoDTOFromJSON)); + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(OpenConsumerSummaryDTOFromJSON)); } /** * GET /openapi/v1/consumers * 查询开放平台消费者列表(new added) */ - async getConsumerList(requestParameters: GetConsumerListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getConsumerList(requestParameters: GetConsumerListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getConsumerListRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/typescript/src/models/OpenConsumerSummaryDTO.ts b/typescript/src/models/OpenConsumerSummaryDTO.ts new file mode 100644 index 00000000..83d3a620 --- /dev/null +++ b/typescript/src/models/OpenConsumerSummaryDTO.ts @@ -0,0 +1,143 @@ +/* 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\"
+ * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface OpenConsumerSummaryDTO + */ +export interface OpenConsumerSummaryDTO { + /** + * 第三方应用ID + * @type {string} + * @memberof OpenConsumerSummaryDTO + */ + appId?: string; + /** + * 第三方应用名称 + * @type {string} + * @memberof OpenConsumerSummaryDTO + */ + name?: string; + /** + * 部门ID + * @type {string} + * @memberof OpenConsumerSummaryDTO + */ + orgId?: string; + /** + * 部门名称 + * @type {string} + * @memberof OpenConsumerSummaryDTO + */ + orgName?: string; + /** + * 负责人用户名 + * @type {string} + * @memberof OpenConsumerSummaryDTO + */ + ownerName?: string; + /** + * 负责人邮箱 + * @type {string} + * @memberof OpenConsumerSummaryDTO + */ + ownerEmail?: string; + /** + * Consumer ID + * @type {number} + * @memberof OpenConsumerSummaryDTO + */ + consumerId?: number; + /** + * 是否允许该Consumer Token创建应用 + * @type {boolean} + * @memberof OpenConsumerSummaryDTO + */ + allowCreateApplication?: boolean; + /** + * 是否允许该Consumer Token管理用户 + * @type {boolean} + * @memberof OpenConsumerSummaryDTO + */ + allowManageUsers?: boolean; + /** + * 限流QPS,0表示不限流 + * @type {number} + * @memberof OpenConsumerSummaryDTO + */ + rateLimit?: number; + /** + * 是否开启限流 + * @type {boolean} + * @memberof OpenConsumerSummaryDTO + */ + rateLimitEnabled?: boolean; +} + +/** + * Check if a given object implements the OpenConsumerSummaryDTO interface. + */ +export function instanceOfOpenConsumerSummaryDTO(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function OpenConsumerSummaryDTOFromJSON(json: any): OpenConsumerSummaryDTO { + return OpenConsumerSummaryDTOFromJSONTyped(json, false); +} + +export function OpenConsumerSummaryDTOFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenConsumerSummaryDTO { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'appId': !exists(json, 'appId') ? undefined : json['appId'], + 'name': !exists(json, 'name') ? undefined : json['name'], + 'orgId': !exists(json, 'orgId') ? undefined : json['orgId'], + 'orgName': !exists(json, 'orgName') ? undefined : json['orgName'], + 'ownerName': !exists(json, 'ownerName') ? undefined : json['ownerName'], + 'ownerEmail': !exists(json, 'ownerEmail') ? undefined : json['ownerEmail'], + 'consumerId': !exists(json, 'consumerId') ? undefined : json['consumerId'], + 'allowCreateApplication': !exists(json, 'allowCreateApplication') ? undefined : json['allowCreateApplication'], + 'allowManageUsers': !exists(json, 'allowManageUsers') ? undefined : json['allowManageUsers'], + 'rateLimit': !exists(json, 'rateLimit') ? undefined : json['rateLimit'], + 'rateLimitEnabled': !exists(json, 'rateLimitEnabled') ? undefined : json['rateLimitEnabled'], + }; +} + +export function OpenConsumerSummaryDTOToJSON(value?: OpenConsumerSummaryDTO | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'appId': value.appId, + 'name': value.name, + 'orgId': value.orgId, + 'orgName': value.orgName, + 'ownerName': value.ownerName, + 'ownerEmail': value.ownerEmail, + 'consumerId': value.consumerId, + 'allowCreateApplication': value.allowCreateApplication, + 'allowManageUsers': value.allowManageUsers, + 'rateLimit': value.rateLimit, + 'rateLimitEnabled': value.rateLimitEnabled, + }; +} diff --git a/typescript/src/models/index.ts b/typescript/src/models/index.ts index 9d440ed3..d0d8de59 100644 --- a/typescript/src/models/index.ts +++ b/typescript/src/models/index.ts @@ -11,6 +11,7 @@ export * from './OpenClusterDTO'; export * from './OpenClusterNamespaceRoleUserDTO'; export * from './OpenConsumerCreateRequestDTO'; export * from './OpenConsumerInfoDTO'; +export * from './OpenConsumerSummaryDTO'; export * from './OpenCreateAppDTO'; export * from './OpenCreateNamespaceDTO'; export * from './OpenEnvClusterDTO';