Ordinary BLB Instance
Create BLB
Create a BLB instance and receive the allocated service address and instance ID. The billing type is Postpay. Certification is mandatory. Users who have not completed certification can go to the certification section under "Security Certification" in the Baidu AI Cloud Official Website Console to complete the process.
You can create BLB instances with the following code.
Function declaration
1func (c *Client) CreateLoadBalancer(args *CreateLoadBalancerArgs) (*CreateLoadBalancerResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: CreateLoadBalancer: Create Instance
Response Value
Operation succeeded:
1{
2 "blbId": "lb-BLuOPSLZ",
3 "name": "blb-for-test",
4 "address": "192.168.0.24",
5 "desc": "myblb"
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.go
Query existing BLB instances
Retrieve information on all LoadBalancers associated with the user account. Supports fuzzy queries by LoadBalancer name or address, exact queries by LoadBalancer ID, and queries by bccId (limited to single and exact bccId queries). The query results include the load balancer instance containing the specified real server. The response is the intersection of multiple query conditions. If the BLB instance allows public network access, the response will include the public IP. Results support marker-based pagination, with a default page size of 1000, adjustable via the maxKeys parameter.
You can query existing BLB instances with the following code
Function declaration
1func (c *Client) DescribeLoadBalancers(args *DescribeLoadBalancersArgs) (*DescribeLoadBalancersResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeLoadBalancers: Query Existing BLB Instances
Response Value
Operation succeeded:
1{
2 "blbList": [
3 {
4 "blbId": "lb-a7e5zPPk",
5 "status": available,
6 "name": "test-blb",
7 "desc": desc,
8 "address": "192.168.0.23"
9 },
10 {
11 "blbId": "lb-gj5gVpeq",
12 "status": available,
13 "name": "nametest",
14 "desc": desc,
15 "address": "192.168.0.24",
16 "publicIp": "123.2.3.4"
17 }
18 ],
19 "marker": "blb-0A20F971",
20 "nextMarker": "blb-0A20FB09",
21 "isTruncated": true,
22 "maxKeys": 2
23}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to: example_describe_loadbalancers.go
Query BLB instance details
Query detailed information of all LoadBalancers under the user account by ID, including all listener port information of the LoadBalancer
You can query BLB instance details with the following code
Function declaration
1func (c *Client) DescribeLoadBalancerDetail(blbId string) (*DescribeLoadBalancerDetailResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeLoadBalancerDetail: Query BLB Instance Details
Response Value
Operation succeeded:
1{
2 "blbId":"lb-gj5gVpeq",
3 "status":"available",
4 "name":"nametest",
5 "desc":"",
6 "address":"192.168.0.2",
7 "publicIp":"123.2.3.4",
8 "cidr":"192.168.0.0/16",
9 "vpcName":"test",
10 "createTime":"2019-03-07T02:35:31Z",
11 "releaseTime":"2019-03-07T02:35:31Z",
12 "listener":[
13 {
14 "port":80,
15 "backendPort":90,
16 "type": "TCP",
17 "healthCheckType": "TCP",
18 "healthCheckstatus": "Alive"
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_loadbalancer_detail.go
Update BLB
Update configuration information of a specified LoadBalancer, including the name and description of the LoadBalancer instance.
You can update existing BLB instances with the following code
Function declaration
1func (c *Client) UpdateLoadBalancer(blbId string, args *UpdateLoadBalancerArgs) error
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.go
Delete BLB
Delete specified LoadBalancer. Deleted LoadBalancers cannot be recovered
You can delete existing BLB instances with the following code
Function declaration
1func (c *Client) DeleteLoadBalancer(blbId string) error
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.go
Update BLB ACL switch
Whether updated the specified LoadBalancer supports ACL function, supporting update types (general-purpose, application and IPv6)
You can update the BLB ACL switch with the following code
Function declaration
1func (c *Client) UpdateLoadBalancerAcl(blbId string, args *UpdateLoadBalancerAclArgs) error
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.go
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
1func (c *Client) CreateTCPListener(blbId string, args *CreateTCPListenerArgs) error
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.go
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
1func (c *Client) CreateUDPListener(blbId string, args *CreateUDPListenerArgs) error
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.go
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
1func (c *Client) CreateHTTPListener(blbId string, args *CreateHTTPListenerArgs) error
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.go
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
1func (c *Client) CreateHTTPSListener(blbId string, args *CreateHTTPSListenerArgs) error
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.go
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
1func (c *Client) CreateSSLListener(blbId string, args *CreateSSLListenerArgs) error
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.go
Query TCP listener
Query all TCP listeners under the specified LoadBalancer. It supports 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
1func (c *Client) DescribeTCPListeners(blbId string, args *DescribeListenerArgs) (*DescribeTCPListenersResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeTCPListeners: Query TCP 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_tcp_listeners.go
Query UDP listener
Query all UDP listeners under the specified LoadBalancer. It supports 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
1func (c *Client) DescribeUDPListeners(blbId string, args *DescribeListenerArgs) (*DescribeUDPListenersResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeUDPListeners: Query UDP Listeners
Response Value
Operation succeeded:
1{
2 "listenerList": [
3 {
4 "listenerPort": 80,
5 "backendPort": 80,
6 "scheduler": "RoundRobin",
7 "healthCheckType": "UDP",
8 "healthCheckTimeoutInSecond": 3,
9 "healthCheckInterval": 3,
10 "unhealthyThreshold": 3,
11 "healthyThreshold": 3,
12 "healthCheckString":"healthCheck",
13 "udpSessionTimeout":90
14 },
15 {
16 "listenerPort": 88,
17 "backendPort": 88,
18 "scheduler": "RoundRobin",
19 "healthCheckType": "UDP",
20 "healthCheckTimeoutInSecond": 2,
21 "healthCheckInterval": 4,
22 "unhealthyThreshold": 3,
23 "healthyThreshold": 3,
24 "healthCheckString":"healthCheck",
25 "udpSessionTimeout": 90
26 }
27 ],
28 "marker": "listener-0050",
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_udp_listeners.go
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 application HTTP listener information with the following code
Function declaration
1func (c *Client) DescribeHTTPListeners(blbId string, args *DescribeListenerArgs) (*DescribeHTTPListenersResult, error)
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_listeners.go
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 application HTTPS listener information with the following code
Function declaration
1func (c *Client) DescribeHTTPSListeners(blbId string, args *DescribeListenerArgs) (*DescribeHTTPSListenersResult, error)
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_listeners.go
Query SSL listener
Query all SSL listeners under the specified LoadBalancer. It supports 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 SSL listener with the following code
Function declaration
1func (c *Client) DescribeSSLListeners(blbId string, args *DescribeListenerArgs) (*DescribeSSLListenersResult, error)
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_listeners.go
Query all listeners
Query all listeners under the specified LoadBalancer. It supports 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 all the listeners with the following code
Function declaration
1func (c *Client) DescribeAllListeners(blbId string, args *DescribeListenerArgs) (*DescribeAllListenersResult, error)
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.go
Update TCP listener
Update the parameters of a TCP listener under the specified LoadBalancer. All fields specified in the request will be updated, while unspecified fields will remain unchanged. Listeners are identified by ports.
You can update a TCP listener with the following code
Function declaration
1func (c *Client) UpdateTCPListener(blbId string, args *UpdateTCPListenerArgs) error
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.go
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
1func (c *Client) UpdateUDPListener(blbId string, args *UpdateUDPListenerArgs) error
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.go
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
1func (c *Client) UpdateHTTPListener(blbId string, args *UpdateHTTPListenerArgs) error
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.go
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
1func (c *Client) UpdateHTTPSListener(blbId string, args *UpdateHTTPSListenerArgs) error
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.go
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
1func (c *Client) UpdateSSLListener(blbId string, args *UpdateSSLListenerArgs) error
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.go
Delete listener
Delete listeners under the specified LoadBalancer. Those listeners are specified by listener ports, and support deletion in batches.
You can delete the UDP listener with the following code
Function declaration
1func (c *Client) DeleteListeners(blbId string, args *DeleteListenersArgs) error
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.go
Add real server
Add real servers to the specified LoadBalancer, supporting batch addition.
You can add real servers with the following code
Function declaration
1func (c *Client) AddBackendServers(blbId string, args *AddBackendServersArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: AddBackendServers: Add Real Servers
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.go
Query real server health status
To query real server information under a specified LoadBalancer, the listener port shall be specified, and the response result will be the health status of the real servers. Results support marker-based pagination, with a default page size of 1000, which can be specified via the maxKeys parameter.
You can query real server health status with the following code
Function declaration
1func (c *Client) DescribeHealthStatus(blbId string, args *DescribeHealthStatusArgs) (*DescribeHealthStatusResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeHealthStatus: Query Real Server Health Status
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "i-YfAixxxx",
5 "weight": 50,
6 "status": "Alive"
7 }
8 ],
9 "type": "TCP",
10 "listenerPort": 80,
11 "backendPort": 80,
12 "marker": "rs-0A6BE9BB",
13 "isTruncated": false,
14 "maxKeys": 1000
15}
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.go
Query real server list
Query the real server list under the specified LoadBalancer. Results support marker-based pagination, with a default page size of 1000, which can be specified via the maxKeys parameter.
You can query real server list with the following code
Function declaration
1func (c *Client) DescribeBackendServers(blbId string, args *DescribeBackendServersArgs) (*DescribeBackendServersResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeBackendServers: Query Real Server List
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "i-YfAxxxx",
5 "weight": 50,
6 }
7 ],
8 "marker": "rs-0A6BE9BB",
9 "isTruncated": false,
10 "maxKeys": 1000
11}
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.go
Update a real server
Update the weight of real servers under the specified LoadBalancer, supporting batch modification.
You can update real servers with the following code
Function declaration
1func (c *Client) UpdateBackendServers(blbId string, args *UpdateBackendServersArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: UpdateBackendServers: Update Real Servers
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.go
Delete real server
Delete real servers under the specified LoadBalancer, with those real servers indicated by their identifiers. Deletion in batches is supported.
You can delete real servers with the following code
Function declaration
1func (c *Client) RemoveBackendServers(blbId string, args *RemoveBackendServersArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: RemoveBackendServers: Remove Real Servers
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.go
Bind to regular security group
Bind regular security group for specified LoadBalancer (standard, application and IPv6), supporting batch binding.
You can bind regular security groups to a specified LoadBalancer with the following code
Function declaration
1func (c *Client) BindSecurityGroups(blbId string, args *UpdateSecurityGroupsArgs) error
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.go
Unbind from regular security group
Unbind regular security group for specified LoadBalancer (standard, application and IPv6), supporting batch unbinding.
You can unbind regular security groups from a specified LoadBalancer with the following code
Function declaration
1func (c *Client) UnbindSecurityGroups(blbId string, args *UpdateSecurityGroupsArgs) error
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.go
Query regular security group list of BLB instances
Query regular security group information of specified LoadBalancer under user account by ID
You can query regular security group information of specified LoadBalancer under user account by ID with the following code
Function declaration
1func (c *Client) DescribeSecurityGroups(blbId string) (*DescribeSecurityGroupsResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeSecurityGroups: Query Regular Security Group List of BLB Instances
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.go
Bind enterprise security group
Bind enterprise security group for specified LoadBalancer (standard, application and IPv6), supporting batch binding.
You can bind enterprise security groups to a specified LoadBalancer with the following code
Function declaration
1func (c *Client) BindEnterpriseSecurityGroups(blbId string, args *UpdateEnterpriseSecurityGroupsArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: BindEnterpriseSecurityGroups: Bind Enterprise Security Groups
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.go
Unbind enterprise security group
Unbind enterprise security group for specified LoadBalancer (standard, application and IPv6), supporting batch unbinding.
You can unbind enterprise security groups from a specified LoadBalancer with the following code
Function declaration
1func (c *Client) UnbindEnterpriseSecurityGroups(blbId string, args *UpdateEnterpriseSecurityGroupsArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: UnbindEnterpriseSecurityGroups: Unbind Enterprise Security Groups
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.go
Query the enterprise security group list of BLB instances
Query enterprise security group information of specified LoadBalancer under user account by ID
You can query enterprise security group information of specified LoadBalancer under user account by ID with the following code
Function declaration
1func (c *Client) DescribeEnterpriseSecurityGroups(blbId string) (*DescribeEnterpriseSecurityGroupsResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: 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.go
