Skip to content

Commit 818881c

Browse files
bennychendengyh
authored andcommitted
feat: 新增蓝鲸插件应用态接口
1 parent 772afa1 commit 818881c

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/data/api-resources.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,34 @@ paths:
8989
userVerifiedRequired: true
9090
appVerifiedRequired: false
9191
disabledStages: []
92+
/bk_plugin/openapi/:
93+
x-bk-apigateway-method-any:
94+
operationId: plugin_openapi
95+
description: ''
96+
tags: []
97+
responses:
98+
default:
99+
description: ''
100+
x-bk-apigateway-resource:
101+
isPublic: true
102+
allowApplyPermission: true
103+
matchSubpath: true
104+
backend:
105+
type: HTTP
106+
method: any
107+
{% if settings.BK_PLUGIN_APIGW_BACKEND_SUB_PATH %}
108+
path: /{env.api_sub_path}bk_plugin/openapi/
109+
{% else %}
110+
path: /bk_plugin/openapi/
111+
{% endif %}
112+
matchSubpath: true
113+
timeout: 0
114+
upstreams: {}
115+
transformHeaders: {}
116+
authConfig:
117+
userVerifiedRequired: false
118+
appVerifiedRequired: true
119+
disabledStages: []
92120
/callback/{token}/:
93121
post:
94122
operationId: callback

bk-plugin-framework/bk_plugin_framework/services/bpf_service/urls.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from bk_plugin_framework.envs import settings
1919

2020
PLUGIN_API_URLS_MODULE = "bk_plugin.apis.urls"
21+
PLUGIN_OPENAPI_URLS_MODULE = "bk_plugin.openapi.urls"
2122

2223
urlpatterns = [
2324
path(r"meta/", api.Meta.as_view()),
@@ -40,3 +41,12 @@
4041
else:
4142
sys.stdout.write("[!]plugin api urls module found\n")
4243
urlpatterns.append(path(r"plugin_api/", include(PLUGIN_API_URLS_MODULE)))
44+
45+
# add plugin openapi
46+
try:
47+
importlib.import_module(PLUGIN_OPENAPI_URLS_MODULE)
48+
except ModuleNotFoundError:
49+
sys.stdout.write("[!]can not find plugin openapi urls module, skip it\n")
50+
else:
51+
sys.stdout.write("[!]plugin openapi urls module found\n")
52+
urlpatterns.append(path(r"openapi/", include(PLUGIN_OPENAPI_URLS_MODULE)))

0 commit comments

Comments
 (0)