Service Release Point
Retrieve Endpoint
Before configuring the Endpoint for SDK usage, please refer to the developer guide section on Service Distribution Point Domain Name to understand Endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer to the service distribution point section of network products in Region Selection Guide.
Note: The service distribution point 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 AI Cloud's service publishing points, you must have a valid AK (Access Key ID) and SK (Secret Access Key) for signature authentication. AK/SK are system-generated strings used for user identification and signature verification during service access. You can obtain and understand your AK/SK information by following these steps:
Create a UserserviceClient
UserserviceClient serves the client for the service distribution point service, providing developers with a range of methods to interact with the services of the service distribution point. When creating a UserserviceClient, first configure a BceClientConfiguration-type config instance using Endpoint, AK and SK, and then use the config instance to configure the LbdcClient. The specific configuration method is as follows:
1String ak = "Your Ak";
2String sk = "Your Sk";
3String endpoint = "blb.bj.baidubce.com";
4BceClientConfiguration config = new BceClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(ak, sk));
6config.setEndpoint(endpoint);
7UserserviceClient userserviceClient = new UserserviceClient(config);
Create a service distribution point
Function declaration
1public CreateUserServiceResponse createUserService(CreateUserServiceRequest body, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Create Request Parameters of Service Distribution Point
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "service" : "testService.uservice-3a76ed46.beijing.baidubce.com"
4}
- 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: ExampleCreateUserService.java
Update service distribution point
Function declaration
1public void updateUserService(String service, UpdateUserServiceRequest body, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Update Request Parameters of Service Distribution Point
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: ExampleUpdateUserService.java
Bind service distribution point to instance
Function declaration
1public void bindInstance(String service, BindInstanceRequest body, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Bind Service Distribution Point to 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: ExampleBindInstance.java
Unbind service distribution point from instance
Function declaration
1public void unbindInstance(String service, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Unbind Service Distribution Point from 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: ExampleUnbindInstance.java
Add authentication information of service distribution point
Function declaration
1public void addAuth(String service, AddAuthRequest body, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Add Authentication Information Request Parameter of Service Distribution Point
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: ExampleAddAuth.java
Modify authentication information of service distribution point
Function declaration
1public void editAuth(String service, EditAuthRequest body, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Modify Authentication Information Request Parameter of Service Distribution Point
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: ExampleEditAuth.java
Delete authentication information of service distribution point
Function declaration
1public void removeAuth(String service, RemoveAuthRequest body, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Delete Authentication Information Request Parameter of Service Distribution Point
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: ExampleRemoveAuth.java
Query service distribution point list
Function declaration
1public ListUserServiceResponse listUserService(String marker, Integer maxKeys) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Query Request Parameters of Service Distribution Point List
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "services": [
4 {
5 "serviceId': "uservice-a223vc",
6 "name": "name",
7 "description": "",
8 "serviceName": "serviceName",
9 "bindType": "blb",
10 "instanceId": "lb-d3e2cf75",
11 "status": "inService",
12 "service": "xxx.baidubce.com",
13 "createTime": "2019-03-07T02:35:31Z",
14 "endpointCount": 1,
15 "endpointList": [
16 {
17 "endpointId': "endpoint-a223vc",
18 "uid': "e8deba4d81d3435bb4591ce97288f296",
19 "attachTime': "2019-03-07T02:35:31Z",
20 }
21 ],
22 "authList": [
23 {
24 "uid": "*",
25 "auth" : "allow"
26 }
27 ]
28
29 }
30 ],
31 "marker": "uservice-a032va",
32 "nextMarker": null,
33 "isTruncated": false,
34 "maxKeys": 100
35}
- 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: ExampleListUserService.java
Query service distribution point details
Function declaration
1public GetUserServiceResponse getUserService(String service) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Query Request Parameters of Service Distribution Point Details
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "serviceId': "uservice-a223vc",
4 "name": "name",
5 "description": "",
6 "serviceName": "serviceName",
7 "bindType": "blb",
8 "instanceId": "lb-d3e2cf75",
9 "status": "inService",
10 "service": "xxx.baidubce.com",
11 "createTime": "2019-03-07T02:35:31Z",
12 "endpointCount": 1,
13 "endpointList": [
14 {
15 "endpointId': "endpoint-a223vc",
16 "uid': "e8deba4d81d3435bb4591ce97288f296",
17 "attachTime': "2019-03-07T02:35:31Z",
18 }
19 ],
20 "authList": [
21 {
22 "uid": "*",
23 "auth" : "allow"
24 }
25 ]
26}
- 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: ExampleGetUserService.java
Delete service distribution point
Function declaration
1public void deleteUserService(String service, String clientToken) {
2}
Parameter Meaning
Refer to the OpenAPI documentation: Delete Request Parameter of Service Distribution Point
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: ExampleDeleteUserService.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 }
