Application 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) (*CreateLoadBalanceResult, 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 "desc": "",
5 "address": "192.168.0.24"
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
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
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": "For production environment",
8 "vpcId":"vpc-fy6vdykpwkqb",
9 "address": "192.168.0.24"
10 },
11 {
12 "blbId": "lb-gj5gVpeq",
13 "status": available,
14 "name": "nametest",
15 "desc": "For test environment",
16 "vpcId":"vpc-a8n5p6kybbx4",
17 "address": "192.168.0.25"
18 }
19 ],
20 "marker": "blb-0A20F971",
21 "nextMarker": "blb-0A20FB09",
22 "isTruncated": true,
23 "maxKeys": 2
24}
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 "subnetName": "System predefined subnet",
11 "subnetCider": "192.168.0.0/20",
12 "createTime":"2019-03-07T02:35:31Z",
13 "releaseTime":"2019-03-07T02:35:31Z",
14 "listener":[
15 {
16 "port":80,
17 "type": "TCP"
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_loadbalancer_detail.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
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
1func (c *Client) CreateAppTCPListener(blbId string, args *CreateAppTCPListenerArgs) error
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.go
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
1func (c *Client) CreateAppUDPListener(blbId string, args *CreateAppUDPListenerArgs) error
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.go
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
1func (c *Client) CreateAppHTTPListener(blbId string, args *CreateAppHTTPListenerArgs) error
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.go
Create HTTPS listener
Create an HTTPS-based application listener for the specified LoadBalancer to listen on a frontend port, convert all HTTPS requests to HTTP via SSL termination, and forward them to the backend port managed by real servers following defined policies.
You can create an HTTPS listener with the following code
Function declaration
1func (c *Client) CreateAppHTTPSListener(blbId string, args *CreateAppHTTPSListenerArgs) error
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.go
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
1func (c *Client) CreateAppSSLListener(blbId string, args *CreateAppSSLListenerArgs) error
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.go
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
1func (c *Client) UpdateAppTCPListener(blbId string, args *UpdateAppTCPListenerArgs) error
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.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) UpdateAppUDPListener(blbId string, args *UpdateAppUDPListenerArgs) error
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.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) UpdateAppHTTPListener(blbId string, args *UpdateAppHTTPListenerArgs) error
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.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) UpdateAppHTTPSListener(blbId string, args *UpdateAppHTTPSListenerArgs) error
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.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) UpdateAppSSLListener(blbId string, args *UpdateAppSSLListenerArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppSSLListener: 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_app_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) DescribeAppTCPListeners(blbId string, args *DescribeAppListenerArgs) (*DescribeAppTCPListenersResult, error)
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_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) DescribeAppUDPListeners(blbId string, args *DescribeAppListenerArgs) (*DescribeAppUDPListenersResult, error)
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_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) DescribeAppHTTPListeners(blbId string, args *DescribeAppListenerArgs) (*DescribeAppHTTPListenersResult, 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 "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_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) DescribeAppHTTPSListeners(blbId string, args *DescribeAppListenerArgs) (*DescribeAppHTTPSListenersResult, error)
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_listeners.go
Query application SSL listeners
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 application SSL listener with the following code
Function declaration
1func (c *Client) DescribeAppSSLListeners(blbId string, args *DescribeAppListenerArgs) (*DescribeAppSSLListenersResult, error)
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_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) DescribeAppAllListeners(blbId string, args *DescribeAppListenerArgs) (*DescribeAppAllListenersResult, error)
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_listeners.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) DeleteAppListeners(blbId string, args *DeleteAppListenersArgs) error
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_listeners.go
Create Strategy
Create policies under the specified application BLB listener port
You can create policies under the specified application BLB listener port with the following code
Function declaration
1func (c *Client) CreatePolicys(blbId string, args *CreatePolicysArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: CreatePolicys: Create Policies
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_policys_server_group.go
Query policy list
Query all server groups 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 information of all server groups under the specified LoadBalancer with the following code
Function declaration
1func (c *Client) DescribePolicys(blbId string, args *DescribePolicysArgs) (*DescribePolicysResult, error)
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_server_group.go
Delete strategy
Delete policies under the corresponding BLB port in batches
You can delete policies under the corresponding BLB port in batches with the following code
Function declaration
1func (c *Client) DeletePolicys(blbId string, args *DeletePolicysArgs) error
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.go
Add application BLB server group
Under the specified application BLB, create a server group to bind real servers and open corresponding ports for listeners.
You can create an application BLB server group with the following code
Function declaration
1func (c *Client) CreateAppServerGroup(blbId string, args *CreateAppServerGroupArgs) (*CreateAppServerGroupResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: CreateaAppServerGroup: Create an Application Server Group
Response Value
Operation succeeded:
1{
2 "id": "sg_short_id",
3 "name": "name",
4 "desc": "aaa",
5 "status": "available"
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.go
Update application BLB server group
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 an application BLB server group with the following code
Function declaration
1func (c *Client) UpdateAppServerGroup(blbId string, args *UpdateAppServerGroupArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppServerGroup: Update Application 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.go
Query application BLB server group
Query all server groups 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 the application BLB server group with the following code
Function declaration
1func (c *Client) DescribeAppServerGroup(blbId string, args *DescribeAppServerGroupArgs) (*DescribeAppServerGroupResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeAppServerGroup: Query Server Group
Response Value
Operation succeeded:
1{
2 "appServerGroupList":[
3 {
4 "id": "sg_short_id",
5 "name": "name",
6 "desc": "bbb",
7 "status": "available",
8 "portList":
9 [{
10 "id": "port_id"
11 "port": BACKEND_PORT,
12 "type": "TCP",
13 "healthCheck": "TCP",
14 "healthCheckNormalStatus": "^[1-5][0-9]*$",
15 "healthCheckPort": 90,
16 "healthCheckTimeoutInSecond": 2,
17 "healthCheckDownRetry": 3,
18 "healthCheckUpRetry": 3,
19 "healthCheckIntervalInSecond": 1,
20 "healthCheckUrlPath": "HEALTH_CHECK_URL_PATH",
21 "healtchCheckHost": www.xxx,
22 "status": "available"
23 }]
24 }
25 ],
26 "marker": "sg-012310",
27 "isTruncated": false,
28 "maxKeys": 1000,
29 "nextMarker": "sg-013214"
30}
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.go
Delete application BLB server group
Delete server group, specified by server group ID
You can delete an application BLB server group with the following code
Function declaration
1func (c *Client) DeleteAppServerGroup(blbId string, args *DeleteAppServerGroupArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: DeleteAppServerGroup: Delete Application 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.go
Add application BLB server group port
Under the specified application BLB, create a backend port for the server group, which distributes all traffic to this port through weighted round-robin to the servers in its bound server list.
You can create an application BLB server group port with the following code
Function declaration
1func (c *Client) CreateAppServerGroupPort(blbId string, args *CreateAppServerGroupPortArgs) (*CreateAppServerGroupPortResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: CreateAppServerGroupPort: Create Application Server Group Port
Response Value
Operation succeeded:
1{
2 "sgId":"sgid",
3 "type":"TCP",
4 "port": 80,
5 "healthCheck":"TCP",
6 "healthCheckTimeoutInSecond": 2,
7 "healthCheckDownRetry": 3,
8 "healthCheckUpRetry": 3,
9 "healthCheckIntervalInSecond":3
10}
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.go
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
1func (c *Client) UpdateAppServerGroupPort(blbId string, args *UpdateAppServerGroupPortArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: UpdateAppServerGroupPort: Update Application 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.go
Delete application BLB server group port
Delete server group port, specified by server group ID
You can delete an application BLB server group port with the following code
Function declaration
1func (c *Client) DeleteAppServerGroupPort(blbId string, args *DeleteAppServerGroupPortArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: DeleteAppServerGroupPort: Delete Application 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.go
Add an application BLB real server (RS)
Bind real server (RS) under specified application BLB and server group
You can add an application BLB real server (RS) with the following code
Function declaration
1func (c *Client) CreateBlbRs(blbId string, args *CreateBlbRsArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: CreateBlbRs: Add an 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_blb_rs.go
Update the weight of RS mounted under the server group
Update RS information under the specified server group
You can update the weight of RS mounted under the server group with the following code
Function declaration
1func (c *Client) UpdateBlbRs(blbId string, args *UpdateBlbRsArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: UpdateBlbRs: 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_blb_rs.go
Query the RS list information under the server group
Query all server groups 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 RS list information under the server group with the following code
Function declaration
1func (c *Client) DescribeBlbRs(blbId string, args *DescribeBlbRsArgs) (*DescribeBlbRsResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeBlbRs: 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": "i-fvdixxxx",
9 "privateIp": "192.168.0.1",
10 "weight": 100,
11 "portList": [
12 {
13 "listenerPort": 80,
14 "backendPort": "80",
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_blb_rs.go
Delete the RS mounted under the server group
Delete the real server (RS) mounted under the server group, which is specified by server group ID and real server (RS) ID, and supports deletion in batches
You can delete the RS mounted under the server group with the following code
Function declaration
1func (c *Client) DeleteBlbRs(blbId string, args *DeleteBlbRsArgs) error
Parameter Meaning
Refer to the OpenAPI documentation: DeleteBlbRs: Delete the 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_delete_blb_rs.go
Query RS bound under the server group
Query RS bound under the server group
You can query the RS bound under the server group with the following code
Function declaration
1func (c *Client) DescribeRsMount(blbId, sgId string) (*DescribeRsMountResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeRsMount: Query Servers Bound under the Server Group
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "i-fvdixxxx",
5 "privateIp": "192.168.0.1",
6 "weight": 100,
7 "portList": [
8 {
9 "listenerPort": 80,
10 "backendPort": "80",
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.go
Query RS unbound under the server group
Query RS unbound under the server group
You can query the RS unbound under the server group with the following code
Function declaration
1func (c *Client) DescribeRsUnMount(blbId, sgId string) (*DescribeRsMountResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: DescribeRsUnMount: Query RS Unbound under the Server Group
Response Value
Operation succeeded:
1{
2 "backendServerList": [
3 {
4 "instanceId": "i-fvdixxxx",
5 "privateIp": "192.168.0.1",
6 "weight": 100,
7 "portList": [
8 {
9 "listenerPort": 80,
10 "backendPort": "80",
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_unmount.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 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_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 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_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 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.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 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.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
