Application BLB Instance
Application BLB instances are optimized for complex deployment architectures, especially large-scale websites, utilizing a policy-based network management framework for service-driven traffic load balancing.
self refers to app_blb_client. For specific parameter definitions, refer to the BLB official documentation under API reference: Application BLB Interfaces.
Create application BLB instance
1<!---1. *Required; a one-sentence description of the function's purpose. -->
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 application BLB instance with the following code:
Function declaration
1def create_app_loadbalancer(self, vpc_id, subnet_id, name=None, desc=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-1a22b118',
3 name:'BLB-beijing-a60ce0c4',
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_app_loadbalancer.py
Update application BLB instance
Update the configuration information of a LoadBalancer.
You can update application BLB instance with the following code:
Function declaration
1 def update_app_loadbalancer(self, blb_id, name=None, desc=None, 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_app_loadbalancer.py
Query application BLB instance list
Retrieve details of all LoadBalancers under a user account. Filter by LoadBalancer ID, name, or address, supporting partial matches (regular expressions not supported). Query LoadBalancers bound to specific BCCs using the BCC ID. The response is the intersection of given criteria. Results support marker-based pagination, defaulting to 1000 items per page, adjustable via the maxKeys parameter.
You can query application BLB instance list with the following code:
Function declaration
1def describe_app_loadbalancers(self, address=None, name=None, blb_id=None, bcc_id=None, marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeLoadBalancers: Query Existing BLB Instances
Response Value
Operation succeeded:
1{
2 blb_list:[{
3 tags:None,
4 blb_id:'lb-cf2dc4e7',
5 status:'available',
6 name:'testappblb',
7 desc:'appjustForTest',
8 address:'192.168.0.4',
9 vpc_id:'vpc-sr84haq14tcb',
10 subnet_id:'sbn-kg7mj5wt4yw9',
11 allow_delete:True,
12 payment_timing:'Postpaid'},
13 ]
14 marker:'blb-05FA0CED',
15 next_marker:None,
16 is_truncated:False,
17 max_keys:1000
18 }
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_loadbalancers.py
Query application BLB instance details
Retrieve detailed information on all LoadBalancers under a user account by ID, including all listener port details for each LoadBalancer.
You can query application BLB instance details with the following code:
Function declaration
1def describe_app_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-cf2dc4e7',
4 status:'available',
5 name:'testappblb',
6 desc:'appjustForTest',
7 address:'192.168.0.4',
8 cidr:'192.168.0.0/16',
9 vpc_name:'test',
10 subnet_name:'test',
11 subnet_cider:'192.168.0.0/24',
12 create_time:'2023-12-11T14:14:36Z',
13 ipv6:'',
14 allow_delete:True,
15 listener:[],
16 support_acl:True,
17 payment_timing:'Postpaid',
18 vpc_id:'vpc-sr84haq14tcb'
19 }
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_loadbalancer_detail.py
Delete application BLB instance
Delete specified LoadBalancer. Deleted LoadBalancers cannot be recovered
You can delete application BLB instance with the following code:
Function declaration
1def delete_app_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_app_loadbalancer.py
Create TCP listener
Within the specified LoadBalancer, create a TCP-based application BLB listener to monitor a frontend port and forward all TCP traffic to this port according to defined policies.
You can create a TCP listener with the following code
Function declaration
1 def create_app_tcp_listener(self, blb_id, listener_port,
2 scheduler, client_token=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateAppTCPListener: 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_app_tcp_listener.py
Create UDP listener
Create a UDP-based application listener for the specified LoadBalancer to listen on a frontend port and forward all UDP traffic to it based on defined policies.
You can create a UDP listener with the following code
Function declaration
1 def create_app_udp_listener(self, blb_id, listener_port,
2 scheduler, client_token=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateAppUDPListener: 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_app_udp_listener.py
Create HTTP listener
Create an HTTP-based application listener for the specified LoadBalancer to listen on a frontend port and forward all HTTP requests to the backend port managed by real servers based on policies.
You can create an HTTP listener with the following code
Function declaration
1 def create_app_http_listener(self, blb_id, listener_port,
2 scheduler, keep_session=None,
3 keep_session_type=None,
4 keep_session_timeout=None,
5 keep_session_cookie_name=None,
6 x_forwarded_for=None,
7 server_timeout=None,
8 redirect_port=None,
9 client_token=None,
10 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateAppHTTPListener: 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_app_http_listener.py
Create 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 create an HTTPS listener with the following code
Function declaration
1 def create_app_https_listener(self, blb_id, listener_port,
2 scheduler, cert_ids,
3 keep_session=None,
4 keep_session_type=None,
5 keep_session_timeout=None,
6 keep_session_cookie_name=None,
7 x_forwarded_for=None, server_timeout=None,
8 ie6_compatible=None, encryption_type=None,
9 encryption_protocols=None,
10 dual_auth=None, client_certIds=None,
11 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateAppHTTPSListener: 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_app_https_listener.py
Create SSL listener
Create an SSL-based application listener for the specified LoadBalancer to listen on a frontend port and forward all SSL traffic to it according to defined policies.
You can create a SSL listener with the following code
Function declaration
1 def create_app_ssl_listener(self, blb_id, listener_port,
2 scheduler, cert_ids,
3 ie6_compatible=None,
4 encryption_type=None,
5 encryption_protocols=None,
6 dual_auth=None, client_certIds=None,
7 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateAppSSLListener: 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_app_ssl_listener.py
Update TCP listener
Update TCP listener parameters for the specified LoadBalancer. All specified domains in the request parameters will be updated, while unspecified domains will remain unchanged. Listeners must be designated via ports.
You can update a TCP listener with the following code
Function declaration
1 def update_app_tcp_listener(self, blb_id, listener_port,
2 scheduler=None,
3 client_token=None,
4 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppTCPListener: 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_app_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_app_udp_listener(self, blb_id, listener_port,
2 scheduler=None, client_token=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppUDPListener: 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_app_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_app_http_listener(self, blb_id, listener_port,
2 scheduler=None, keep_session=None,
3 keep_session_type=None,
4 keep_session_timeout=None,
5 keep_session_cookie_name=None,
6 x_forwarded_for=None,
7 server_timeout=None,
8 redirect_port=None,
9 client_token=None,
10 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppHTTPListener: 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_app_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
1def update_app_https_listener(self, blb_id, listener_port,
2 scheduler=None,
3 keep_session=None,
4 keep_session_type=None,
5 keep_session_timeout=None,
6 keep_session_cookie_name=None,
7 x_forwarded_for=None,
8 server_timeout=None,
9 cert_ids=None,
10 ie6_compatible=None,
11 encryption_type=None,
12 encryption_protocols=None,
13 dual_auth=None,
14 client_certIds=None,
15 client_token=None,
16 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppHTTPSListener: 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_app_https_listener.py
Update application SSL listeners
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 the application SSL listener with the following code
Function declaration
1 def update_app_ssl_listener(self, blb_id, listener_port,
2 scheduler=None,
3 cert_ids=None,
4 ie6_compatible=None,
5 encryption_type=None,
6 encryption_protocols=None,
7 dual_auth=None,
8 client_certIds=None,
9 client_token=None,
10 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppSSLListener: Update Application 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_app_ssl_listener.py
Query application TCP listeners
Retrieve all TCP listeners for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query the application TCP listener with the following code
Function declaration
1 def describe_app_tcp_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppTCPListeners: Query TCP Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 80,
5 "scheduler": "RoundRobin"
6 },
7 {
8 "listenerPort": 88,
9 "scheduler": "RoundRobin"
10 }
11 ],
12 "marker": "listener-0050",
13 "nextMarker": null,
14 "isTruncated": false,
15 "maxKeys": 2
16}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_tcp_listener.py
Query UDP listener
Retrieve all UDP listeners for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query the UDP listener with the following code
Function declaration
1 def describe_app_udp_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppUDPListeners: Query UDP Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 80,
5 "scheduler": "RoundRobin",
6 "udpSessionTimeout":90
7 },
8 {
9 "listenerPort": 88,
10 "scheduler": "RoundRobin",
11 "udpSessionTimeout":90
12 }
13 ],
14 "marker": "listener-0050",
15 "nextMarker": null,
16 "isTruncated": false,
17 "maxKeys": 2
18}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_udp_listener.py
Query HTTP listener
Retrieve all HTTP listeners for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query the HTTP listener with the following code
Function declaration
1 def describe_app_http_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppHTTPListeners: Query HTTP Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 90,
5 "backendPort": 90,
6 "scheduler": "LeastConnection",
7 "keepSession": false,
8 "keepSessionType": null,
9 "keepSessionTimeout": null,
10 "keepSessionCookieName": null,
11 "xForwardedFor": false,
12 "serverTimeout": 30,
13 "redirectPort": 80
14 },
15 {
16 "listenerPort": 95,
17 "backendPort": 95,
18 "scheduler": "LeastConnection",
19 "keepSession": false,
20 "keepSessionType": null,
21 "keepSessionTimeout": null,
22 "keepSessionCookieName": null,
23 "xForwardedFor": false,
24 "serverTimeout": 1800,
25 "redirectPort": 80
26 }
27 ],
28 "marker": "listener-005A",
29 "nextMarker": null,
30 "isTruncated": false,
31 "maxKeys": 2
32}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_http_listener.py
Query HTTPS listener
Retrieve all HTTPS listeners for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query the HTTPS listener with the following code
Function declaration
1 def describe_app_https_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppHTTPSListeners: Query HTTPS Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 90,
5 "backendPort": 90,
6 "scheduler": "LeastConnection",
7 "keepSession": false,
8 "keepSessionType": null,
9 "keepSessionTimeout": null,
10 "keepSessionCookieName": null,
11 "xForwardedFor": false,
12 "serverTimeout": 30,
13 "certIds": ["cert-zfj2ey2z4kmm"]
14 },
15 {
16 "listenerPort": 95,
17 "backendPort": 95,
18 "scheduler": "LeastConnection",
19 "keepSession": false,
20 "keepSessionType": null,
21 "keepSessionTimeout": null,
22 "keepSessionCookieName": null,
23 "xForwardedFor": false,
24 "serverTimeout": 1800,
25 "certIds": ["cert-zfj2ey2z4kmm"]
26 }
27 ],
28 "marker": "listener-005A",
29 "nextMarker": null,
30 "isTruncated": false,
31 "maxKeys": 2
32}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_https_listener.py
Query application SSL listeners
Retrieve all SSL listeners for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query the application SSL listener with the following code
Function declaration
1 def describe_app_ssl_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppSSLListeners: Query SSL Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 80,
5 "scheduler": "RoundRobin",
6 "certIds": ["cert-zfj2ey2z4kmm"]
7 },
8 {
9 "listenerPort": 88,
10 "scheduler": "RoundRobin",
11 "certIds": ["cert-zfj2ey2z4kmm"]
12 }
13 ],
14 "marker": "listener-0050",
15 "nextMarker": null,
16 "isTruncated": false,
17 "maxKeys": 2
18}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_ssl_listener.py
Query all the listeners
Retrieve all listeners for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query all the listeners with the following code
Function declaration
1 def describe_app_all_listener(self, blb_id, listener_port=None,
2 marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppAllListeners: 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 "scheduler": "RoundRobin",
10 "listenerType": "UDP"
11 },
12 {
13 "listenerPort": 80,
14 "scheduler": "RoundRobin",
15 "listenerType": "HTTP",
16 "keepSession": false,
17 "xForwardFor": true,
18 "xForwardedProto": false,
19 "serverTimeout": 30,
20 "redirectPort": 0
21 },
22 {
23 "listenerPort": 81,
24 "scheduler": "RoundRobin",
25 "listenerType": "TCP",
26 "tcpSessionTimeout": 900
27 },
28 {
29 "listenerPort": 443,
30 "scheduler": "RoundRobin",
31 "listenerType": "SSL",
32 "certIds": [
33 "cert-gs8bktrm7drp"
34 ],
35 "dualAuth": false,
36 "encryptionType": "tls_cipher_policy_ie",
37 "encryptionProtocols": [
38 "sslv3",
39 "tlsv10",
40 "tlsv11",
41 "tlsv12"
42 ],
43 "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-ECDSA-RC4-SHA:ECDHE-ECDSA-DES-CBC3-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:ECDHE-RSA-RC4-SHA:ECDHE-RSA-DES-CBC3-SHA:RC4-SHA:AES128-GCM-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:AES128-SHA256:DES-CBC3-SHA"
44 },
45 {
46 "listenerPort": 444,
47 "scheduler": "RoundRobin",
48 "listenerType": "HTTPS",
49 "keepSession": false,
50 "xForwardFor": false,
51 "xForwardedProto": false,
52 "serverTimeout": 30,
53 "certIds": [
54 "cert-gs8bktrm7drp"
55 ],
56 "dualAuth": false,
57 "encryptionType": "tls_cipher_policy_1_1",
58 "encryptionProtocols": [
59 "tlsv11",
60 "tlsv12"
61 ],
62 "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"
63 }
64 ]
65}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_all_listener.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_app_listeners(self, blb_id, portList,
2 client_token=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DeleteAppListeners: Delete Listeners
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_app_listener.py
Create Strategy
Create forwarding policies for the specified application BLB listener port.
The following code can be used to create policy
Function declaration
1 def create_policys(self, blb_id, listener_port,
2 app_policy_vos, client_token=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreatePolicys: Create Policy
Response Value
Operation succeeded:
1{
2 "listenerPort": 98,
3 "type": "HTTP",
4 "appPolicyVos": [
5 {
6 "appServerGroupId": "sg-db3975dc",
7 "backendPort": 83,
8 "priority": 100,
9 "desc": "aa",
10 "ruleList": [
11 {
12 "key": "*",
13 "value": "*"
14 }
15 ]
16 }
17 ]
18}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_policys.py
Query policy information under the corresponding BLB port
Retrieve all server groups for the specified LoadBalancer. Filter results by listener port. Results are paginated by markers, with a default page size of 1000, adjustable using the max_keys parameter.
You can query policy information under the corresponding BLB port with the following code
Function declaration
1 def describe_policys(self, blb_id, listener_port,
2 marker=None, max_keys=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribePolicys: Query Policy Information under the Corresponding BLB Port
Response Value
Operation succeeded:
1{
2 "marker": "rs-012310",
3 "isTruncated": true,
4 "maxKeys": 1000,
5 "nextMarker": "rs-013214",
6 "policyList":[
7 {
8 "id":"policy_id",
9 "appServerGroupId":”sg_id“,
10 "appServerGroupName":”sg_name“,
11 "frontendPort":80,
12 "type":"TCP",
13 "backendPort":98,
14 "portType":"TCP",
15 "priority":100,
16 "desc":"aa",
17 "groupType":"Server",
18 "ruleList": [
19 {
20 "key": "host",
21 "value": "*.baidu.com"
22 }
23 ]
24 }
25 ]
26}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_policys.py
Batch Delete Policy
Batch delete forwarding policies for the specified BLB listener port.
You can delete policies in batches with the following code
Function declaration
1 def delete_policys(self, blb_id, listener_port,
2 policys_list,
3 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DeletePolicys: Delete Policies in Batches
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_policys.py
Create application BLB server group
Create a server group under the specified application BLB to bind real servers and expose the relevant listener ports.
You can create an application BLB server group with the following code
Function declaration
1def create_app_server_group(self, blb_id,
2 name=None,
3 desc=None,
4 backend_server_list=None,
5 client_token=None,
6 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: CreateaAppServerGroup: Create an Application Server Group
Response Value
Operation succeeded:
1{
2 "status":"available",
3 "name":"exmaple",
4 "id":"sg-b71fc32a",
5 "desc":"example"
6}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_app_server_group.py
Update application BLB server group
Update parameters for listeners in the specified LoadBalancer. All provided domains in the request will be updated, while unspecified domains remain unchanged. Listeners are identified by their ports.
You can update an application BLB server group with the following code
Function declaration
1def update_app_server_group(self, blb_id, sg_id,
2 name=None,
3 desc=None,
4 client_token=None,
5 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppServerGroup: Update Server 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_update_app_server_group.py
Query application BLB server group
Retrieve all server groups under the specified LoadBalancer. The results support marker-based pagination with a default page size of 1000, adjustable via the maxKeys parameter.
You can query the application BLB server group with the following code
Function declaration
1def describe_app_server_group(self, blb_id,
2 name=None,
3 exactly_match=None,
4 marker=None,
5 max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppServerGroup: Query Server Group
Response Value
Operation succeeded:
1{
2 "max_keys":1000,
3 "next_marker":None,
4 "app_server_group_list":[
5 {
6 "status":"available",
7 "desc":"example2",
8 "id":"sg-0a950a17",
9 "name":"exmaple2",
10 "port_list":[
11 ]
12 }
13 ],
14 "marker":"60742",
15 "is_truncated":false
16}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_server_group.py
Delete application BLB server group
Remove a server group identified by its server group ID.
You can delete an application BLB server group with the following code
Function declaration
1def delete_app_server_group(self, blb_id, sg_id,
2 client_token=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DeleteAppServerGroup: Delete Server 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_delete_app_server_group.py
Create port of application BLB server group
Within the specified application BLB, create a backend port for the server group to distribute traffic using weighted round-robin across the servers in its associated server list.
You can create an application BLB server group port with the following code
Function declaration
1def create_app_server_group_port(self, blb_id, sg_id,
2 port, protocol_type,
3 health_check=None,
4 health_check_port=None,
5 health_check_urlpath=None,
6 health_check_timeout_insecond=None,
7 health_check_interval_insecond=None,
8 health_check_down_retry=None,
9 health_check_up_retry=None,
10 health_check_normal_status=None,
11 udp_health_check_string=None,
12 client_token=None,
13 config=None)
Parameter meaning
Refer to the OpenAPI documentation: CreateAppServerGroupPort: Create Application Server Group Port
Response Value
Operation succeeded:
1{
2 "status":"available",
3 "id":"port-ba811b4f"
4}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_create_app_server_group_port.py
Update application BLB server group port
Update the port for the server group based on its ID.
You can update an application BLB server group port with the following code
Function declaration
1def update_app_server_group_port(self, blb_id, sg_id, port_id,
2 health_check=None,
3 health_check_port=None,
4 health_check_urlpath=None,
5 health_check_timeout_insecond=None,
6 health_check_interval_insecond=None,
7 health_check_down_retry=None,
8 health_check_up_retry=None,
9 health_check_normal_status=None,
10 udp_health_check_string=None,
11 client_token=None,
12 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppServerGroupPort: Update Server Group Port
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_app_server_group_port.py
Delete application BLB server group port
Remove a server group port identified by its server group ID.
You can delete the application BLB server group port with the following code
Function declaration
1def delete_app_server_group_port(self, blb_id, sg_id,
2 port_list,
3 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: DeleteAppServerGroupPort: Delete Server Group Port
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_app_server_group_port.py
Add application BLB real server
Bind a real server (RS) to the specified application BLB and server group.
You can add the application BLB real server with the following code
Function declaration
1 def create_app_blb_rs(self, blb_id, sg_id,
2 backend_server_list,
3 client_token=None,
4 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Add Application BLB Real Server (RS)
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_app_blb_rs.py
Update application BLB real server
Update TCP listener parameters for the specified LoadBalancer. All specified domains in the request parameters will be updated, while unspecified domains will remain unchanged. Listeners must be designated via ports.
You can update the application BLB real server with the following code
Function declaration
1 def update_app_blb_rs(self, blb_id, sg_id,
2 backend_server_list,
3 client_token=None,
4 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Update the weight of RS mounted under the Server 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_update_app_blb_rs.py
Delete application BLB real server
Remove a server group identified by its server group ID.
You can delete the application BLB real server with the following code
Function declaration
1 def delete_app_blb_rs(self, blb_id, sg_id,
2 backend_server_list,
3 client_token=None,
4 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Delete Application BLB 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_delete_app_blb_rs.py
Query the RS information under the server group
Query RS information under the specified server group of the specified LoadBalancer
You can query the RS information under the server group with the following code
Function declaration
1 def describe_app_blb_rs(self, blb_id, sg_id,
2 marker=None, max_keys=None,
3 config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Query the RS List Information under the Server Group
Response Value
Operation succeeded:
1{
2 "marker": "rs-012310",
3 "isTruncated": false,
4 "maxKeys": 1000,
5 "nextMarker": "rs-013214",
6 "backendServerList": [
7 {
8 "instanceId": "BCC_UUID",
9 "privateIp": "192.168.0.1",
10 "weight": "WEIGHT",
11 "portList": [
12 {
13 "listenerPort": "LISTENER_PORT1",
14 "backendPort": "BACKEND_PORT1",
15 "portType": "HTTP",
16 “healthCheckPortType”: "HTTP",
17 "portId": "port_xxx",
18 "policyId": "policy_xxx",
19 "status": "Alive"
20 }
21 ]
22 }
23 ]
24}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_app_blb_rs.py
Query real server mounted on application BLB
Retrieve the list of servers bound to the server group.
You can query the real server mounted on application BLB with the following code
Function declaration
1 def describe_rs_mount(self, blb_id, sg_id, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Query Servers Bound under the Server Group
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "BCC_UUID",
5 "privateIp": "192.168.0.1",
6 "weight": "WEIGHT",
7 "portList": [
8 {
9 "listenerPort": "LISTENER_PORT1",
10 "backendPort": "BACKEND_PORT1",
11 "portType": "HTTP",
12 “healthCheckPortType”: "HTTP",
13 "portId": "port_xxx",
14 "policyId": "policy_xxx",
15 "status": "Alive"
16 }
17 ]
18 }
19 ]
20}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_rs_mount.py
Query real server not mounted on application BLB
Retrieve the list of RS that are not bound within the server group.
You can query the real server not mounted on application BLB with the following code
Function declaration
1 def describe_rs_unmount(self, blb_id, sg_id, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: Query RS Unbound under the Server Group
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "BCC_UUID",
5 "privateIp": null,
6 "weight": null,
7 "portList": []
8 }
9 ]
10}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_rs_unmount.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_app_security_groups(self, blb_id, securitygroupids,
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_app_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_app_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_app_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_app_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_app_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_app_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_app_enterprise_security_groups.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_app_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_app_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_app_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_app_enterprise_security_groups.py.py
