Ordinary BLB Instance
General-purpose BLB instances offer standard BLB functionalities, serving the basic requirements of most users for load balancing. These instances provide a lightweight design, straightforward configuration, and cost efficiency.
self refers to blb_client. For specific parameter definitions, refer to the BLB official documentation under API reference: General-purpose BLB Interfaces.
Create BLB instance
Set up a LoadBalancer and receive the associated service address and instance ID. The billing type is Postpay. Certification is required. Users who have not completed certification can go to the "Security Certification" section of the Baidu AI Cloud Official Website Console to complete the process.
You can create BLB instance with the following code:
Function declaration
1def create_loadbalancer(self, vpc_id, subnet_id, name=None,
2 desc=None, ip_version=None, client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateLoadBalancer: Create Instance
Response Value
Operation succeeded:
1{
2 blb_id:'lb-7587472b',
3 name:'BLB-beijing-c5335c6f',
4 desc:'',
5 address:'192.168.0.7'
6}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_loadbalancer.py
Modify BLB instance
Update the configuration of a specified LoadBalancer, including its name and description.
You can modify a BLB instance with the following code:
Function declaration
1def update_loadbalancer(self, blb_id, name=None, desc=None,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateLoadBalancer: Update Instance
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_loadbalancer.py
Modify BLB instance ACL
Enable the ACL feature for the specified single LoadBalancer.
You can modify a BLB instance with the following code to support ACL:
Function declaration
1 def update_loadbalancer_acl(self, blb_id, client_token=None, support_acl=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateLoadBalancerAcl: Update Instance ACL Function
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_loadbalancer_acl.py
Query BLB instance list
Retrieve information on all LoadBalancers under a user account. Supports queries by LoadBalancer ID, name, or address, with matching rules allowing partial matches (excluding regular expressions). Perform queries by bccId, currently supporting only single and exact bccId queries. Results contain the load balancer instance linked to the specified real server. The output reflects the intersection of multiple query conditions. If the BLB instance has public network access enabled, the response will include the public IP. Results support marker-based pagination with a default page size of 1000, which can be modified using the maxKeys parameter.
You can query the BLB list with the following code:
Function declaration
1def describe_loadbalancers(self, address=None, name=None, blb_id=None,
2 bcc_id=None, marker=None, max_keys=None, ip_version=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeLoadBalancers: Query Existing BLB Instances
Response Value
Operation succeeded:
1blb_list:[{
2 tags:None,
3 blb_id:'lb-70c35170',
4 status:'available',
5 name:'testblb',
6 desc:'justForTest',
7 address:'192.168.0.3',
8 vpc_id:'vpc-sr84haq14tcb',
9 subnet_id:'sbn-kg7mj5wt4yw9',
10 allow_delete:True,
11 payment_timing:'Postpaid'
12},
13marker:u'blb-05FA0CCE',
14next_marker:None,
15is_truncated:False,
16max_keys:1000
17]
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_loadbalancers.py
Query BLB instance details
Retrieve detailed information about a LoadBalancer under a user account by its ID, including all listener port details for that LoadBalancer.
You can query BLB details with the following code:
Function declaration
1def describe_loadbalancer_detail(self, blb_id, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeLoadBalancerDetail: Query BLB Instance Details
Response Value
Operation succeeded:
1{
2 tags:None,
3 blb_id:'lb-70c35170',
4 status:'available',
5 name:'testblb',
6 desc:'justForTest',
7 address:'192.168.0.3',
8 cidr:'192.168.0.0/16',
9 vpc_name:'test',
10 create_time:'2023-12-11T12:32:09Z',
11 ipv6:'',
12 allow_delete:True,
13 listener:[],
14 support_acl:False,
15 payment_timing:'Postpaid',
16 vpc_id:'vpc-sr84haq14tcb'
17}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_loadbalancer_detail.py
Delete BLB instance
Delete specified LoadBalancer. Deleted LoadBalancers cannot be recovered
You can delete BLB instance with the following code:
Function declaration
1def delete_loadbalancer(self, blb_id, client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DeleteLoadBalancer: Delete BLB Instances
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_delete_loadbalancer.py
Create TCP listener
Under a specified LoadBalancer, create a TCP listener to forward all TCP traffic received on a frontend port to the backend port on the real servers. TCP listeners only support TCP health checks where the check port aligns with the real server listener port.
You can create a TCP listener with the following code:
Function declaration
1 def create_tcp_listener(self, blb_id, listener_port,
2 backend_port, scheduler,
3 health_check_timeout_in_second=None,
4 health_check_interval=None,
5 unhealthy_threshold=None,
6 healthy_threshold=None,
7 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateTCPListener: Create a TCP Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_tcp_listener.py
Create UDP listener
Under the specified LoadBalancer, configure a UDP-based listener to monitor a frontend port and forward all UDP traffic to the backend port used by real servers. UDP listeners support both UDP and ICMP health checks, with the check port matching the real server's listener port.
You can create a UDP listener with the following code:
Function declaration
1 def create_udp_listener(self, blb_id, listener_port, backend_port,
2 scheduler, health_check_string,
3 health_check_timeout_in_second=None,
4 health_check_interval=None,
5 unhealthy_threshold=None,
6 healthy_threshold=None,
7 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateUDPListener: Create a UDP Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_udp_listener.py
Create HTTP listener
Under the specified LoadBalancer, configure an HTTP-based listener to monitor a frontend port and forward all HTTP requests to the backend port used by real servers.
You can create an HTTP listener with the following code:
Function declaration
1 def create_http_listener(self, blb_id, listener_port,
2 backend_port, scheduler,
3 keep_session=None, keep_session_type=None,
4 keep_session_duration=None,
5 keep_session_cookie_name=None,
6 x_forward_for=None,
7 health_check_type=None, health_check_port=None,
8 health_check_uri=None,
9 health_check_timeout_in_second=None,
10 health_check_interval=None,
11 unhealthy_threshold=None,
12 healthy_threshold=None,
13 health_check_normal_status=None,
14 server_timeout=None, redirect_port=None,
15 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateHTTPListener: Create an HTTP Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_http_listener.py
Create HTTPS listener
Under the specified LoadBalancer, configure an HTTPS-based listener to monitor a frontend port. Convert incoming HTTPS requests on that port into HTTP requests through SSL termination, then forward them to the backend port used by real servers.
You can create an HTTPS listener with the following code:
Function declaration
1 def create_https_listener(self, blb_id, listener_port, backend_port,
2 scheduler, cert_ids, keep_session=None,
3 keep_session_type=None,
4 keep_session_duration=None,
5 keep_session_cookie_name=None,
6 x_forward_for=None, health_check_type=None,
7 health_check_port=None, health_check_uri=None,
8 health_check_timeout_in_second=None,
9 health_check_interval=None,
10 unhealth_threshold=None, health_threshold=None,
11 health_check_normal_status=None,
12 server_timeout=None, ie6_compatible=None,
13 encryption_type=None, encryption_protocols=None,
14 dual_auth=None, client_certIds=None,
15 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateHTTPSListener: Create an HTTPS Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_https_listener.py
Create SSL listener
Under the specified LoadBalancer, configure an SSL protocol-based listener to monitor a frontend port. Convert incoming SSL traffic on that port into TCP requests via SSL termination and forward them to the backend port used by real servers. SSL listeners only support TCP health checks, with the check port matching the real server's listener port.
You can create a SSL listener with the following code:
Function declaration
1 def create_ssl_listener(self, blb_id, listener_port, backend_port,
2 scheduler, cert_ids,
3 health_check_timeout_in_second=None,
4 health_check_interval=None,
5 unhealth_threshold=None, health_threshold=None,
6 ie6_compatible=None, encryption_type=None,
7 encryption_protocols=None,
8 dual_auth=None, client_certIds=None,
9 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateSSLListener: Create a SSL Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_ssl_listener.py
Update TCP listener
Under the specified LoadBalancer, configure an SSL protocol-based listener to monitor a frontend port. Convert incoming SSL traffic on that port into TCP requests via SSL termination and forward them to the backend port used by real servers. SSL listeners only support TCP health checks, with the check port matching the real server's listener port.
You can update a TCP listener with the following code:
Function declaration
1 def update_tcp_listener(self, blb_id, listener_port,
2 backend_port=None, scheduler=None,
3 health_check_timeout_in_second=None,
4 health_check_interval=None,
5 unhealth_threshold=None,
6 health_threshold=None,
7 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateTCPListener: Update TCP Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_tcp_listener.py
Update UDP listener
Update the parameters of a UDP listener under the specified LoadBalancer. All domains specified in the request parameters will be updated, while unspecified domains will remain unchanged. Listeners are identified by ports.
You can update a UDP listener with the following code:
Function declaration
1 def update_udp_listener(self, blb_id, listener_port, backend_port=None,
2 scheduler=None, health_check_string=None,
3 health_check_timeout_in_second=None,
4 health_check_interval=None,
5 unhealth_threshold=None,
6 health_threshold=None,
7 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateUDPListener: Update UDP Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_udp_listener.py
Update HTTP listener
Update the parameters of an HTTP listener under the specified LoadBalancer. All domains specified in the request parameters will be updated, while unspecified domains will remain unchanged. Listeners are identified by ports.
You can update an HTTP listener with the following code:
Function declaration
1 def update_http_listener(self, blb_id, listener_port, backend_port=None,
2 scheduler=None, keep_session=None,
3 keep_session_type=None,
4 keep_session_duration=None,
5 keep_session_cookie_name=None,
6 x_forward_for=None,
7 health_check_type=None, health_check_port=None,
8 health_check_uri=None,
9 health_check_timeout_in_second=None,
10 health_check_interval=None,
11 unhealth_threshold=None, health_threshold=None,
12 health_check_normal_status=None,
13 server_timeout=None,
14 redirect_port=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateHTTPListener: Update HTTP Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_http_listener.py
Update HTTPS listener
Update the parameters of an HTTPS listener under the specified LoadBalancer. All domains specified in the request parameters will be updated, while unspecified domains will remain unchanged. Listeners are identified by ports.
You can update an HTTPS listener with the following code:
Function declaration
1 def update_https_listener(self, blb_id, listener_port,
2 backend_port=None,
3 scheduler=None, keep_session=None,
4 keep_session_type=None,
5 keep_session_duration=None,
6 keep_session_cookie_name=None,
7 x_forward_for=None, health_check_type=None,
8 health_check_port=None, health_check_uri=None,
9 health_check_timeout_in_second=None,
10 health_check_interval=None,
11 unhealth_threshold=None, health_threshold=None,
12 health_check_normal_status=None,
13 server_timeout=None,
14 cert_ids=None, ie6_compatible=None,
15 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateHTTPSListener: Update HTTPS Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_https_listener.py
Update SSL listener
Update the parameters of an SSL listener under the specified LoadBalancer. All domains specified in the request parameters will be updated, while unspecified domains will remain unchanged. Listeners are identified by ports.
You can update a SSL listener with the following code:
Function declaration
1 def update_ssl_listener(self, blb_id, listener_port,
2 backend_port=None, scheduler=None,
3 health_check_timeout_in_second=None,
4 health_check_interval=None,
5 unhealth_threshold=None,
6 health_threshold=None, cert_ids=None,
7 ie6_compatible=None,
8 encryption_type=None,
9 encryption_protocols=None,
10 dual_auth=None, client_certIds=None,
11 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateSSLListener: Update SSL Listener
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_ssl_listener.py
Query TCP listener
- Query information of all TCP listeners under the specified LoadBalancer
- Support querying by listener port for matching items
- Results support marker-based pagination, with a default page size of 1000, which can be specified via the maxKeys parameter.
You can query the TCP listener with the following code:
Function declaration
1 def describe_tcp_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeTCPListeners: Query TCP Listeners
Response Value
Operation succeeded:
1{
2"listener_list": [
3{
4"listener_port":80,
5"backend_port":80,
6"backend_port_type":u'TCP',
7"scheduler":u'RoundRobin',
8"health_check_timeout_in_second":3,
9"health_check_interval":3,
10"unhealthy_threshold":3,
11"healthy_threshold":3,
12"get_blb_ip":False,
13"health_check_valid":1,
14"tcp_session_timeout":900
15}
16]
17}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example For specific code examples, refer to: example_describe_tcp_listener.py
Query UDP listener
- Query information of all UDP listeners under the specified LoadBalancer
- Support querying by listener port for matching items
- Results support marker-based pagination, with a default page size of 1000, which can be specified via the maxKeys parameter.
You can query the UDP listener with the following code:
Function declaration
1 def describe_udp_listener(self, blb_id, listener_port=None, marker=None,
2 max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeUDPListeners: Query UDP Listeners
Response Value
Operation succeeded:
1{
2"listener_list": [
3{
4"listener_port":53,
5"backend_port":53,
6"backend_port_type":u'UDP',
7"scheduler":u'RoundRobin',
8"health_check_timeout_in_second":3,
9"health_check_interval":3,
10"unhealthy_threshold":3,
11"healthy_threshold":3,
12"get_blb_ip":False,
13"health_check_valid":1,
14"health_check_string":u'test',
15"udp_session_timeout":30,
16"health_check_type":u'UDP'
17}
18]
19}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_udp_listener.py
Query HTTP listener
Retrieve all HTTP listeners under the specified LoadBalancer. Supports filtering by listener port to find matching items. Results support marker-based pagination, with a default page size of 1000, which can be adjusted via the maxKeys parameter.
You can query the HTTP listener with the following code
Function declaration
1 def describe_http_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeHTTPListeners: Query HTTP Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 90,
5 "backendPort": 90,
6 "scheduler": "LeastConnection",
7 "healthCheckTimeoutInSecond": 4,
8 "healthCheckInterval": 5,
9 "unhealthyThreshold": 2,
10 "healthyThreshold": 3,
11 "keepSession": false,
12 "keepSessionType": null,
13 "keepSessionDuration": null,
14 "keepSessionCookieName": null,
15 "xForwardFor": false,
16 "healthCheckType": "HTTP",
17 "healthCheckPort": 90,
18 "healthCheckURI": "/",
19 "healthCheckNormalStatus": "http_2xx|http_3xx",
20 "serverTimeout": 30,
21 "redirectPort": 80
22 },
23 {
24 "listenerPort": 95,
25 "backendPort": 95,
26 "scheduler": "LeastConnection",
27 "healthCheckTimeoutInSecond": 4,
28 "healthCheckInterval": 5,
29 "unhealthyThreshold": 2,
30 "healthyThreshold": 3,
31 "keepSession": false,
32 "keepSessionType": null,
33 "keepSessionDuration": null,
34 "keepSessionCookieName": null,
35 "xForwardFor": false,
36 "healthCheckType": "HTTP",
37 "healthCheckPort": 95,
38 "healthCheckURI": "/",
39 "healthCheckNormalStatus": "http_1xx|http_2xx",
40 "serverTimeout": 1800,
41 "redirectPort": 80
42 }
43 ],
44 "marker": "listener-005A",
45 "nextMarker": "listener-0322",
46 "isTruncated": true,
47 "maxKeys": 2
48}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_http_listener.py
Query HTTPS listener
Retrieve all HTTPS listeners under the specified LoadBalancer. Supports filtering by listener port to find matching items. Results support marker-based pagination, with a default page size of 1000, which can be adjusted via the maxKeys parameter.
You can query the HTTPS listener with the following code
Function declaration
1 def describe_https_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeHTTPSListeners: Query HTTPS Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 90,
5 "backendPort": 90,
6 "scheduler": "LeastConnection",
7 "healthCheckTimeoutInSecond": 4,
8 "healthCheckInterval": 5,
9 "unhealthyThreshold": 2,
10 "healthyThreshold": 3,
11 "keepSession": false,
12 "keepSessionType": null,
13 "keepSessionDuration": null,
14 "keepSessionCookieName": null,
15 "xForwardFor": false,
16 "healthCheckType": "HTTP",
17 "healthCheckPort": 90,
18 "healthCheckURI": "/",
19 "healthCheckNormalStatus": "http_2xx|http_3xx",
20 "serverTimeout": 30,
21 "certIds": ["cert-zfj2ey2z4kmm"]
22 },
23 {
24 "listenerPort": 95,
25 "backendPort": 95,
26 "scheduler": "LeastConnection",
27 "healthCheckTimeoutInSecond": 4,
28 "healthCheckInterval": 5,
29 "unhealthyThreshold": 2,
30 "healthyThreshold": 3,
31 "keepSession": false,
32 "keepSessionType": null,
33 "keepSessionDuration": null,
34 "keepSessionCookieName": null,
35 "xForwardFor": false,
36 "healthCheckType": "HTTP",
37 "healthCheckPort": 95,
38 "healthCheckURI": "/",
39 "healthCheckNormalStatus": "http_1xx|http_2xx",
40 "serverTimeout": 1800,
41 "certIds": ["cert-zfj2ey2z4kmm"]
42 }
43 ],
44 "marker": "listener-005A",
45 "nextMarker": "listener-0322",
46 "isTruncated": true,
47 "maxKeys": 2
48}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_https_listener.py
Query SSL listener
Retrieve all SSL listeners under the specified LoadBalancer. Supports filtering by listener port to find matching items. Results support marker-based pagination, with a default page size of 1000, which can be adjusted via the maxKeys parameter.
You can query the SSL listener with the following code
Function declaration
1 def describe_ssl_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeSSLListeners: Query SSL Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 80,
5 "backendPort": 80,
6 "scheduler": "RoundRobin",
7 "healthCheckTimeoutInSecond": 3,
8 "healthCheckInterval": 3,
9 "unhealthyThreshold": 3,
10 "healthyThreshold": 3
11 },
12 {
13 "listenerPort": 88,
14 "backendPort": 88,
15 "scheduler": "RoundRobin",
16 "healthCheckTimeoutInSecond": 2,
17 "healthCheckInterval": 4,
18 "unhealthyThreshold": 3,
19 "healthyThreshold": 3
20 }
21 ],
22 "marker": "listener-0050",
23 "nextMarker": null,
24 "isTruncated": false,
25 "maxKeys": 2
26}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_ssl_listener.py
Query all the listeners
Retrieve all listeners under the specified LoadBalancer. Supports filtering by listener port to find matching items. Results support marker-based pagination, with a default page size of 1000, which can be adjusted via the maxKeys parameter.
You can query all the listeners with the following code
Function declaration
1 def describe_all_listeners(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAllListeners: Query All Listeners
Response Value
Operation succeeded:
1{
2 "nextMarker": "",
3 "marker": "",
4 "maxKeys": 1,
5 "isTruncated": true,
6 "listenerList": [
7 {
8 "listenerPort": 53,
9 "backendPort": 53,
10 "scheduler": "RoundRobin",
11 "healthCheckTimeoutInSecond": 3,
12 "healthCheckInterval": 3,
13 "unhealthyThreshold": 3,
14 "healthyThreshold": 3,
15 "getBlbIp": false,
16 "listenerType": "UDP",
17 "udpSessionTimeout": 90,
18 "healthCheckString": "\\00\\01\\01\\00\\00\\01\\00\\00\\00\\00\\00\\00\\05baidu\\03com\\00\\00\\01\\00\\01",
19 "healthCheckType": "UDP"
20 },
21 {
22 "listenerPort": 82,
23 "backendPort": 80,
24 "scheduler": "RoundRobin",
25 "healthCheckTimeoutInSecond": 3,
26 "healthCheckInterval": 3,
27 "unhealthyThreshold": 3,
28 "healthyThreshold": 3,
29 "getBlbIp": false,
30 "listenerType": "TCP",
31 "tcpSessionTimeout": 900
32 },
33 {
34 "listenerPort": 87,
35 "backendPort": 80,
36 "scheduler": "RoundRobin",
37 "healthCheckTimeoutInSecond": 3,
38 "healthCheckInterval": 3,
39 "unhealthyThreshold": 3,
40 "healthyThreshold": 3,
41 "getBlbIp": false,
42 "listenerType": "HTTP",
43 "keepSession": false,
44 "xForwardFor": true,
45 "healthCheckType": "HTTP",
46 "healthCheckPort": 80,
47 "healthCheckURI": "/",
48 "healthCheckNormalStatus": "http_2xx|http_3xx",
49 "healthCheckHost": "",
50 "serverTimeout": 30,
51 "redirectPort": 0
52 },
53 {
54 "listenerPort": 443,
55 "backendPort": 80,
56 "scheduler": "RoundRobin",
57 "healthCheckTimeoutInSecond": 3,
58 "healthCheckInterval": 3,
59 "unhealthyThreshold": 3,
60 "healthyThreshold": 3,
61 "getBlbIp": false,
62 "listenerType": "HTTPS",
63 "keepSession": false,
64 "xForwardFor": true,
65 "healthCheckType": "HTTP",
66 "healthCheckPort": 80,
67 "healthCheckURI": "/",
68 "healthCheckNormalStatus": "http_2xx|http_3xx",
69 "healthCheckHost": "",
70 "serverTimeout": 30,
71 "certIds": [
72 "cert-gs8bktrm7drp"
73 ],
74 "dualAuth": false,
75 "encryptionType": "tls_cipher_policy_1_2_secure",
76 "encryptionProtocols": [
77 "tlsv12"
78 ],
79 "appliedCiphers": "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA"
80 },
81 {
82 "listenerPort": 446,
83 "backendPort": 80,
84 "scheduler": "RoundRobin",
85 "healthCheckTimeoutInSecond": 3,
86 "healthCheckInterval": 3,
87 "unhealthyThreshold": 3,
88 "healthyThreshold": 3,
89 "getBlbIp": false,
90 "listenerType": "SSL",
91 "certIds": [
92 "cert-gs8bktrm7drp"
93 ],
94 "dualAuth": true,
95 "clientCertIds": [
96 "cert-0x037gwe4fmg"
97 ],
98 "encryptionType": "tls_cipher_policy_default",
99 "encryptionProtocols": [
100 "tlsv10",
101 "tlsv11",
102 "tlsv12"
103 ],
104 "appliedCiphers": "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES256-SHA:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES128-SHA256:DES-CBC3-SHA"
105 }
106 ]
107}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_all_listeners.py
Delete listener
Delete listeners under the specified LoadBalancer. Listeners are identified by their ports, and batch deletion is supported.
You can delete the UDP listener with the following code
Function declaration
1 def delete_listeners(self, blb_id, portList, client_token=None, config=None)
Parameter Meaning Refer to the OpenAPI documentation: DeleteListeners: Delete Listener
Response Value Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_delete_listeners.py
Add real server instance
Add real servers to the specified LoadBalancer, with support for batch addition.
You can add real server instance with the following code
Function declaration
1 def add_backend_servers(self, blb_id, backend_server_list,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Add Real Server
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_add_backend_servers.py
Modify real server instance
Modify the weight of real servers under a specified LoadBalancer, with support for batch updates.
You can modify real server instance with the following code
Function declaration
1 def update_backend_servers(self, blb_id, backend_server_list,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Update Real Server
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_update_backend_servers.py
Query real server instance health status
Retrieve the health status of the list of real servers for a specific port under the specified LoadBalancer.
You can query real server instance health status with the following code
Function declaration
1 def describe_health_status(self, blb_id, listener_port,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Query Real Server Health Status
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "i-YfAibl4A",
5 "weight": 50,
6 "status": "Alive"
7 }
8 ],
9 "type": "TCP",
10 "listenerPort": 88,
11 "backendPort": 88,
12 "marker": "rs-0A6BE9BB",
13 "nextMarker": null,
14 "isTruncated": false,
15 "maxKeys": 1000
16}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_health_status.py
Query a real server instance
Retrieve the real server list under a specified LoadBalancer.
You can query real server instance with the following code
Function declaration
1 def describe_backend_servers(self, blb_id, marker=None,
2 max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Query Real Server List
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "i-YfAibl4A",
5 "weight": 50,
6 }
7 ],
8 "marker": "rs-0A6BE9BB",
9 "nextMarker": null,
10 "isTruncated": false,
11 "maxKeys": 1000
12}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_backend_servers.py
Remove real server instance
Delete real servers under the specified LoadBalancer, with those real servers indicated by their identifiers
You can remove real server instance with the following code
Function declaration
1 def remove_backend_servers(self, blb_id, backend_server_list,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Delete Real Server
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_remove_backend_servers.py
Bind to regular security group
Bind regular security group to the specified LoadBalancer
You can bind a regular security group with the following code
Function declaration
1def bind_security_groups(self, blb_id, enterprisesecuritygroupids,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: BindSecurityGroups: Bind Regular Security Group
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_bind_security_groups.py
Unbind from regular security group
Unbind regular security group of the specified LoadBalancer
You can unbind a regular security group with the following code
Function declaration
1def unbind_security_groups(self, blb_id, securitygroupids,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UnbindSecurityGroups: Unbind Regular Security Group
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_unbind_security_groups.py
Query regular security group list of BLB instances
Query regular security group of the specified LoadBalancer
You can query a regular security group with the following code
Function declaration
1def describe_security_groups(self, blb_id,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeSecurityGroups: Query Regular Security Group List of BLB Instance
Response Value
Operation succeeded:
1{
2 "blbSecurityGroups": [
3 {
4 "securityGroupDesc": "",
5 "securityGroupId": "g-4NxWoxeq",
6 "securityGroupName": "securitygroup-name",
7 "vpcName":"vpc-name",
8 "securityGroupRules": [
9 {
10 "destGroupId": "",
11 "destIp": "all",
12 "direction": "egress",
13 "ethertype": "IPv4",
14 "portRange": "1-65535",
15 "protocol": "all",
16 "securityGroupRuleId": "r-gkv8yupumvx2"
17 }
18 ]
19 }
20 ]
21}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_security_groups.py
Bind enterprise security group
Bind enterprise security groups to a specified LoadBalancer
You can bind an enterprise security group with the following code
Function declaration
1def bind_enterprise_security_groups(self, blb_id, enterprisesecuritygroupids,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: BindEnterpriseSecurityGroups: Bind Enterprise Security Group
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_bind_enterprise_security_groups.py.py
Unbind enterprise security group
Unbind enterprise security group of the specified LoadBalancer
You can unbind an enterprise security group with the following code
Function declaration
1def unbind_enterprise_security_groups(self, blb_id, enterprisesecuritygroupids,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UnbindEnterpriseSecurityGroups: Unbind Enterprise Security Group
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_unbind_enterprise_security_groups.py
Query the enterprise security group list of BLB instances
Query enterprise security group of the specified LoadBalancer
You can query an enterprise security group with the following code
Function declaration
1def describe_enterprise_security_groups(self, blb_id,
2 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeEnterpriseSecurityGroups: Query the Enterprise Security Group List of BLB Instances
Response Value
Operation succeeded:
1{
2 "enterpriseSecurityGroups": [{
3 "enterpriseSecurityGroupId": "esg-g8z4qfj0m0bu",
4 "enterpriseSecurityGroupName": "test0627",
5 "enterpriseSecurityGroupDesc": "",
6 "enterpriseSecurityGroupRules": [{
7 "remark": "All protocols",
8 "direction": "egress",
9 "action": "allow",
10 "priority": 1000,
11 "ethertype": "IPv6",
12 "portRange": "",
13 "sourceIp": "",
14 "destIp": "all",
15 "enterpriseSecurityGroupRuleId": "esgr-9tzd4yijcwqu",
16 "protocol": "all"
17 },
18 {
19 "remark": "",
20 "direction": "egress",
21 "action": "allow",
22 "priority": 1000,
23 "ethertype": "IPv4",
24 "portRange": "",
25 "sourceIp": "",
26 "destIp": "all",
27 "enterpriseSecurityGroupRuleId": "esgr-9je09z6bd9wv",
28 "protocol": "tcp"
29 },
30 {
31 "remark": "",
32 "direction": "ingress",
33 "action": "allow",
34 "priority": 1000,
35 "ethertype": "IPv4",
36 "portRange": "2",
37 "sourceIp": "all",
38 "destIp": "",
39 "enterpriseSecurityGroupRuleId": "esgr-jcej4juqbh49",
40 "protocol": "tcp"
41 }
42 ]}
43}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_enterprise_security_groups.py
