EipTp Instance
Retrieve Endpoint
Before configuring the Endpoint for SDK usage, please refer to the developer guide section on EIP Service Domain Name to understand Endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer to the network product EIP section in Region Selection Guide.
Note: Elastic network interface API supports both HTTP and HTTPS calling methods. To enhance data security, it is recommended to call via HTTPS.
Retrieve AK/SK
To use the elastic network interface on Baidu AI Cloud, users must have a valid AK (Access Key ID) and SK (Secret Access Key) for signature verification. The AK/SK are system-assigned identifiers used to establish user identity and enable signature-based service access. Follow these steps to obtain and understand your AK/SK information:
Create EipTpClient
EipTpClient serves as the client for EipTp services, providing developers with a range of methods to interact with EipTp services. When creating an EipTpClient, first configure a BCE client configuration-type config instance using endpoint, AK and SK, and then use the config instance to configure the EipTpClient. The specific configuration method is as follows:
1static final String ENDPOINT = ""
2static final String AK = "";
3static final String SK = "";
4BceClientConfiguration config = new BceClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(ak, sk));
6config.setEndpoint(endpoint);
7EipTpClient eipTpClient = new EipTpClient(config);
Create a shared traffic package
Function declaration
1public CreateEipTpResponse createEipTp(CreateEipTpRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation: Request Parameters for Creating EipTp
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "id":"tp-87V5cnkwqO"
4}
- Operation failed
For response exception list of operation failure, refer to the EipTp Exception List.
Code example
For specific code examples, please refer to ExampleCreateEipTp.java
Query shared traffic package details
Function declaration
1public EipTpDetailResponse getEipTpDetail(String id) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation: Request Parameters for Querying EipTp Details
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "id":"tp-87V5cnkwqO",
4 "deductPolicy":"TimeDurationPackage",
5 "packageType":"WebOutBytes",
6 "status":"RUNNING",
7 "capacity": 10737418240,
8 "usedCapacity": 0,
9 "createTime":"2021-08-10T11:40:57Z",
10 "activeTime": "2021-08-10T11:41:16Z",
11 "expireTime:" "2021-09-10T11:41:16Z"
12}
- Operation failed
For response exception list of operation failure, refer to the EipTp Exception List.
Code example
For specific code examples, refer to ExampleGetEipTpDetail.java
Query shared traffic package list
Function declaration
1public ListEipTpsResponse listEipTps(ListEipTpsRequest request) {
2}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Querying EipTp List
Response value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "nextMarker": "tp-Qn65tYXAx3",
4 "marker": "tp-87V5cnkwqO",
5 "maxKeys": 2,
6 "isTruncated": true,
7 "packageList": [
8 {
9 "id":"tp-87V5cnkwqO",
10 "deductPolicy":"TimeDurationPackage",
11 "packageType":"WebOutBytes",
12 "status":"RUNNING",
13 "capacity": 10737418240,
14 "usedCapacity": 0,
15 "createTime":"2021-08-10T11:40:57Z",
16 "activeTime": "2021-08-10T11:41:16Z",
17 "expireTime:" "2021-09-10T11:41:16Z"
18 },
19 {
20 "id":"tp-nzGGLBBYjD",
21 "deductPolicy":"FullTimeDurationPackage",
22 "packageType":"WebOutBytes",
23 "status":"EXPIRED",
24 "capacity": 10737418240,
25 "usedCapacity": 10737418240,
26 "createTime":"2021-08-10T11:40:57Z",
27 "activeTime": "2021-08-10T11:41:16Z",
28 "expireTime:" "2021-09-10T11:41:16Z"
29 }
30 ]
31}
- Operation failed
For response exception list of operation failure, refer to the EipTp Exception List.
Code example
For specific code examples, please refer to ExampleListEipTps.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 }
