CSN Instance
Create a Cloud Smart Network
Function declaration
1def create_csn(self, name, description=None, tags=None, client_token=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/Jl0tk76ib
Response value
Operation succeeded:
1{
2 "metadata": {...}, # Common Description Information
3 "csn_id":"csn-34t94wnsazpbi3wd"
4}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_create_csn.py
Update a Cloud Smart Network
Function declaration
1def update_csn(self, csn_id, name=None, description=None, client_token=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/ol0ucgh93
Response value
Operation succeeded:
1{
2 "metadata": {...} # Public description information
3}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_update_csn.py
Delete a Cloud Smart Network
Function declaration
1def delete_csn(self, csn_id, client_token=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/Sl0uc93yd
Response value
Operation succeeded:
1{
2 "metadata": {...} # Public description information
3}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_delete_csn.py
Query the list of Cloud Smart Network
Function declaration
1def list_csn(self, marker=None, max_keys=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/Ll0ucpv6y
Response value
Operation succeeded:
1{
2 "metadata": {...}, # Common Description Information
3 "marker":"",
4 "is_truncated":false,
5 "max_keys":1000,
6 "csns":[
7 {
8 "name":"wxktest",
9 "description":"",
10 "csn_id":"csn-34t94wnsazpbi3wd",
11 "status":"active",
12 "instance_num":2,
13 "csn_bp_num":1
14 "tags":[
15 {
16 "tagKey":"tagKey1",
17 "tagValue":"tagValue1"
18 }
19 ]
20 }
21 ]
22}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_list_csn.py
Query Cloud Smart Network details
Function declaration
1def get_csn(self, csn_id)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/xl14zx3lf
Response value
Operation succeeded:
1{
2 "metadata": {...}, # Common Description Information
3 "name":"csn_test",
4 "description":"csn_test description",
5 "csn_id":"csn-34t94wnsazpbi3wd",
6 "status":"active",
7 "instance_num":2,
8 "csn_bp_num":1,
9 "tags":[
10 {
11 "tagKey":"tagKey1",
12 "tagValue":"tagValue1"
13 }
14 ]
15}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_get_csn.py
Network instances loaded by the Cloud Smart Network
Function declaration
1def attach_instance(self, csn_id, instance_type, instance_id, instance_region, instance_account_id=None, client_token=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/tl0un4yvb
Response value
Operation succeeded:
1{
2 "metadata": {...} # Public description information
3}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_attach_instance.py
Network instances unloaded by the Cloud Smart Network
Function declaration
1def detach_instance(self, csn_id, instance_type, instance_id, instance_region, instance_account_id=None, client_token=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/fl0unhq5k
Response value
Operation succeeded:
1{
2 "metadata": {...} # Public description information
3}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_detach_instance.py
Query Cloud Smart Network instance list
Function declaration
1def list_instance(self, csn_id, marker=None, max_keys=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/nl0unomuo
Response value
Operation succeeded:
1{
2 "metadata": {...}, # Common Description Information
3 "marker":"",
4 "is_truncated":false,
5 "max_keys":1000,
6 "instances":[
7 {
8 "attach_id":"tgwAttach-ycsx58278drf41sm",
9 "instance_type":"vpc",
10 "instance_id":"vpc-zep9hag85vap",
11 "instance_name":"test_vpc_01",
12 "instance_region":"bj",
13 "instance_account_id":"60a4f129eb0e47f0a110ea27b44b6073",
14 "status":"attached"
15 },
16 {
17 "attach_id":"tgwAttach-m8bydk547r9pjeiv",
18 "instance_type":"vpc",
19 "instance_id":"vpc-w37tyjur64p5",
20 "instance_name":"test_vpc_02",
21 "instance_region":"bd",
22 "instance_account_id":"60a4f129eb0e47f0a110ea27b44b6073",
23 "status":"attached"
24 }
25 ]
26}
Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_list_instance.py
