Baidu AI Cloud
中国站

百度智能云

Load Balance

Common BLB Instance Related Interface

CreateLoadBalancer

Description

  • Create a LoadBalancer and return the assigned service address and instance ID.
  • The payment method is postpaid.
  • Identity and access management is required. If it does not pass the identity and access management, you may go to identity and access management under the Security Authentication in Baidu Open Cloud Console for authentication.

Request Structure

POST /v{version}/blb?clientToken={clientToken} HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

{ 
    "name": name, 
	 "desc": desc, 
	 "vpcId": vpcId, 
	 "subnetId": subnetId, 
	 "address": address,
	 "type": type,
	 "eip":eip,
   "tags":[ 
    { 
        "tagKey": tagKey, 
        "tagValue": tagValue 
    } 
  ] 
} 

Request Header

There are no other special headers except the public headers.

Request Parameter

Parameter name Type Required or not Parameter position Description
version String Yes URL parameter API version number (the current value is 1)
clientToken String Yes Query parameter Idempotent Token, no longer than 64 bits
name String No RequestBody parameter To remember easily the name of LoadBalancer. It is 1-65 bytes in length beginning with a letter. It can contain letters, numbers and characters of - _ / .. This parameter will be generated automatically if not loaded
desc String No RequestBody parameter The description of the LoadBalancer instance is convenient for users to add more detailed description information. 0-450 bytes in length; support Chinese; empty by default
vpcId String Yes RequestBody parameter ID of the VPC to which the LoadBalancer instance belongs
subnetId String Yes RequestBody parameter ID of the subnet to which the LoadBalancer instance belongs
address String No RequestBody parameter Specifies the private IP address of the load balance instance, which must be included in the subnet IP address range.
type String No RequestBody parameter Specifies the type of load balance instance. If this parameter is not passed in, it defaults to the ordinary type. Passing in "ipv6" means to create an ipv6 type of BLB.
eip String No RequestBody parameter Bind the existing eip.
tags List<TagModel> No RequestBody parameter List of tag key-value pairs to be created

Return Status Code

"200" for return successful and Error Code for return failed.

Return Header

There are no other special headers except the public headers.

Return Parameter

Parameter name Type Description
address string The assigned intranet service address IP. Through this IP, the instance can be accessed through the intranet.
name string LoadBalancer name
blbId string LoadBalancer ID. Subsequent operations on this instance need to carry this ID in the request
desc string Description of LoadBalancer

Request Example

POST /v1/blb?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1 
HOST blb.bj.baidubce.com 
Authorization: authorization string 

{ 
    "name":"blb-for-test", 
	 "desc": "myblb", 
	 "vpcId": "vpc-fy6vdykpwkqb" ,
	 "subnetId": "sbn-a34td0pxcucd" ,
	 "address": "192.168.0.24",
	 "eip": "100.88.8.139"
} 

Response Example

HTTP/1.1 200 OK 
x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
Date: Wed, 10 Apr 2016 08:26:52 GMT 
Transfer-Encoding: chunked 
Content-Type: application/json;charset=UTF-8 
Server: BWS 

{ 
    "blbId": "lb-BLuOPSLZ", 
    "name": "blb-for-test", 
    "address": "10.32.251.93", 
	 "desc": "myblb" 
} 

DescribeLoadBalancers

Description

  • Query all LoadBalancer information under the user account.
  • Support query by LoadBalancer id, name and address. Matching rules support partial inclusion (regular is not supported).
  • Support query by bccId; currently support only single bccId query, and only precise query. The query result is a load balancing instance containing the backend server.
  • The return result is the intersection of multiple query conditions.
  • If the BLB instance has access to the public network, the return result will carry the public network IP.
  • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter.

Request Structure

GET /v{version}/blb?address={address}&name={name}&blbId={blbId}&bccId={bccId}&marker={marker}&maxKeys={maxKeys} HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

Request Header

There are no other special headers except the public headers.

Request Parameter

Parameter name Type Required or not Parameter position Description
version String Yes URL parameter API version number (the current value is 1)
address String No Query parameter LoadBalancer intranet service address to query in the format of dotted decimal
name String No Query parameter LoadBalancer name to query
blbId String No Query parameter LoadBalancer ID to query
bccId String No Query parameter LoadBalancer binding the BCC
marker String No Query parameter The starting location of query for batch acquisition of lists, and is one string generated by the system.
maxKeys int No Query parameter Maximum number contained in each page, generally not exceeding 1000. The default value is 1000.

Return Status Code

"200" for return successful and Error Code for return failed.

Return Header

There are no other special headers except the public headers.

Return Parameter

Parameter name Type Description
blbList List<BLBModel> List containing query results
marker string Mark the starting position of the query. The item does not exist if the result list is empty
isTruncated boolean True means there are additional data in the following pages and false means the current page is the last page.
nextMarker String The marker value requiring to be passed in order to acquire the next page. The domain doesn't appear when isTruncated is false.
maxKeys int Maximum number contained in each page.

Request Example

GET /v1/blb?name=test&maxKeys=2 HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

Response Example

HTTP/1.1 200 OK 
x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
Date: Wed, 10 Apr 2016 08:26:52 GMT 
Transfer-Encoding: chunked 
Content-Type: application/json;charset=UTF-8 
Server: BWS 

