diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/callback.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/callback.py index b3c1fd5..3644465 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/callback.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/callback.py @@ -51,7 +51,7 @@ class PluginCallback(APIView): extensions=gen_apigateway_resource_config( is_public=True, allow_apply_permission=True, - user_verified_required=True, + user_verified_required=False, app_verified_required=True, resource_permission_required=True, description_en="plugin callback", diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/detail.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/detail.py index fc17fd0..09371e7 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/detail.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/detail.py @@ -69,6 +69,7 @@ class Detail(APIView): permission_classes = [permissions.AllowAny] @extend_schema( + exclude=True, summary="获取指定版本的插件详情", operation_id="plugin_detail", responses={200: standard_response_enveloper(DetailResponseSerializer)}, diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/invoke.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/invoke.py index 1afb59f..d1c874f 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/invoke.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/invoke.py @@ -66,7 +66,7 @@ class Invoke(APIView): extensions=gen_apigateway_resource_config( is_public=True, allow_apply_permission=True, - user_verified_required=True, + user_verified_required=False, app_verified_required=True, resource_permission_required=True, description_en="Invoke specific version plugin", diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/logs.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/logs.py index fa4acc1..adaeb82 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/logs.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/logs.py @@ -45,6 +45,7 @@ class Logs(APIView): permission_classes = [permissions.AllowAny] @extend_schema( + exclude=True, summary="获取插件执行日志", operation_id="plugin_logs", responses={200: standard_response_enveloper(LogsResponseSerializer)}, diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/meta.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/meta.py index 2126a56..4b027dc 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/meta.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/meta.py @@ -63,6 +63,7 @@ class Meta(APIView): permission_classes = [permissions.AllowAny] @extend_schema( + exclude=True, summary="获取插件元信息", operation_id="plugin_meta_info", responses={200: standard_response_enveloper(MetaResponseSerializer)}, diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/plugin_api_dispatch.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/plugin_api_dispatch.py index 2ed6036..c040b31 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/plugin_api_dispatch.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/plugin_api_dispatch.py @@ -87,7 +87,7 @@ class PluginAPIDispatch(APIView): extensions=gen_apigateway_resource_config( is_public=True, allow_apply_permission=True, - user_verified_required=True, + user_verified_required=False, app_verified_required=True, resource_permission_required=True, description_en="Plugin API dispatch", diff --git a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/schedule.py b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/schedule.py index 1d05161..031be58 100644 --- a/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/schedule.py +++ b/bk-plugin-framework/bk_plugin_framework/services/bpf_service/api/schedule.py @@ -56,6 +56,7 @@ class Schedule(APIView): permission_classes = [permissions.AllowAny] @extend_schema( + exclude=True, summary="获取插件调度详情", operation_id="plugin_schedule", parameters=[ScheduleParamsSerializer], 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 07c8dec..3021b07 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 @@ -23,10 +23,7 @@ urlpatterns = [ path(r"meta/", api.Meta.as_view()), path(r"detail/", api.Detail.as_view()), - path(r"invoke/", api.Invoke.as_view()), path(r"schedule/", api.Schedule.as_view()), - path(r"plugin_api_dispatch/", api.PluginAPIDispatch.as_view()), - path(r"callback//", api.PluginCallback.as_view()), ] # add log api diff --git a/runtime/bk-plugin-runtime/bk_plugin_runtime/config/default.py b/runtime/bk-plugin-runtime/bk_plugin_runtime/config/default.py index 31111d1..e21627f 100644 --- a/runtime/bk-plugin-runtime/bk_plugin_runtime/config/default.py +++ b/runtime/bk-plugin-runtime/bk_plugin_runtime/config/default.py @@ -238,37 +238,6 @@ def logging_addition_settings(logging_dict): } -def preprocessing_filter_internal_apis(endpoints): - """ - 预处理钩子:排除不需要注册到 API 网关的内部 API - """ - # 需要排除的 API 路径模式 - excluded_patterns = [ - "/bk_plugin/detail", - "/bk_plugin/meta", - "/bk_plugin/logs", - "/bk_plugin/schedule", - ] - filtered = [] - for path, path_regex, method, callback in endpoints: - # 检查路径是否匹配排除模式 - should_exclude = any(pattern in path for pattern in excluded_patterns) - if not should_exclude: - filtered.append((path, path_regex, method, callback)) - return filtered - - -# drf_spectacular settings -SPECTACULAR_SETTINGS = { - "TITLE": "BK Plugin API", - "DESCRIPTION": "蓝鲸插件服务 API", - "VERSION": "1.0.0", - # 预处理钩子:排除内部 API - "PREPROCESSING_HOOKS": [ - "bk_plugin_runtime.config.default.preprocessing_filter_internal_apis", - ], -} - # 网关是否公开,公开则其他开发者可见/可申请权限 BK_APIGW_IS_PUBLIC = str(env.bool("BK_APIGW_IS_PUBLIC", default=True)).lower() # if BK_APIGW_IS_OFFICIAL is True, the BK_APIGW_NAME should be start with `bk-` diff --git a/runtime/bk-plugin-runtime/bk_plugin_runtime/urls.py b/runtime/bk-plugin-runtime/bk_plugin_runtime/urls.py index 032a00b..56031a2 100644 --- a/runtime/bk-plugin-runtime/bk_plugin_runtime/urls.py +++ b/runtime/bk-plugin-runtime/bk_plugin_runtime/urls.py @@ -11,11 +11,13 @@ from django.conf import settings from django.contrib import admin -from django.urls import include, re_path +from django.urls import include, path, re_path from drf_yasg import openapi from drf_yasg.views import get_schema_view from rest_framework import permissions +from bk_plugin_framework.services.bpf_service import api + schema_view = get_schema_view( openapi.Info( title="PluginService API", @@ -27,6 +29,9 @@ urlpatterns = [ + path(r"plugin_api_dispatch/", api.PluginAPIDispatch.as_view()), + path(r"callback//", api.PluginCallback.as_view()), + path(r"invoke//", api.Invoke.as_view()), re_path(r"^admin/", admin.site.urls), re_path(r"^account/", include("blueapps.account.urls")), re_path(r"^i18n/", include("django.conf.urls.i18n")), diff --git a/template/{{cookiecutter.project_name}}/requirements.txt b/template/{{cookiecutter.project_name}}/requirements.txt index 1934066..5c69a31 100644 --- a/template/{{cookiecutter.project_name}}/requirements.txt +++ b/template/{{cookiecutter.project_name}}/requirements.txt @@ -26,4 +26,5 @@ opentelemetry-proto==1.25.0 opentelemetry-sdk==1.25.0 opentelemetry-semantic-conventions==0.46b0 opentelemetry-util-http==0.46b0 -# add your custom requirements below this line \ No newline at end of file +# add your custom requirements below this line +django-environ==0.11.2 \ No newline at end of file