Skip to content

Commit

Permalink
Merge pull request #287 from Tencent/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
wklken authored Mar 8, 2021
2 parents 7a6fe1e + 4c64779 commit 1c0380e
Show file tree
Hide file tree
Showing 166 changed files with 9,164 additions and 1,521 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ def get_client_by_request(request, **kwargs):
:param request: 一个django request实例
:returns: 一个初始化好的ComponentClint对象
"""

if request.user.is_authenticated():
is_authenticated = request.user.is_authenticated
if callable(is_authenticated):
is_authenticated = is_authenticated()
if is_authenticated:
bk_token = request.COOKIES.get('bk_token', '')
else:
bk_token = ''
Expand Down
58 changes: 15 additions & 43 deletions paas-ce/paas/esb/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
""" # noqa
from django.utils.translation import ugettext_lazy as _
from enum import Enum

from common.base_utils import FancyDict

Expand All @@ -32,45 +32,17 @@
))


BK_SYSTEMS = {
'BK_LOGIN': {
'name': 'BK_LOGIN',
'label': _(u'蓝鲸统一登录'),
'remark': u'蓝鲸统一登录,管理用户登录验证,及用户信息',
},
'BK_PAAS': {
'name': 'BK_PAAS',
'label': _(u'蓝鲸开发者中心'),
'remark': u'蓝鲸开发者中心',
},
'CC': {
'name': 'CC',
'label': _(u'蓝鲸配置平台'),
'remark': u'蓝鲸配置平台是一款面向应用的CMDB,在ITIL体系里,CMDB是构建其它流程的基石,而在蓝鲸智云体系里,配置平台就扮演着基石的角色,为应用提供了各种运维场景的配置数据服务。',
},
'GSE': {
'name': 'GSE',
'label': _(u'蓝鲸管控平台'),
'remark': u'蓝鲸管控平台',
},
'JOB': {
'name': 'JOB',
'label': _(u'蓝鲸作业平台'),
'remark': u'作业平台(Job)是一套基于蓝鲸智云管控平台Agent管道之上的基础操作平台,具备大并发处理能力;除了支持脚本执行、文件拉取/分发、定时任务等一系列可实现的基础运维场景以外,还运用流程化的理念很好的将零碎的单个任务组装成一个作业流程;而每个任务都可做为一个原子节点,提供给其它系统和平台调度,实现调度自动化。', # noqa
},
'CMSI': {
'name': 'CMSI',
'label': _(u'蓝鲸消息管理'),
'remark': u'蓝鲸消息管理,用于支持向用户发送多种类型的消息,包括邮件、短信、语音通知等',
},
'SOPS': {
'name': 'SOPS',
'label': _(u'标准运维'),
'remark': u'标准运维',
},
'MONITOR': {
'name': 'MONITOR',
'label': _(u'蓝鲸监控'),
'remark': u'蓝鲸监控',
},
}
class CacheTimeLevel(Enum):

CACHE_TIME_SHORT = 5 * 60
CACHE_TIME_MEDIUM = 3600
CACHE_TIME_LONG = 24 * 3600


CACHE_MAXSIZE = 2000


class FunctionControllerCodeEnum(Enum):

