Skip to content

Commit

Permalink
update cc apis, add cmsi send_msg/get_msg_type (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-smile authored and wklken committed Jul 24, 2019
1 parent 68fe07d commit 64e5c18
Show file tree
Hide file tree
Showing 23 changed files with 1,071 additions and 7 deletions.
23 changes: 23 additions & 0 deletions paas-ce/paas/esb/common/base_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,26 @@ def load_yaml(path):
def read_file(path):
with open(path, 'r') as fp:
return fp.read()


def html_escape(html, is_json=False):
"""
Replace special characters "&", "<" and ">" to HTML-safe sequences.
If the optional flag quote is true, the quotation mark character (")
is also translated.
rewrite the cgi method
@param html: html代码
@param is_json: 是否为json串(True/False) ,默认为False
"""
# &转换
if not is_json:
html = html.replace('&', '&amp;') # Must be done first!
# <>转换
html = html.replace("<", "&lt;")
html = html.replace(">", "&gt;")
# 单双引号转换
if not is_json:
# html = html.replace(' ', "&nbsp;")
html = html.replace('"', "&quot;")
html = html.replace("'", "&#39;")
return html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
### Functional description

create association between object's instance.

### Request Parameters

{{ common_args_desc }}

#### General Parameters

| Field | Type | Required | Description |
|----------------------|------------|--------|-----------------------------|
| metadata | object | Yes | request meta data |
| condition | string map | Yes | query condition |


metadata params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| label | string map | Yes |the label data request should with, such as biz info |


label params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| bk_biz_id | string | Yes | business's ID |


condition params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| bk_obj_asst_id | string | Yes | object's association unique id |
| bk_inst_id | int64 | Yes | association's source object's instance id |
| bk_asst_inst_id | int64 | Yes | association's destination object's instance id |


### Request Parameters Example

``` json
{
"bk_obj_asst_id": "bk_switch_belong_bk_host",
"bk_inst_id": 11,
"bk_asst_inst_id": 21,
"metadata":{
"label":{
"bk_biz_id":"1"
}
}
}
```

### Return Result Example

```json
{
"result": true,
"code": 0,
"message": "",
"data": {
"id": 1038
}
}

```

### Return Result Parameters Description

#### data :

| Field | Type | Description |
|------------|----------|--------------|
|id|int64|the instance association's unique id|

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
### Functional description

delete association between object's instance.

### Request Parameters

{{ common_args_desc }}

#### General Parameters
| Field | Type | Required | Description |
|----------------------|------------|--------|-----------------------------|
| id | int64 | Yes | the instance association's unique id |

### Request Parameters Example

``` json

```

### Return Result Example

```json
{
"result": true,
"code": 0,
"message": "",
"data": "success"
}

```

### Return Result Parameters Description

#### data :

| Field | Type | Description |
|------------|----------|--------------|


Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
### Functional description

find association between object's instance.

### Request Parameters

{{ common_args_desc }}

#### General Parameters

| Field | Type | Required | Description |
|----------------------|------------|--------|-----------------------------|
| metadata | object | Yes | request meta data |
| condition | string map | Yes | query condition |


metadata params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| label | string map | Yes |the label data request should with, such as biz info |


label params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| bk_biz_id | string | Yes | business's ID |

condition params
| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| bk_obj_asst_id | string | Yes | object's association unique id|
| bk_asst_id | string | NO | object's association kind unique name|
| bk_obj_id | string | NO | the association's source object's id|
| bk_asst_id | string | NO | the association's destination object's id|


### Request Parameters Example

``` json
{
"condition": {
"bk_obj_asst_id": "bk_switch_belong_bk_host",
"bk_asst_id": "",
"bk_object_id": "",
"bk_asst_obj_id": ""
},
"metadata":{
"label":{
"bk_biz_id":"3"
}
}
}
```

### Return Result Example

```json
{
"result": true,
"code": 0,
"message": "",
"data": [{
"bk_obj_asst_id": "bk_switch_belong_bk_host",
"bk_obj_id":"switch",
"bk_asst_obj_id":"host",
"bk_inst_id":12,
"bk_asst_inst_id":13
}]
}

```


### Return Result Parameters Description

#### data :

| Field | Type | Description |
|------------|----------|--------------|
|id|int64|the association's unique id|
| bk_obj_asst_id| string| auto generated id, which represent this association.|
| bk_obj_id| string| the association source object's id |
| bk_asst_obj_id| string| the association destination object's id|
| bk_inst_id| int64| the association source object's instance id|
| bk_asst_inst_id| int64| the association destination object's instance id|

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
### Functional description

find association between object.

### Request Parameters

{{ common_args_desc }}

#### General Parameters

| Field | Type | Required | Description |
|----------------------|------------|--------|-----------------------------|
| metadata | object | Yes | request meta data |
| condition | string map | Yes | query condition |


metadata params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| label | string map | Yes |the label data request should with, such as biz info |


label params

| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| bk_biz_id | string | Yes | business's ID |

condition params
| Field | Type | Required | Description |
|---------------------|------------|--------|-----------------------------|
| bk_asst_id | string | Yes | object's association kind unique name|
| bk_obj_id | string | Yes | the association's source object's id|
| bk_asst_id | string | Yes | the association's destination object's id|


### Request Parameters Example

``` json
{
"condition": {
"bk_asst_id": "belong",
"bk_obj_id": "bk_switch",
"bk_asst_obj_id": "bk_host"
},
"metadata":{
"label":{
"bk_biz_id":"1"
}
}
}
```

### Return Result Example

```json
{
"result": true,
"code": 0,
"message": "",
"data": [
{
"id": 1,
"bk_obj_asst_id": "bk_switch_belong_bk_host",
"bk_obj_asst_name": "",
"bk_asst_id": "belong",
"bk_asst_name": "belong",
"bk_obj_id": "bk_switch",
"bk_obj_name": "switch",
"bk_asst_obj_id": "bk_host",
"bk_asst_obj_name": "host",
"mapping": "1:n",
"on_delete": "none"
}
]
}

```


### Return Result Parameters Description

#### data :

| Field | Type | Description |
|------------|----------|--------------|
|id|int64|the association's unique id|
| bk_obj_asst_id| string| auto generated id, which represent this association.|
| bk_obj_asst_name| string| the alias name for this association. |
| bk_asst_id| string| association kind id |
| bk_asst_name| string| association kind name |
| bk_obj_id| string| the association source object's id |
| bk_obj_name| string| the association source object's name |
| bk_asst_obj_id| string| the association destination object's id|
| bk_asst_obj_name| string| the association destination object's name|
| mapping| string| association between object's instance type, could be one of [1:1, 1:n, n:n] |
| on_delete| string| the action when this association is delete, could be one of [none, delete_src, delete_dest], "none" means do nothing, "delete_src" means delete source object's instance, "delete_dest" means delete destination object's instance.|
Loading

0 comments on commit 64e5c18

Please sign in to comment.