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)))