SKIP_USER_AUTH = "user_auth::skip_user_auth"
JWT_KEY = "jwt::private_public_key"
8 changes: 8 additions & 0 deletions paas-ce/paas/esb/components/bk/apisv2/esb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
""" # noqa
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
### Functional description

Get the list of components for the specified system

### Request Parameters

{{ common_args_desc }}

#### Interface Parameters

| Field | Type | Required | Description |
|---------------|------------|--------|------------------|
| system_names | list | YES | System name, Available through the component get_systems.|

### Request Parameters Example

```python
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"system_names": ["BK_LOGIN", "XXXX"]
}
```

### Return Result Example

```python
{
"result": true,
"code": 0,
"data": [
{
"name": "get_all_users",
"label": "get all users",
"version": "v2",
"method": "GET",
"path": "/api/c/compapi/v2/bk_login/get_all_users/",
"type": 2,
"system_id": 1,
"system_name": "BK_LOGIN",
"category": "component"
},
{
"name": "get_api_check_component_exist",
"label": "check_component_exist",
"version": "",
"method": "GET",
"path": "/api/c/self-service-api/api/check_component_exist/",
"type": 2,
"system_id": 6,
"system_name": "XXXX",
"category": "buffet_component"
}
],
"message": ""
}
```

### Return Result Description

#### data

| Field | Type | Description |
| ------------ | ---------- | ------------------------------ |
| method | string | suggest request method |
| version | string | component version |
| system_id | int | System id |
| name | string | component name |
| path | string | component Third-party system path |
| type | int | 1 query, 2 operate |
| label | string | component label |
| category | string | component category, component or buffet_component |
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
### Functional description

Get the list of systems accessing the ESB

### Request Parameters

{{ common_args_desc }}

### Request Parameters Example

```python
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx"
}
```

### Return Result Example

```python
{
"result": true,
"code": 0,
"message": "OK",
"data": [
{
"id": 1,
"name": "BK_LOGIN",
"label": "Login System",
"remark": "BlueKing Login System, managing user login authentication and user information"
},
{
"id": 2,
"name": "BK_PAAS",
"label": "Developer Center",
"remark": "Developer Center"
}
]
}
```

### Return Result Description

#### data

| Field | Type | Description |
|-----------|----------|-----------|
| id | int | system id |
| label | string | system label |
| name | string | system name |
| remark | string | remark |
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
### 功能描述

获取指定系统的组件列表

### 请求参数

{{ common_args_desc }}

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|--------|------------------|
| system_names | list || 系统名称, 可通过组件get_systems获取|

### 请求参数示例

```python
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"system_names": ["BK_LOGIN", "XXXX"]
}
```

### 返回结果示例

```python
{
"result": true,
"code": 0,
"data": [
{
"name": "get_all_users",
"label": "获取所有用户信息",
"version": "v2",
"method": "GET",
"path": "/api/c/compapi/v2/bk_login/get_all_users/",
"system_id": 1,
"system_name": "BK_LOGIN",
"type": 2,
"category": "component",
},
{
"name": "get_api_check_component_exist",
"label": "check_component_exist",
"version": "",
"method": "GET",
"path": "/api/c/self-service-api/api/check_component_exist/",
"system_id": 6,
"system_name": "XXXX",
"type": 2,
"category": "buffet_component",
}
],
"message": ""
}
```

### 返回结果参数说明

#### data

| 字段 | 类型 | 描述 |
|-----------|----------|-----------|
| method | string | 建议请求方法 |
| version | string | 组件版本 |
| system_id | int | 所属系统id |
| name | string | 组件名称 |
| path | string | 组件第三方系统路径 |
| type | int | 1 query, 2 operate |
| label | string | 组件标签 |
| category | string | 组件类型, component or buffet_component |
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
### 功能描述

获取ESB中的组件系统列表

### 请求参数

{{ common_args_desc }}

### 请求参数示例

```python
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx"
}
```

### 返回结果示例

```python
{
"result": true
"code": 0,
"message": "OK",
"data": [
{
"id": 1,
"name": "BK_LOGIN",
"label": "蓝鲸统一登录",
"remark": "蓝鲸统一登录,管理用户登录验证,及用户信息"
},
{
"id": 2,
"name": "BK_PAAS",
"label": "蓝鲸开发者中心",
"remark": "蓝鲸开发者中心"
}
]
}
```

### 返回结果参数说明

#### data

| 名称 | 类型 | 说明 |
| ------------ | ---------- | ------------------------------ |
| id | int | 系统id |
| name | string | 系统名称 |
| label | string | 系统标签 |
| remark | string | 备注 |
Loading

0 comments on commit 1c0380e

Please sign in to comment.