From 814ea98f4c6b28b13c8b9680cd02569cc91442ca Mon Sep 17 00:00:00 2001 From: bennychen Date: Thu, 9 Oct 2025 20:29:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=93=9D=E9=B2=B8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=BA=94=E7=94=A8=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/data/api-resources.yml | 28 +++++++++++++++++++ .../services/bpf_service/urls.py | 10 +++++++ 2 files changed, 38 insertions(+) diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/data/api-resources.yml b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/data/api-resources.yml index 1a425c5..edf3422 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/data/api-resources.yml +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/data/api-resources.yml @@ -89,6 +89,34 @@ paths: userVerifiedRequired: true appVerifiedRequired: false disabledStages: [] + /bk_plugin/openapi/: + x-bk-apigateway-method-any: + operationId: plugin_openapi + description: '' + tags: [] + responses: + default: + description: '' + x-bk-apigateway-resource: + isPublic: true + allowApplyPermission: true + matchSubpath: true + backend: + type: HTTP + method: any + {% if settings.BK_PLUGIN_APIGW_BACKEND_SUB_PATH %} + path: /{env.api_sub_path}bk_plugin/openapi/ + {% else %} + path: /bk_plugin/openapi/ + {% endif %} + matchSubpath: true + timeout: 0 + upstreams: {} + transformHeaders: {} + authConfig: + userVerifiedRequired: false + appVerifiedRequired: true + disabledStages: [] /callback/{token}/: post: operationId: callback diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/urls.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/urls.py index 0975ab4..7d8e248 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/urls.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/urls.py @@ -18,6 +18,7 @@ from bk_plugin_framework.envs import settings PLUGIN_API_URLS_MODULE = "bk_plugin.apis.urls" +PLUGIN_OPENAPI_URLS_MODULE = "bk_plugin.openapi.urls" urlpatterns = [ path(r"meta/", api.Meta.as_view()), @@ -40,3 +41,12 @@ else: sys.stdout.write("[!]plugin api urls module found\n") urlpatterns.append(path(r"plugin_api/", include(PLUGIN_API_URLS_MODULE))) + +# add plugin openapi +try: + importlib.import_module(PLUGIN_OPENAPI_URLS_MODULE) +except ModuleNotFoundError: + sys.stdout.write("[!]can not find plugin openapi urls module, skip it\n") +else: + sys.stdout.write("[!]plugin openapi urls module found\n") + urlpatterns.append(path(r"openapi/", include(PLUGIN_OPENAPI_URLS_MODULE)))