{ 
    "blbList": [ 
        { 
            "blbId": "lb-a7e5zPPk", 
            "status": available, 
            "name": "test-blb", 
	 	 	 "desc": desc, 
            "address": "10.32.249.113" 
        }, 
        { 
            "blbId": "lb-gj5gVpeq", 
            "status": available, 
            "name": "nametest", 
	 	 	 "desc": desc, 
            "address": "10.32.251.4", 
	 	 	 "publicIp": "123.2.3.4" 
        } 
    ], 
    "marker": "blb-0A20F971", 
    "nextMarker": "blb-0A20FB09", 
    "isTruncated": true, 
    "maxKeys": 2 
} 

DescribeLoadBalancerDetail

Description

  • Query details of all LoadBalancers under user account by id.
  • Contain all the listener port information of LoadBalancer.

Request Structure

GET /v{version}/blb/{blbId} HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

Request Header

There are no other special headers except the public headers.

Request Parameter

Parameter name Type Required or not Parameter position Description
version String Yes URL parameter API version number (the current value is 1)
blbId String Yes URL parameter The identifier of the LoadBalancer to query

Return Status Code

"200" for return successful and Error Code for return failed.

Return Header

There are no other special headers except the public headers.

Return Parameter

Parameter name Type Description
blbId String LoadBalancer identifier
status blbStatus BLB status
name String The name of the loadbalancer
desc String Description of LoadBalancer
address String Intranet address of LoadBalancer
publicIp String Public address of LoadBalancer
cidr String Network cidr of LoadBalancer
vpcName String Name of vpc to which LoadBalancer belongs
createTime String Creation time of LoadBalancer
releaseTime String Auto release time of LoadBalancer
listener List<ListenerModel> List of mount listeners under LoadBalancer
tags List<TagModel> List of tag key-value pairs
allowDelete Boolean Allow deletion

Request Example

GET /v1/blb/lb-7fb1e926 HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-04-10T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02 

Response Example

HTTP/1.1 200 OK 
x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
Date: Wed, 10 Apr 2016 08:26:52 GMT 
Transfer-Encoding: chunked 
Content-Type: application/json;charset=UTF-8 
Server: BWS 

{ 
    "blbId":"lb-gj5gVpeq", 
    "status":"available", 
    "name":"nametest", 
    "desc":"",     
    "address":"192.168.0.2", 
    "publicIp":"123.2.3.4", 
    "cidr":"192.168.0.0/16", 
    "vpcName":"test",         
    "createTime":"2019-03-07T02:35:31Z",    
    "releaseTime":"2019-03-07T02:35:31Z",   
    "listener":[                            
    { 
        "port":80,                      
        "backendPort":90,               
        "type": "TCP",                  
        "healthCheckType": "TCP",       
        "healthCheckstatus": "Alive"       
    } 
    ] 
} 

UpdateLoadBalancer

Description

Update the specified single LoadBalancer configuration information, including the name and description of the LoadBalancer instance.

Request Structure

PUT /v{version}/blb/{blbId}?clientToken={clientToken} HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

{ 
    "name": name, 
    "desc": desc 
} 

Request Header

There are no other special headers except the public headers.

Request Parameter

Parameter name Type Required or not Parameter position Description
version String Yes URL parameter API version number (the current value is 1)
blbId String Yes Query parameter The ID of the LoadBalancer to be updated
name String No RequestBody parameter LoadBalancer's name is easy to remember. It is 1-65 bytes in length beginning with a letter. It can contain letters, numbers and characters of -_/.. This parameter will be generated automatically if not loaded
desc String No RequestBody parameter The description of the LoadBalancer instance is convenient for users to add more detailed description information. It is 0-450 bytes in length and supports Chinese. Empty by default
allowDelete Boolean No RequestBody parameter Whether to allow deletion. The default value is true, which means deletion is allowed

Return Status Code

"200" for return successful and Error Code for return failed.

Return Header

There are no other special headers except the public headers.

Return Parameter

None

Request Example

PUT /v1/blb/lb-j8UqijYf?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1 
HOST blb.bj.baidubce.com 
Authorization bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-04-10T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02 

{ 
	 "name":"blb-for-test", 
	 "desc": "For testing" 
} 

Response Example

HTTP/1.1 200 OK 
x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
Date: Wed, 10 Apr 2016 08:26:52 GMT 
Transfer-Encoding: chunked 
Content-Type: application/json;charset=UTF-8 
Server: BWS 

DeleteLoadBalancer

Description

  • Release the specified LoadBalancer which cannot be retrieved.

Request Structure

DELETE /v{version}/blb/{blbId}?clientToken={clientToken} HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

Request Header

There are no other special headers except the public headers.

Request Parameter

Parameter name Type Required or not Parameter position Description
version String Yes URL parameter API version number (the current value is 1)
blbId String Yes URL parameter The ID of the LoadBalancer to be released
clientToken String Yes Query parameter Idempotent Token, no longer than 64 bits

Return Status Code

"200" for return successful and Error Code for return failed.

Return Header

There are no other special headers except the public headers.

Return Parameter

None

Request Example

DELETE /v1/blb/lb-j8UqijYf?clientToken=aabbccdd HTTP/1.1 
Host: blb.bj.baidubce.com 
Authorization: authorization string 

Response Example

HTTP/1.1 200 OK 
x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
Date: Fri, 03 Jun 2016 07:09:45 GMT 
Transfer-Encoding: chunked 
Content-Type: application/json;charset=UTF-8 
Server: BWS
Previous
Error Code
Next
Common BLB Back-end Server Related Interface