EipTp Instance
Create a shared traffic package
- Shared traffic packages are provided in a prepay model. They take effect immediately upon purchase, and postpaid EIP fees billed by traffic in the same region will be automatically offset until the package is either exhausted or expires.
- The reservationLength field is required and specifies the validity period of the shared traffic package. A numeric input is required, with supported periods being 1 month, 6 months, or 12 months.
- The capacity field is mandatory and specifies the size of the shared traffic package. For 1-month validity: options include "10 G"/"50 G"/"100 G"/"500 G"/"1 T"/"5 T"/"10 T"/"50 T". For 6-month validity: options include "60 G"/"300 G"/"600 G"/"3 T"/"6 T"/"30 T"/"60 T"/"300 T". For 12-month validity: options include "1 T"/"10 T"/"50 T"/"100 T"/"500 T"/"1 P". Choose the package size according to these specifications.
- deductPolicy is optional and defines the traffic package deduction policy: FullTimeDurationPackage (full-time) or TimeDurationPackage (off-peak), with FullTimeDurationPackage as the default.
- packageType (optional): Shared traffic package line type (currently supporting WebOutBytes (dynamic), defaulted as WebOutBytes). Real-name certification is required for creating shared traffic package. Those who have not passed real-name certification can access the real-name certification under security certification in the Baidu AI Cloud Official Website Console for certification.
Function declaration
1def create_eip_tp(self, reservation_length, capacity, deduct_policy=None, package_type=None,
2 client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Nks7gtql8
Response Value
Operation succeeded:
1{
2 "id":"tp-xxxxxxxxxx"
3}
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_create_eip_tp.py
Query shared traffic package details
- Query detailed information of the specified shared traffic package by ID
Function declaration
1def get_eip_tp_detail(self, id, config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/uks7gy2lj
Response value
Operation succeeded:
1{
2 "id": "tp-xxxxxxxxxx",
3 "deductPolicy": "TimeDurationPackage",
4 "packageType": "WebOutBytes",
5 "status": "RUNNING",
6 "capacity": 10737418240,
7 "usedCapacity": 0,
8 "createTime": "2021-04-10T11:40:57Z",
9 "activeTime": "2021-04-10T11:41:16Z",
10 "expireTime": "2021-05-10T11:41:16Z"
11}
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_get_eip_tp_detail.py
Query shared traffic package list
- Search the shared traffic package list using multiple filtering conditions.
- If no specific criteria are given, the system will default to querying all shared traffic packages.
- The results returned will reflect the intersection of the provided conditions. Specifically, when multiple conditions are applied, only shared traffic packages meeting all the conditions simultaneously will be returned.
- The query results support marker-based pagination, with a default page size of 1,000. You can adjust this by setting the maxKeys parameter.
Function declaration
1def list_eip_tps(self, id=None, deduct_policy=None, status=None, marker=None,
2 max_keys=1000, config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/mks7gz0vq
Response value
Operation succeeded:
1{
2 "marker": "tp-87V5cnkwqO",
3 "maxKeys": 1,
4 "nextMarker": "tp-Qn65tYXAx3",
5 "isTruncated": true,
6 "packageList": [
7 {
8 "id": "tp-87V5cnkwqO",
9 "deductPolicy": "TimeDurationPackage",
10 "packageType": "WebOutBytes",
11 "status": "RUNNING",
12 "capacity": 10737418240,
13 "usedCapacity": 0,
14 "createTime": "2021-04-10T11:40:57Z",
15 "activeTime": "2021-04-10T11:41:16Z",
16 "expireTime": "2021-05-10T11:41:16Z"
17 }
18 // ... More eip_tp entries
19 ]
20}
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_list_eip_tps.py
