全部产品
Search
文档中心

云服务器 ECS:DescribeCapacityReservations - 查询容量预定服务的详细信息

更新时间:Mar 19, 2024

调用DescribeCapacityReservations查询一个或多个容量预定服务的详细信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
ecs:DescribeCapacityReservationsRead
  • CapacityReservation
    acs:ecs:{#regionId}:{#accountId}:capacityreservation/*

请求参数

名称类型必填描述示例值
RegionIdstring

容量预定服务所属地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。

cn-hangzhou
ResourceGroupIdstring

资源组 ID。使用该参数过滤资源时,资源数量不能超过 1000 个。

说明 不支持默认资源组过滤。
rg-bp67acfmxazb4p****
Tagobject []

标签列表

Keystring

标签键。N 表示可以设置多个标签键进行过滤,N 的取值范围为 1~20。

使用一个标签过滤资源,查询到该标签下的资源数量不能超过 1000 个;使用多个标签过滤资源,查询到同时绑定了多个标签的资源数量不能超过 1000 个。如果资源数量超过 1000 个,请使用 ListTagResources 接口进行查询。

TestKey
Valuestring

标签值。N 表示可以设置多个标签值进行过滤,N 的取值范围为 1~20。

TestValue
MaxResultsinteger

分页查询时每页行数。

最大值:100。

默认值:10。

10
NextTokenstring

容量预定服务查询起始标志。由上一次的请求结果中获取。

caeba0bbb2be03f84eb48b699f0a4883
PrivatePoolOptions.Idsstring

容量预定服务 ID 列表。取值可以由多个 ID 组成一个 JSON 数组,最多支持 100 个 ID,ID 之间用半角逗号(,)隔开。

["crp-bp1gubrkqutenqdd****", "crp-bp67acfmxazb5****"]
Platformstring

实例的操作系统。取值范围:

  • windows:仅查询 Windows 系统的容量预定服务。
  • linux:仅查 Linux 系统的容量预定服务。
  • all:查询所有容量预定服务。

默认值:all。

linux
InstanceTypestring

实例规格。

ecs.c6.large
ZoneIdstring

容量预定服务所属地域下的可用区 ID。

cn-hangzhou-h
InstanceChargeTypestring

实例的计费方式。取值范围:

  • PostPaid:按量付费。
  • PrePaid:包年包月。

默认值:PostPaid。

PostPaid
Statusstring

容量预定服务的状态。取值范围:

  • All:所有状态。
  • Pending:初始化。指定时间生效的容量预定会先进入初始化状态。
  • Preparing:准备中。指定时间生效的容量预定在资源交付进行阶段,处于准备中状态。
  • Prepared:待生效。指定时间生效的容量预定在资源交付完成,服务正式生效之前,处于待生效状态。
  • Active:生效中。
  • Released:已释放,包括手动释放与到期自动释放。

默认值:Active。

Active

返回参数

名称类型描述示例值
object
NextTokenstring

容量预定服务下一个查询起始标志。

caeba0bbb2be03f84eb48b699f0a****
RequestIdstring

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****
TotalCountinteger

符合查询条件的记录条数。

1
MaxResultsinteger

容量预定服务每页显示行数。

10
CapacityReservationSetobject []

容量预定服务详细信息组成的集合。

Statusstring

容量预定服务的状态。可能值:

  • Pending:初始化。
  • Preparing:准备中。
  • Prepared:待生效。
  • Active:生效中。
  • Released:已释放,包括手动释放与到期自动释放。
Active
TimeSlotstring
说明 该参数正在邀测中,暂未开放使用。
null
PrivatePoolOptionsMatchCriteriastring

容量预定服务生效后生成的私有资源池的类型。可能值:

  • Open:开放模式。
  • Target:专用模式。
Open
PrivatePoolOptionsIdstring

容量预定服务 ID。

crp-bp1gubrkqutenqdd****
PrivatePoolOptionsNamestring

容量预定服务名称。

crpTestName
RegionIdstring

容量预定服务所属地域 ID。

cn-hangzhou
InstanceChargeTypestring

容量预定服务中实例的付费类型。可能值:

  • PostPaid:按量付费。
  • PrePaid:包年包月。
PostPaid
EndTimestring

容量预定服务的失效时间。

2021-02-19T03:02Z
StartTimestring

容量预定服务生效时间。

2021-02-19T02:01Z
Descriptionstring

容量预定服务描述。

This is description.
EndTimeTypestring

容量预定服务的失效方式。可能值:

  • Limited:指定时间释放。
  • Unlimited:手动释放。不限制时间。
Unlimited
ResourceGroupIdstring

容量预定服务所属的资源组 ID。

rg-bp67acfmxazb4p****
Platformstring

匹配的实例的操作系统。可能值:

  • windows。
  • linux。
linux
AllocatedResourcesobject []

资源分配详情。

UsedAmountinteger

已使用的实例的数量。

2
TotalAmountinteger

在一个实例规格内,需要预留的实例的总数量。

2
zoneIdstring

可用区 ID。

cn-hangzhou-h
InstanceTypestring

实例规格。

ecs.c6.large
Tagsobject []

容量预定服务绑定的标签键值对信息。

TagValuestring

标签值。

TestValue
TagKeystring

标签键。

TestKey
StartTimeTypestring

容量预定生效方式。可能值:

  • Now:立即生效。
  • Later:指定时间生效。
Now
SavingPlanIdstring

容量预定搭配的节省计划券 ID。

spn-c29b5e18pJMT****
ReservedInstanceIdstring

容量预定搭配的预留实例券 ID。

ri-bpzhex2ulpzf53****

示例

正常返回示例

JSON格式

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "TotalCount": 1,
  "MaxResults": 10,
  "CapacityReservationSet": {
    "CapacityReservationItem": [
      {
        "Status": "Active",
        "TimeSlot": "null",
        "PrivatePoolOptionsMatchCriteria": "Open",
        "PrivatePoolOptionsId": "crp-bp1gubrkqutenqdd****",
        "PrivatePoolOptionsName": "crpTestName",
        "RegionId": "cn-hangzhou",
        "InstanceChargeType": "PostPaid",
        "EndTime": "2021-02-19T03:02Z",
        "StartTime": "2021-02-19T02:01Z",
        "Description": "This is description.",
        "EndTimeType": "Unlimited",
        "ResourceGroupId": "rg-bp67acfmxazb4p****",
        "Platform": "linux",
        "AllocatedResources": {
          "AllocatedResource": [
            {
              "UsedAmount": 2,
              "TotalAmount": 2,
              "AvailableAmount": 0,
              "zoneId": "cn-hangzhou-h",
              "InstanceType": "ecs.c6.large",
              "CapacityReservationUsages": {
                "CapacityReservationUsage": [
                  {
                    "AccountId": "",
                    "ServiceName": "",
                    "UsedAmount": 0
                  }
                ]
              }
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagValue": "TestValue",
              "TagKey": "TestKey"
            }
          ]
        },
        "StartTimeType": "Now",
        "SavingPlanId": "spn-c29b5e18pJMT****",
        "ReservedInstanceId": "ri-bpzhex2ulpzf53****",
        "CapacityReservationOwnerId": ""
      }
    ]
  }
}

