Application BLB instance
Retrieve Endpoint
Before configuring the Endpoint for SDK usage, please refer to the developer guide section on BLB Service Domain Name to understand Endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer to the network product BLB section in Region Selection Guide.
Note: The Baidu Load Balance (BLB) API supports both HTTP and HTTPS calling methods. To enhance data security, it is recommended to call via HTTPS.
Retrieve AK/SK
To use Baidu Load Balancer (BLB) on Baidu AI Cloud, you need a valid AK (Access Key ID) and SK (Secret Access Key) for signature authentication. AK/SK are system-generated strings that identify users and authenticate service access. You can find and understand your AK/SK information through the following steps:
Create AppBlbClient
AppBlbClient serves as the client for the Baidu Load Balance (BLB) (application BLB) services, providing developers with a range of methods to interact with Baidu Load Balance (BLB) services. When creating an AppBlbClient, first configure a BceClientConfiguration-type config instance using Endpoint, AK and SK, and then use the config instance to configure the AppBlbClient. The specific configuration method is as follows:
1static final String ENDPOINT = ""
2static final String AK = "";
3static final String SK = "";
4BlbClientConfiguration config = new BlbClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(ak, sk));
6config.setEndpoint(endpoint);
7AppBlbClient appBlbClient = new AppBlbClient(config);
Create BLB Instance
Function declaration
1public CreateBlbResponse createBlb(String name, String desc, String vpcId, String subnetId, List<Tag> tags) {
2}
3public CreateBlbResponse createBlb(CreateBlbRequest createBlbRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: createloadbalancer: Create Instance Request Parameter
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "blbId": "lb-BLuOPSLZ",
4 "name": "blb-for-test",
5 "address": "192.168.0.24",
6 "desc": "myblb"
7}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateBlb.java
Update BLB instance
Function declaration
1public void modifyBlbAttributes(String blbId, String name, String desc) {
2}
3public void modifyBlbAttributes(ModifyBlbAttributesRequest modifyBlbAttributesRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: updateloadbalancer: Update Instance Request Parameter
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleModifyAppBlbAttributes.java
Query existing BLB instances
Function declaration
1public ListBlbResponse listBlbs(String address, String name, String blbId, String bccId) {
2}
3public ListBlbResponse listBlbs(ListBlbRequest listBlbRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeloadbalancers: Query Existing BLB Instance Request Parameter
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "blbList": [
4 {
5 "blbId": "lb-a7e5zPPk",
6 "status": available,
7 "name": "test-blb",
8 "desc": desc,
9 "address": "192.168.0.23"
10 },
11 {
12 "blbId": "lb-gj5gVpeq",
13 "status": available,
14 "name": "nametest",
15 "desc": desc,
16 "address": "192.168.0.24",
17 "publicIp": "123.2.3.4"
18 }
19 ],
20 "marker": "blb-0A20F971",
21 "nextMarker": "blb-0A20FB09",
22 "isTruncated": true,
23 "maxKeys": 2
24}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleListAppBlbs.java
Query BLB instance details
Function declaration
1public BlbInstance blbDetail(BlbDetailRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: describeloadbalancers: Query Existing BLB Instance Request Parameter
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "blbId":"lb-gj5gVpeq",
4 "status":"available",
5 "name":"nametest",
6 "desc":"",
7 "address":"192.168.0.2",
8 "publicIp":"123.2.3.4",
9 "cidr":"192.168.0.0/16",
10 "vpcName":"test",
11 "createTime":"2019-03-07T02:35:31Z",
12 "releaseTime":"2019-03-07T02:35:31Z",
13 "listener":[
14 {
15 "port":80,
16 "backendPort":90,
17 "type": "TCP",
18 "healthCheckType": "TCP",
19 "healthCheckstatus": "Alive"
20 }
21 ]
22}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleAppBlbDetail.java
Delete BLB instance
Function declaration
1public void deleteBlb(String blbId) {
2}
3public void deleteBlb(DeleteBlbRequest deleteBlbRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: deleteloadbalancer: Delete BLB Instance Request Parameter
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDeleteAppBlb.java
Create TCP listener
Function declaration
1public void createListener(BlbListenerRequest blbListenerRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: createapptcplistener: Create TCP Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppTcpListener.java
Create UDP listener
Function declaration
1public void createListener(BlbListenerRequest blbListenerRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: createappudplistener: Create UDP Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppUdpListener.java
Create HTTP listener
Function declaration
1public void createListener(BlbListenerRequest blbListenerRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: createapphttplistener: Create HTTP Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppHttpListener.java
Create HTTPS listener
Function declaration
1public void createListener(BlbListenerRequest blbListenerRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: createapphttpslistener: Create HTTPS Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppHttpsListener.java
Create SSL listener
Function declaration
1public void createListener(BlbListenerRequest blbListenerRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: createappssllistener: Create SSL Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppSslListener.java
Update TCP listener
Function declaration
1public void modifyListenerAttributes(BlbListenerRequest modifyListenerAttributesRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: updateapptcplistener: Update TCP Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppTcpListener.java
Update UDP listener
Function declaration
1public void modifyListenerAttributes(BlbListenerRequest modifyListenerAttributesRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: updateappudplistener: Update UDP Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppUdpListener.java
Update HTTP listener
Function declaration
1public void modifyListenerAttributes(BlbListenerRequest modifyListenerAttributesRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: updateapphttplistener: Update HTTP Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppHttpListener.java
Update HTTPS listener
Function declaration
1public void modifyListenerAttributes(BlbListenerRequest modifyListenerAttributesRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: updateapphttpslistener: Update HTTPS Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppHTTPSListener.java
Update SSL listener
Function declaration
1public void modifyListenerAttributes(BlbListenerRequest modifyListenerAttributesRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: updateappssllistener: Update SSL Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppSSLListener.java
Query TCP listener
Function declaration
1public ListListenerResponse<TcpListener> listTcpListener(String blbId) {
2}
3public ListListenerResponse listListener(ListListenerRequest listListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeapptcplisteners: Query Application TCP Listener Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "listenerList": [
4 {
5 "listenerPort" : 800,
6 "scheduler" : "RoundRobin",
7 "tcpSessionTimeout" : 900
8 },
9 {
10 "listenerPort" : 808,
11 "scheduler" : "RoundRobin",
12 "tcpSessionTimeout" : 900
13 }
14 ],
15 "marker": "listener-0050",
16 "nextMarker": null,
17 "isTruncated": false,
18 "maxKeys": 1000
19}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppTCPListeners.java
Query UDP listener
Function declaration
1public ListListenerResponse<UdpListener> listUdpListener(String blbId) {
2}
3public ListListenerResponse listListener(ListListenerRequest listListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeappudplisteners: Query UDP Listener Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "listenerList": [
4 {
5 "listenerPort" : 53,
6 "scheduler" : "RoundRobin",
7 "udpSessionTimeout" : 30
8 },
9 {
10 "listenerPort" : 54,
11 "scheduler" : "RoundRobin",
12 "udpSessionTimeout" : 30
13 }
14 ],
15 "marker": "listener-0050",
16 "nextMarker": null,
17 "isTruncated": false,
18 "maxKeys": 1000
19}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppUDPListeners.java
Query HTTP listener
Function declaration
1public ListListenerResponse<HttpListener> listHttpListener(String blbId) {
2}
3public ListListenerResponse listListener(ListListenerRequest listListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeapphttplisteners: Query HTTP Listener Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "listenerList": [
4 {
5 "listenerPort" : 80,
6 "scheduler" : "RoundRobin",
7 "keepSession" : false,
8 "xForwardedFor" : true,
9 "xForwardedProto" : false,
10 "serverTimeout" : 30,
11 "redirectPort" : 0
12 },
13 {
14 "listenerPort" : 801,
15 "scheduler" : "RoundRobin",
16 "keepSession" : false,
17 "xForwardedFor" : true,
18 "xForwardedProto" : false,
19 "serverTimeout" : 30,
20 "redirectPort" : 0
21 }
22 ],
23 "marker": "listener-005A",
24 "nextMarker": "listener-0322",
25 "isTruncated": true,
26 "maxKeys": 1000
27}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppHTTPListeners.java
Query HTTPS listener
Function declaration
1public ListListenerResponse<HttpsListener> listHttpsListener(String blbId) {
2}
3public ListListenerResponse listListener(ListListenerRequest listListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeapphttpslisteners: Query HTTPS Listener Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "listenerList": [
4 {
5 "listenerPort" : 443,
6 "scheduler" : "RoundRobin",
7 "keepSession" : false,
8 "xForwardedFor" : true,
9 "xForwardedProto" : false,
10 "serverTimeout" : 30,
11 "certIds" : [ "cert-gs8bktrm7drp" ],
12 "encryptionType" : "tls_cipher_policy_default",
13 "encryptionProtocols" : [ "tlsv10", "tlsv11", "tlsv12" ],
14 "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",
15 "dualAuth" : false,
16 "clientCertIds" : [ ]
17 },
18 {
19 "listenerPort" : 448,
20 "scheduler" : "RoundRobin",
21 "keepSession" : false,
22 "xForwardedFor" : true,
23 "xForwardedProto" : false,
24 "serverTimeout" : 30,
25 "certIds" : [ "cert-gs8bktrm7drp" ],
26 "encryptionType" : "tls_cipher_policy_default",
27 "encryptionProtocols" : [ "tlsv10", "tlsv11", "tlsv12" ],
28 "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",
29 "dualAuth" : false,
30 "clientCertIds" : [ ]
31 }
32 ],
33 "marker": "listener-005A",
34 "nextMarker": "listener-0322",
35 "isTruncated": true,
36 "maxKeys": 1000
37}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppHTTPListeners.java
Query SSL listener
Function declaration
1public ListListenerResponse<SslListener> listSslListener(String blbId) {
2}
3public ListListenerResponse listListener(ListListenerRequest listListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeappssllisteners: Query Application SSL Listener Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "listenerList" : [
4 {
5 "listenerPort" : 444,
6 "scheduler" : "RoundRobin",
7 "certIds" : [ "cert-gs8bktrm7drp" ],
8 "encryptionType" : "tls_cipher_policy_default",
9 "encryptionProtocols" : [ "tlsv10", "tlsv11", "tlsv12" ],
10 "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",
11 "dualAuth" : false,
12 "clientCertIds" : [ ],
13 "serverTimeout" : 900
14 },
15 {
16 "listenerPort" : 445,
17 "scheduler" : "RoundRobin",
18 "certIds" : [ "cert-4cn1jhphn747" ],
19 "encryptionType" : "tls_cipher_policy_default",
20 "encryptionProtocols" : [ "tlsv10", "tlsv11", "tlsv12" ],
21 "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",
22 "dualAuth" : false,
23 "clientCertIds" : [ ],
24 "serverTimeout" : 900
25 }
26 ],
27 "marker": "listener-0050",
28 "nextMarker": null,
29 "isTruncated": false,
30 "maxKeys": 1000
31}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppSSLListeners.java
Query all listeners
Function declaration
1public ListListenerResponse<AllListener> listAllListener(String blbId) {
2}
3public ListListenerResponse listListener(ListListenerRequest listListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeappalllisteners: Query All Listener Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "listenerList" : [
4 {
5 "listenerPort" : 53,
6 "scheduler" : "RoundRobin",
7 "listenerType" : "UDP",
8 "udpSessionTimeout" : 900
9 },
10 {
11 "listenerPort" : 80,
12 "scheduler" : "RoundRobin",
13 "listenerType" : "HTTP",
14 "keepSession" : false,
15 "xForwardFor" : true,
16 "xForwardedProto" : false,
17 "serverTimeout" : 30,
18 "redirectPort" : 0
19 },
20 {
21 "listenerPort" : 443,
22 "scheduler" : "RoundRobin",
23 "listenerType" : "HTTPS",
24 "keepSession" : false,
25 "xForwardFor" : true,
26 "xForwardedProto" : false,
27 "serverTimeout" : 30,
28 "certIds" : [ "cert-gs8bktrm7drp" ],
29 "dualAuth" : false,
30 "encryptionType" : "tls_cipher_policy_default",
31 "encryptionProtocols" : [ "tlsv10", "tlsv11", "tlsv12" ],
32 "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"
33 },
34 {
35 "listenerPort" : 444,
36 "scheduler" : "RoundRobin",
37 "listenerType" : "SSL",
38 "serverTimeout" : 900,
39 "certIds" : [ "cert-gs8bktrm7drp" ],
40 "dualAuth" : false,
41 "encryptionType" : "tls_cipher_policy_default",
42 "encryptionProtocols" : [ "tlsv10", "tlsv11", "tlsv12" ],
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-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"
44 },
45 {
46 "listenerPort" : 800,
47 "scheduler" : "RoundRobin",
48 "listenerType" : "TCP",
49 "tcpSessionTimeout" : 900
50 }
51 ],
52 "marker": "listener-0050",
53 "nextMarker": null,
54 "isTruncated": false,
55 "maxKeys": 1000
56}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppAllListeners.java
Delete listener
Function declaration
1public void deleteListener(String blbId, List<Integer> portList) {
2}
3public void deleteListener(DeleteListenerRequest deleteListenerRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: deleteapplisteners: Delete Listener Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDeleteAppListeners.java
Create Strategy
Function declaration
1public CreateAppPolicyResponse createPolicys(String blbId, Integer listenerPort, String type, List<AppPolicy> appPolicyVos) {
2}
3public CreateAppPolicyResponse createPolicys(AppPolicyRequest appPolicyRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: createpolicys: Create Policy Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreatePolicys.java
Query policy list
Function declaration
1public ListAppPolicyResponse listPolicys(String blbId, Integer port) {
2}
3public ListAppPolicyResponse listPolicys(ListAppPolicyRequest listAppPolicyRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describepolicys: Query Policy Information Request Parameters under the Corresponding BLB Port
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "policyList" : [
4 {
5 "id" : "policy-e18d7448",
6 "desc" : "",
7 "appServerGroupId" : "sg-b8221879",
8 "appServerGroupName" : "sgp-6FF0traU",
9 "groupType" : "Server",
10 "frontendPort" : 443,
11 "backendPort" : 80,
12 "portType" : "HTTP",
13 "priority" : 3,
14 "ruleList" : [
15 {
16 "key" : "uri",
17 "value" : "/aa"
18 }
19 ]
20 },
21 {
22 "id" : "policy-ed24ea7d",
23 "desc" : "",
24 "appServerGroupId" : "sg-b8221879",
25 "appServerGroupName" : "sgp-6FF0traU",
26 "groupType" : "Server",
27 "frontendPort" : 443,
28 "backendPort" : 80,
29 "portType" : "HTTP",
30 "priority" : 2,
31 "ruleList" : [
32 {
33 "key" : "host",
34 "value" : "www.abc.com"
35 }
36 ]
37 }
38 ],
39 "marker": "policy-e18d7448",
40 "nextMarker": null,
41 "isTruncated": false,
42 "maxKeys": 1000
43}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribePolicys.java
Delete strategy
Function declaration
1public void deletePolicys(String blbId, Integer port, List<String> policyIdList) {
2}
3public void deletePolicys(DeleteAppPolicyRequest deleteAppPolicyRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: deletepolicys: Delete Policy Request Parameters in Batches
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDeletePolicys.java
Create application server group
Function declaration
1public AppSgResponse createAppServerGroup(String blbId, String name, String desc, List<AppBackendServer> backendServerList) {
2}
3public AppSgResponse createAppServerGroup(AppSgRequest appSgRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: createaappservergroup: Create Application Server Group Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "id" : "sg-0aae4f4c",
4 "name" : "sgp-udT9IBTO",
5 "desc" : "",
6 "status" : "available"
7}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppServerGroup.java
Update server group
Function declaration
1public void modifyAppServerGroupAttributes(String blbId, String sgId, String name, String desc) {
2}
3public void modifyAppServerGroupAttributes(AppSgRequest appSgRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: updateappservergroup: Update Server Group Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppServerGroup.java
Query server group list
Function declaration
1public ListAppSgResponse listAppServerGroup(String blbId, String name) {
2}
3public ListAppSgResponse listAppServerGroup(ListAppSgRequest listAppSgRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeappservergroup: Query Application Server Group Request Parameters
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "appServerGroupList" : [
4 {
5 "id" : "sg-0aae4f4c",
6 "name" : "sgp-udT9IBTO",
7 "desc" : "",
8 "status" : "available",
9 "portList" : [ ]
10 },
11 {
12 "id" : "sg-b8221879",
13 "name" : "sgp-6FF0traU",
14 "desc" : "",
15 "status" : "available",
16 "portList" : [
17 {
18 "id" : "port-c5a87acf",
19 "status" : "available",
20 "port" : 80,
21 "type" : "HTTP",
22 "healthCheck" : "HTTP",
23 "healthCheckPort" : 80,
24 "healthCheckUrlPath" : "/",
25 "healthCheckTimeoutInSecond" : 3,
26 "healthCheckIntervalInSecond" : 3,
27 "healthCheckDownRetry" : 3,
28 "healthCheckUpRetry" : 3,
29 "healthCheckNormalStatus" : "http_2xx|http_3xx",
30 "udpHealthCheckString" : ""
31 }
32 ]
33 }
34 ],
35 "marker": "62672",
36 "nextMarker": null,
37 "isTruncated": false,
38 "maxKeys": 1000
39}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeAppServerGroup.java
Delete server group
Function declaration
1public void deleteAppServerGroup(String blbId, String sgId) {
2}
3public void deleteAppServerGroup(AppSgRequest appSgRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: deleteappservergroup: Delete Server Group Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDeleteAppServerGroup.java
Create server group port
Function declaration
1public AppSgPortResponse createAppServerGroupPort(AppSgPortRequest appSgPortRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: createappservergroupport: Create Request Parameters of Application Server Group Port
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "id" : "port-0b2c33c9",
4 "status" : "available"
5}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateAppServerGroupPort.java
Update the server group port
Function declaration
1public void modifyAppServerGroupPortAttributes(AppSgPortRequest appSgPortRequest) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: updateappservergroupport: Update Server Group Port Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateAppServerGroupPort.java
Delete server group port
Function declaration
1public void deleteAppServerGroupPort(String blbId, String sgId, List<String> portIdList) {
2}
3public void deleteAppServerGroupPort(AppSgPortRequest appSgPortRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: deleteappservergroupport: Delete Server Group Port Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDeleteAppServerGroupPort.java
Add an application BLB real server (RS)
Function declaration
1public void createBlbRs(String blbId, String sgId, List<AppBackendServer> backendServerList) {
2}
3public void createBlbRs(AppSgRequest appSgRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: createblbrs: Add Application BLB RS Request Parameters
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleCreateBlbRs.java
Update the weight of RS mounted under the server group
Function declaration
1public void modifyBlbRs(String blbId, String sgId, List<AppBackendServer> backendServerList) {
2}
3public void modifyBlbRs(AppSgRequest appSgRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: updateblbrs: Update the Weight Request Parameters of RS Mounted under the Server Group
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUpdateBlbRs.java
Query the RS list information under the server group
Function declaration
1public ListAppRsResponse listBlbRs(String blbId, String sgId) {
2}
3public ListAppRsResponse listBlbRs(ListAppRsRequest listAppRsRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describeblbrs: Query RS List Information Request Parameters under the Server Group
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "backendServerList" : [
4 {
5 "instanceId" : "i-q9dlHUJm",
6 "weight" : 100,
7 "privateIp" : "192.168.16.11",
8 "portList" : [
9 {
10 "listenerPort" : 80,
11 "backendPort" : "80",
12 "portType" : "HTTP",
13 "healthCheckPortType" : "HTTP",
14 "status" : "unknown",
15 "policyId" : "policy-58b2c7bf"
16 }
17 ]
18 }
19 ],
20 "marker": "apprs-6458619E",
21 "nextMarker": null,
22 "isTruncated": false,
23 "maxKeys": 1000
24}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeBlbRs.java
Delete the RS mounted under the server group
Function declaration
1public void deleteBlbRs(String blbId, String sgId, List<String> backendServerIdList) {
2}
3public void deleteBlbRs(AppRsRequest appRsRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: deleteblbrs: Delete the Request Parameters of RS Mounted under the Server Group
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDeleteBlbRs.java
Query RS bound under the server group
Function declaration
1public ListAppRsMountResponse listBlbRsMount(String blbId, String sgId) {
2}
3public ListAppRsMountResponse listBlbRsMount(ListAppRsRequest listAppRsRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describersmount: Query Request Parameters of Servers Bound under the Server Group
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "backendServerList" : [
4 {
5 "instanceId" : "i-q9dlHUJm",
6 "weight" : 100,
7 "privateIp" : "192.168.16.11",
8 "portList" : [
9 {
10 "listenerPort" : 80,
11 "backendPort" : "80",
12 "portType" : "HTTP",
13 "healthCheckPortType" : "HTTP",
14 "status" : "unknown",
15 "policyId" : "policy-58b2c7bf"
16 }
17 ]
18 }
19 ]
20}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeRsMount.java
Query RS unbound under the server group
Function declaration
1public ListAppRsUnMountResponse listBlbRsUnMount(String blbId, String sgId) {
2}
3public ListAppRsUnMountResponse listBlbRsUnMount(ListAppRsRequest listAppRsRequest) {
4}
Note:
The first API only supports a few common parameters
The second API supports more parameters but requires creating a request instance.
Parameter Meaning
Refer to the OpenAPI documentation: describersunmount: Query Request Parameters of RS Unbound under the Server Group
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "backendServerList" : [
4 {
5 "instanceId" : "i-q9dlHUJm",
6 "privateIp" : "192.168.16.11"
7 }
8 ]
9}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleDescribeRsUnMount.java
Bind to regular security group
Function declaration
1public void bindSg(SgOperateRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: bindsecuritygroups: Bind Regular Security Group Request Parameter
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleBindSg.java
Unbind from regular security group
Function declaration
1public void unBindSg(SgOperateRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: unbindsecuritygroups: Unbind Regular Security Group Request Parameter
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUnBindSg.java
Query regular security group list of BLB instances
Function declaration
1public ListBlbSgResponse listBlbSg(ListBlbSgRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: describesecuritygroups: Query Regular Security Group List Request Parameter of BLB Instance
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "blbSecurityGroups": [
4 {
5 "securityGroupDesc": "",
6 "securityGroupId": "g-4NxWoxeq",
7 "securityGroupName": "securitygroup-name",
8 "vpcName":"vpc-name",
9 "securityGroupRules": [
10 {
11 "destGroupId": "",
12 "destIp": "all",
13 "direction": "egress",
14 "ethertype": "IPv4",
15 "portRange": "1-65535",
16 "protocol": "all",
17 "securityGroupRuleId": "r-gkv8yupumvx2"
18 }
19 ]
20 }
21 ]
22}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleListAppBlbSg.java
Bind enterprise security group
Function declaration
1public void bindEsg(EsgOperateRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: bindenterprisesecuritygroups: Bind Enterprise Security Group Request Parameter
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleBindEsg.java
Unbind enterprise security group
Function declaration
1public void unBindEsg(EsgOperateRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: unbindenterprisesecuritygroups: Unbind Enterprise Security Group Request Parameter
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleUnBindEsg.java
Query the enterprise security group list of BLB instances
Function declaration
1public ListBlbEsgResponse listBlbEsg(ListBlbSgRequest request) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: describeenterprisesecuritygroups: Query Enterprise Security Group List Request Parameter of BLB Instance
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "enterpriseSecurityGroups": [
4 {
5 "enterpriseSecurityGroupId": "esg-g8z4qfj0m0bu",
6 "enterpriseSecurityGroupName": "test0627",
7 "enterpriseSecurityGroupDesc": "",
8 "enterpriseSecurityGroupRules": [
9 {
10 "remark": "All protocols",
11 "direction": "egress",
12 "action": "allow",
13 "priority": 1000,
14 "ethertype": "IPv6",
15 "portRange": "",
16 "sourceIp": "",
17 "destIp": "all",
18 "enterpriseSecurityGroupRuleId": "esgr-9tzd4yijcwqu",
19 "protocol": "all"
20 },
21 {
22 "remark": "",
23 "direction": "egress",
24 "action": "allow",
25 "priority": 1000,
26 "ethertype": "IPv4",
27 "portRange": "",
28 "sourceIp": "",
29 "destIp": "all",
30 "enterpriseSecurityGroupRuleId": "esgr-9je09z6bd9wv",
31 "protocol": "tcp"
32 },
33 {
34 "remark": "",
35 "direction": "ingress",
36 "action": "allow",
37 "priority": 1000,
38 "ethertype": "IPv4",
39 "portRange": "2",
40 "sourceIp": "all",
41 "destIp": "",
42 "enterpriseSecurityGroupRuleId": "esgr-jcej4juqbh49",
43 "protocol": "tcp"
44 }
45 ]
46 }
47 ]
48}
- Operation failed
For response exception list of operation failure, refer to the Baidu Load Balance (BLB) Exception List.
Code example
For specific code examples, refer to: ExampleListBlbEsg.java
Appendix
Public response information in Metadata format
1 {
2 "bceRequestId":"f5f0821d-45fe-439b-bbf4-fc48b639f84a",
3 "contentLength":28,
4 "contentType":"application/json;charset=UTF-8",
5 "date":1701917695000,
6 "server":"openresty/1.15.8.1"
7 }
