调用 ModifyInstanceChargeType 接口转换实例的计费方式,支持在按量计费和包年包月之间相互转换。
下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 类型 | 是否必填 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ModifyInstanceChargeType | 要执行的操作,取值:ModifyInstanceChargeType。 |
Version | String | 是 | 2020-04-01 | API的版本,取值:2020-04-01。 |
AutoPay | Boolean | 否 | true | 是否自动支付,取值:
说明 如果您的支付方式余额不足,建议将本参数设置为 |
AutoRenew | Boolean | 否 | true | 实例到期后是否自动续费,取值:
说明 仅当参数 |
AutoRenewPeriod | Integer | 否 | 1 | 每次自动续费的时长。
|
ClientToken | String | 否 | 333456899ff**** | 保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。 |
DryRun | Boolean | 否 | false | 是否只预检此次请求,取值:
|
IncludeDataVolumes | Boolean | 否 | true | 是否将实例上挂载的所有按量计费数据盘转换为包年包月数据盘。
|
InstanceChargeType | String | 否 | PostPaid | 实例需要修改的目标计费方式,取值:
|
InstanceIds.N | Array of String | 是 | InstanceIds.1=i-3thhlu8byl4bwbha**** | 实例ID,最多支持20个ID。
|
Period | Integer | 否 | 2 | 购买资源的时长,取值: 说明 当 |
PeriodUnit | String | 否 | Month | 购买资源时长的时间单位,即参数
|
下表仅列出本接口特有的返回参数。更多信息请参见返回结构。
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
OrderId | String | Order7021038849342****** | 订单号。 |
GET /?Action=ModifyInstanceChargeType&Version=2020-04-01&InstanceIds.1=i-4ay51iinvo8w4nho****&InstanceChargeType=PrePaid&PeriodUnit=Month&Period=2&AutoPay=True&IncludeDataVolumes=false HTTP/1.1 Host: open.volcengineapi.com Region: cn-beijing Service: ecs
{ "ResponseMetadata": { "RequestId": "2021062415303301022514515207C4****", "Action": "ModifyInstanceChargeType", "Version": "2020-04-01", "Service": "ecs", "Region": "cn-beijing" }, "Result": { "OrderId": "Order7021038849342******" } }
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
状态码 | 错误码 | 说明 |
---|---|---|
400 | IdempotentParameterMismatch | 幂等参数不一致。 |
400 | Insufficient.Balance | 账户余额不足。 |
400 | InvalidArgument | 指定的参数不合法。 |
400 | InvalidClientToken.Malformed | 指定的ClientToken不合法。 |
400 | InvalidDedicatedHostInstanceForModifyInstanceChargeType.Unsupported | 指定的实例为专有宿主机上的实例,不支持更改计费类型。 |
400 | InvalidInstanceChargeType | 指定的实例计费类型不合法。 |
400 | InvalidInstanceStatus | 当前实例的状态不支持此操作。 |
400 | InvalidPeriod | 指定的计费周期个数不合法。 |
400 | InvalidPeriodUnit | 指定的计费周期不合法。 |
400 | InvalidScheduledInstanceForModifyInstanceChargeType.Unsupported | 指定的弹性预约实例不支持更改计费类型。 |
400 | InvalidSpotStrategyForModifyInstanceChargeType.Unsupported | 指定的实例抢占策略不支持更改计费类型。 |
400 | LimitExceeded.MaximumInstanceIds | 指定的InstanceIds数量超过最大限制。 |
400 | MissingParameter.InstanceId | 参数实例ID不能为空。 |
400 | QuotaExceeded.MaximumGeneralCpus | 通用型实例CPU数量配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumGpuBasicNums | GPU计算型实例卡数配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumHighPerformanceGpus | 高性能计算GPU型实例卡数配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumInstanceCpus | 实例CPU数量配额不足,请提工单申请提高配额。 |
400 | QuotaExceeded.MaximumInstanceTypeInstances | 规格实例数量配额不足,请提工单申请提高配额。 |
400 | QuotaExceeded.MaximumInstances | 实例数量配额不足,请提工单申请提高配额。 |
400 | QuotaExceeded.MaximumLocalVolumeCpus | 本地盘实例CPU数量配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumReservedInstanceGeneralCpus | 通用型实例地域级RI CPU数量配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumReservedInstanceGpuBasicNums | GPU计算型实例地域级RI卡数配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumReservedInstanceHighPerformanceGpus | 高性能计算GPU型实例地域级RI卡数配额不足,请提工单或前往控制台申请提高配额。 |
400 | QuotaExceeded.MaximumReservedInstanceLocalVolumeCpus | 本地盘实例地域级RI CPU数量配额不足,请提工单或前往控制台申请提高配额。 |
403 | InvalidInstance.RequestForbidden | 由于您的火山引擎账户违反了相关规定,指定的资源已不再可以使用,如需恢复服务请提交工单联系服务人员处理。 |
404 | InvalidInstance.NotFound | 指定的实例不存在。 |
412 | DryRunOperation | 通过“DryRun”校验,您的请求已通过验证。 |
412 | IdempotentProcessing | 先前的幂等请求仍在处理中,请稍后重试。 |
412 | InvalidInstance.Expired | 实例已过期。 |
412 | OperationDenied.ResourceCreatedByOtherService | 指定的操作被拒绝,因为您的资源被其他服务创建。您可以通过资源的系统标签查询对应服务。 |
412 | OperationDenied.ResourceLocked | 指定的操作被拒绝,因为您的资源已被其他操作锁定。 |
500 | Insufficient.InstanceCapacity | 当前资源不足,请稍后重试或选择其它实例规格。 |
500 | InternalError | 内部错误,请重试。如果多次尝试失败,请提交工单。 |