创建预留实例券
更新时间:2024-10-15
该接口用于创建预留实例券。
请求结构
Plain Text
1POST /v{version}/instance/reserved/create HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "reservedInstanceName": reservedInstanceName,
6 "scope": scope,
7 "zoneName": zoneName,
8 "spec":spec,
9 "offeringType":offeringType,
10 "instanceCount":instanceCount,
11 "reservedInstanceCount":reservedInstanceCount,
12 "reservedInstanceTime":reservedInstanceTime,
13 "reservedInstanceTimeUnit":reservedInstanceTimeUnit,
14 "autoRenewTimeUnit":autoRenewTimeUnit,
15 "autoRenewTime":autoRenewTime,
16 "autoRenew":autoRenew,
17 "effectiveTime":effectiveTime,
18 "tags": [
19 "tagKey":tagKey,
20 "tagValue":tagValue
21 ],
22 "ticketId":ticketId,
23 "ehcClusterId":ehcClusterId
24}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号 |
clientToken | String | 否 | Query参数 | 幂等性Token,是一个长度不超过64位的ASCII字符串,详见链接。 |
reservedInstanceName | String | 否 | requestBody参数 | 规则:支持大小写字母、数字、中文以及-_ /.特殊字符,必须以中文或字母开头,长度1-65,可重复;客户未命名的情况下自动命名:reservedInstance-${随机生成},同样遵循以上命名规则 |
scope | String | 否 | requestBody参数 | 实例券的可用范围;默认:AZ |
zoneName | String | 是 | requestBody参数 | 可用区,例如:cn-bj-a |
spec | String | 是 | requestBody参数 | 实例规格,例如:bcc.g4.c2m8 |
offeringType | String | 是 | requestBody参数 | 默认值全预付:FullyPrepay |
instanceCount | String | 否 | requestBody参数 | 实例数量,默认为1,不可变更 |
reservedInstanceCount | String | 否 | requestBody参数 | 预留实例券数量,默认1,不能超过配额,默认配额20,若需要更多配额,请联系工单(可链接)申请。 |
reservedInstanceTime | String | 是 | requestBody参数 | 预留实例券购买时长,支持3,6,9,12,24,36个月 |
reservedInstanceTimeUnit | String | 否 | requestBody参数 | 预留实例券购买时长单位,默认为month,不可变更 |
autoRenew | Boolean | 否 | requestBody参数 | 自动续费开关,默认为false |
autoRenewTimeUnit | String | 否 | requestBody参数 | 预留实例券自动续费时长单位,默认为month,不可变更 |
autoRenewTime | String | 否 | requestBody参数 | 预留实例券自动续费时长,支持3,6,9,12,24,36个月,autoRenew为true时,必选且必须与reservedInstanceTime一致 |
effectiveTime | String | 否 | requestBody参数 | 生效时间,默认立即生效;自定义生效时间,最长不能超过1天。且只能设置为15min为间隔的整点(比如:10:00、10:15、10:30、10:45、11:00) |
tags | List<TagModel> | 否 | RequestBody参数 | 待创建的标签列表,具体数据格式参见下述TagModel |
ticketId | String | 否 | requestBody参数 | 代金券id |
ehcClusterId | String | 否 | requestBody参数 | 创建roce预留实例券时可选参数,若为空则使用默认EHC集群 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 描述 |
---|---|---|
orderId | String | 创建预留实例券的订单号 |
reservedInstanceIds | Array | 预留实例券的id集合 |
错误码
错误码 | 错误描述 | HTTP状态码 | 中文解释 |
---|---|---|---|
BadRequest | request is invalid | 400 | 请求参数无效 |
请求示例
Plain Text
1POST http://bcc.bj.baidubce.com/v2/instance/reserved/create
2Host: bcc.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4
5{
6 "reservedInstanceName": "test",
7 "scope": "AZ",
8 "zoneName": "cn-bj-a",
9 "spec": "bcc.g4.c2m8",
10 "offeringType": "FullyPrepay",
11 "instanceCount": 1,
12 "reservedInstanceCount": 1,
13 "reservedInstanceTime": 12,
14 "reservedInstanceTimeUnit": "month",
15 "autoRenewTimeUnit": "month",
16 "autoRenewTime": 12,
17 "autoRenew": true,
18 "effectiveTime": "2023-05-22T21:00:00Z",
19 "tags": [
20 {
21 "tagKey": "test",
22 "tagValue": "test"
23 }
24 ],
25 "ticketId": ""
26}
返回示例
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 "reservedInstanceIds": [
9 "test_f0c549b9614f"
10 ],
11 "orderId": "orderId"
12}