错误码

HTTP status code错误码错误信息描述
400MissingParameter.RegionIdThe specified RegionId should not be null.RegionId是必选参数。
400InvalidParameter.NameThe specified PrivatePoolOptions.Name is invalid.-
400InvalidParameter.PrivatePoolOptions.IdsThe specified PrivatePoolOptions.Ids is invalid.-
400DedicatedHostNotSupportedDedicatedHost is not supported for PrivatePool.私有池不支持专有宿主机。
400SpotNotSupportedSpot is not supported for PrivatePool.私有池不支持抢占式实例。
400ClassicNetworkNotSupportedClassic network is not supported for PrivatePool.私有池不支持经典网络类型实例。
400Invalid.InstanceIdInstance does not exist.实例不存在。
400Invalid.PrivatePoolOptions.MatchCriteriaTarget mode does not support this operation.Target模式不支持本次操作。
400MissingParameter.PrivatePoolOptions.IdThe specified PrivatePoolOptions.Id should not be null.PrivatePoolOptions.Id 参数不能为空。
400Invalid.PrivatePoolOptions.IdThe PrivatePool does not exist.私有池不存在。
400Invalid.InstanceTypeThe InstanceType does not match the PrivatePool.实例类型与私有池不匹配。
400Invalid.InstanceChargeTypeThe InstanceChargeType does not match the PrivatePool.实例计费类型与私有池不匹配。
400Invalid.ZoneIdThe ZoneId does not match the PrivatePool.可用区与私有池不匹配。
400Invalid.PrivatePoolOptions.statusThe PrivatePool has been used up.-
400Invalid.PrivatePoolOptions.MatchCriteriaThe PrivatePoolOptions.MatchCriteria does not match the PrivatePool.指定的PrivatePoolOptions.MatchCriteria参数与私有池不匹配。
400InvalidPlatform.ValueNotSupportedThe Platform does not match the PrivatePool.指定的Platform参数与私有池不匹配。
400Invalid.PrivatePoolOptions.statusThe PrivatePool is expired or inactive.-
400Invalid.PrivatePoolOptions.statusThe PrivatePool status is not valid.-
400Invalid.PrivatePoolOptions.statusThe Instance should be created within 48 hours once the PrivatePool is started.-
400InvalidAliUidThe PrivatePool does not belong to the user of the Instance.私有池不属于创建实例的用户。
400Invalid.InstanceIdThe Instance dose not attached to a PrivatePool.实例未与私有池匹配。
400MissingParameter.PackageTypeThe specified parameter "PackageType" can not be empty.-
400MissingParameter.PrivatePoolOptions.IdsThe specified parameter "PrivatePoolOptions.Ids" can not be empty.-
400MissingParameter.PrivatePoolOptions.IdThe specified parameter "PrivatePoolOptions.Id" can not be empty.-
400MissingParameter.InstanceCpuCoreCountThe specified parameter "InstanceCpuCoreCount" can not be empty.-
400MissingParameter.InstanceAmountThe specified parameter "InstanceAmount" can not be empty.-
400MissingParameter.InstanceCpuCoreCountOrInstanceAmountThe specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time.-
400Invalid.TooManyPrivatePoolOptions.IdsToo many PrivatePoolOptions.Ids in this request.PrivatePoolOptions.Ids参数超过上限。
400Invalid.TooManyZoneIdsToo many ZoneIds in the request.ZoneIds参数超过上限。
400Invalid.TooManyInstanceTypesToo many InstanceTypes in the request.InstanceTypes参数超过上限。
400Invalid.TooManyUnpaidPrivatePoolToo many PrivatePools create but still unpaid.多个私有池未支付。
400Invalid.InstanceCpuCoreCountOrInstanceAmountBoth InstanceCpuCoreCount and InstanceAmount are provided.InstanceCpuCoreCount和InstanceAmount两个参数不需要同时提供。
400Invalid.PrivatePoolOptions.IdsThe specified parameter "PrivatePoolOptions.Ids" exist invalid element Id.-
400Invalid.PackageTypeThe specified parameter "PackageType" is invalid.-
400Invalid.PrivatePool.PurchaseThe PrivatePool has already paid.私有池已经支付。
400Invalid.AssuranceTimes.NotSupportedThe value of AssuranceTimes is not supported.AssuranceTimes参数值不支持。
400Invalid.TooManyInstanceTypesThe specified parameter "InstanceType" should only has one item.-
400Invalid.PrivatePoolOptions.MatchCriteriaThe specified parameter "PrivatePoolOptions.MatchCriteria" is invalid.-
400RepeatStartPrivatePoolPrivatePool has already been started.私有池已经启动。
400Invalid.PrivatePoolOptions.IdThe specified parameter "PrivatePoolOptions.Id" should be empty.-
400Invalid.InstanceIdModify DedicatedHost Instance's attachment attributes is not supported.-
400Invalid.InstanceIdModify Spot Instance's attachment attributes is not supported.-
400Invalid.InstanceIdModify Classic Network Instance's attachment attributes is not supported.-
400InvalidParameter.RegionIdThe specified RegionId is not exist.传入的 RegionId 不存在。
400InvalidPermission.ResourceShareAssocoatedThe current resource is associated to a shared relationship and cannot be released.当前资源被绑定共享关系,无法释放
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.内部错误,请重试。

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2023-12-07OpenAPI 错误码发生变更、OpenAPI 返回结构发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:500
出参OpenAPI 返回结构发生变更
2021-06-18OpenAPI 错误码发生变更、OpenAPI 返回结构发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:400
    删除错误码:500
出参OpenAPI 返回结构发生变更