获取BEC规格套餐
更新时间:2025-08-05
接口描述
本接口用于获取BEC规格套餐。
请求结构
Plain Text
1GET /v1/resource/package/{type}?policy={policy} HTTP/1.1
2Host: bec.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
type | String | 是 | URL参数 | 套餐类型,取值为container、vm、bm,分别表示容器、虚机、裸金属 |
policy | String | 否 | Query参数 | 套餐策略,取值为 random:随机分配策略,spec:自选机型策略。虚机类型不传默认random。 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
success | Boolean | 是否成功,true:表示成功;false:表示失败 |
result | List<BecResourcePackageVo> | 套餐列表 |
错误码
请参照错误返回章节的内容。
请求示例
容器套餐
Plain Text
1GET /v1/resource/package/container HTTP/1.1
2Host: bec.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
虚机分机型套餐
Plain Text
1GET /v1/resource/package/vm?policy=spec HTTP/1.1
2Host: bec.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
响应示例
容器套餐
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS
6
7{
8"result": [
9
10 {
11 "name": "通用型2C4G",
12 "cpu": 2,
13 "memory": 4,
14 "gpu": null,
15 "code": null,
16 "interBandwidth": 200,
17 "innerBandwidth": null,
18 "cpuModel": null,
19 "dataDiskList": null,
20 "systemDisk": null,
21 "storagePartition": null,
22 "networkPacketData": 0
23 },
24 {
25 "name": "通用型2C8G",
26 "cpu": 2,
27 "memory": 8,
28 "gpu": null,
29 "code": null,
30 "interBandwidth": 200,
31 "innerBandwidth": null,
32 "cpuModel": null,
33 "dataDiskList": null,
34 "systemDisk": null,
35 "storagePartition": null,
36 "networkPacketData": 0
37 }
38],
39"success": true
40}
虚机分机型套餐
请求type为vm
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS
6
7{
8 "result":[
9 {
10 "name":"bec.g4.c1m4",
11 "cpu":1,
12 "memory":4,
13 "spec":"bec.g4.c1m4",
14 "interBandwidth":100,
15 "innerBandwidth":1.5,
16 "cpuModel":"Intel_Xeon_Gold_6271C",
17 "networkPacketData":0,
18 "enabled":true,
19 "cpuGHz":"2.6",
20 "specId":"g4",
21 "specType":"g",
22 "flavorTypePostpay":"generationBEC4",
23 "flavorTypePrepay":"generationBEC4"
24 },
25 {
26 "name":"bec.g4.c2m8",
27 "cpu":2,
28 "memory":8,
29 "spec":"bec.g4.c2m8",
30 "interBandwidth":200,
31 "innerBandwidth":1.5,
32 "cpuModel":"Intel_Xeon_Gold_6271C",
33 "networkPacketData":0,
34 "enabled":true,
35 "cpuGHz":"2.6",
36 "specId":"g4",
37 "specType":"g",
38 "flavorTypePostpay":"generationBEC4",
39 "flavorTypePrepay":"generationBEC4"
40 }
41 ],
42 "success":true
43}
44
裸金属套餐
示例: 请求type为bm
JSON
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS
6
7
8{
9 "result": [
10 {
11 "name": "计算型",
12 "cpu": 96,
13 "memory": 384,
14 "spec": "bec.lgn4.c96m384.2d",
15 "interBandwidth": 5000,
16 "innerBandwidth": 50.0,
17 "cpuModel": "Intel Xeon Gold 6271C(2.6GHZ)",
18 "diskList": [
19 {
20 "volumeType": "NVME_SSD",
21 "sizeInGb": 8000,
22 "name": "/dev/nvme0n1"
23 },
24 {
25 "volumeType": "NVME_SSD",
26 "sizeInGb": 8000,
27 "name": "/dev/nvme1n1"
28 }
29 ],
30
31 "networkPacketData": 1000,
32 "cpuGHz": "2.6",
33 "specType": "compute",
34 "processorType": "Intel",
35 "arch": "x86",
36 "gpuModel": "",
37 "gpu": 0,
38 }
39 ]
40}
Model对象定义
BecResourcePackageVo
参数名称 | 类型 | 描述 |
---|---|---|
name | String | 规则族名称 |
cpu | Integer | cpu数量 |
memory | Integer | 内存数量 |
spec | String | 分机型套餐规格, 例如 bec.g4.c1m4 |
cpuModel | String | 分机型套餐cpu型号,例如 Intel_Xeon_Gold_6271C |
cpuGHz | String | 分机型套餐cpu主频,单位GHz,例如 2.6 |
gpu | Integer | GPU卡数 |
gpuModel | String | GPU卡型号 |