Service network interface card
Retrieve Endpoint
Before configuring the endpoint for SDK usage, please refer to the developer guide section on VPC Service Domain Name to understand endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer to the VPC section in the Region Selection Guide. The service network interface card service is part of the VPC service and adopts the VPC service domain name.
Retrieve AK/SK
To use the Baidu AI Cloud products, you need a Baidu AI Cloud account, a valid AK (Access Key ID) and SK (Secret Access Key) for signature certification. Your AK/SK information can be obtained and understood through the following steps:
Create EndpointClient
When creating a EndpointClient, first configure a EndpointClientConfiguration config instance using endpoint, AK and SK, and then use the config instance to configure the EndpointClient. The specific configuration method is as follows:
1static final String HOST = "";
2static final String AK = "";
3static final String SK = "";
4EndpointClientConfiguration config = new EndpointClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(AK, SK));
6config.setEndpoint(HOST);
7EndpointClient endpointClient = new EndpointClient(config);
Create service network interface card
Function declaration
1public CreateEndpointResponse createEndpoint(CreateEndpointRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Creating Service Network Interface Card
Response value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "id": "endpoint-11b09ce6",
4 "ipAddress": "192.168.0.1"
5}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleCreateEndpoint.java
Query service network interface card list
Function declaration
1public ListEndpointResponse listEndpoint(ListEndpointRequest request) {
2 ......
3}
Parameter meaning
Refer to OpenAPI documentation Request Parameters for Querying Service Network Interface Card List
Response value
- Operation succeeded
1{
2 "nextMarker": "endpoint-11a09ce9",
3 "marker": "endpoint-11a09ce9",
4 "maxKeys": 1,
5 "isTruncated": true,
6 "result": [
7 {
8 "endpointId': "endpoint-11a09ce9",
9 "name": "name",
10 "ipAddress": "192.168.0.5",
11 "status": "available",
12 "service": "www.test.com",
13 "subnetId": "sbn-crqu2vxzj049",
14 "createTime": "2019-03-07T02:35:31Z",
15 "description": "",
16 "productType": "postpay",
17 "vpcId": "vpc-q1hcnhf7nmve"
18 }
19 ],
20 "metadata": For details, refer to the metadata section in the appendix
21}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleListEndpoint.java
Query service network interface card details
Function declaration
1public Endpoint getEndpoint(String endpointId) {
2 ......
3}
Parameter meaning
Refer to OpenAPI documentation Request Parameters for Querying Service Network Interface Card Details
Response value
- Operation succeeded
1{
2 "endpointId': "endpoint-11a09ce9",
3 "name": "name",
4 "ipAddress": "192.168.0.5",
5 "status": "available",
6 "service": "www.test.com",
7 "subnetId": "sbn-crqu2vxzj049",
8 "createTime": "2019-03-07T02:35:31Z",
9 "description": "",
10 "productType": "postpay",
11 "vpcId": "vpc-q1hcnhf7nmve",
12 "metadata": For details, refer to the metadata section in the appendix
13}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleGetEndpoint.java
Delete service network interface card
Function declaration
1public void releaseEndpoint(ReleaseEndpointRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Deleting Service Network Interface Card
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleDeleteEndpoint.java
Update the service network interface card
Function declaration
1public void modifyEndpoint(ModifyEndpointRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation Request Parameters for Updating Service Network Interface Card
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleUpdateEndpoint.java
Query mountable public services
Function declaration
1 public ServiceResponse listService() {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Querying Mountable Public Services
Response value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "services": [
4 "www.test.com",
5 "www.test2.com"
6 ]
7}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleGetPublicServices.java
Update regular security group for service network interface card
Function declaration
1public void updateSecurityGroups(UpdateSecurityGroups updateSecurityGroups) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Updating Regular Security Group of Service Network Interface Card
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleUpdateEndpointSecurityGroup.java
Update service network interface card with enterprise security group
Function declaration
1public void updateEnterpriseSecurityGroups(UpdateEnterpriseSecurityGroups updateSecurityGroups) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Updating Enterprise Security Group of Service Network Interface Card
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleUpdateEnterpriseSecurityGroup.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 }
