文档

DescribeReservedInstances - 查询已经购买的预留实例券

更新时间:

调用DescribeReservedInstances查询已经购买的预留实例券。

调试

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

授权信息

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

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

请求参数

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

实例所属的地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。

cn-hangzhou
PageNumberinteger

预留实例券列表的页码,起始值:1

默认值:1

1
PageSizeinteger

分页查询时的每页行数,最大值:100

默认值:10

50
Tagobject []

标签列表。

Keystring

预留实例券的标签键。N 的取值范围:1~20。一旦传入该值,则不允许为空字符串。最多支持 128 个字符,不能以 aliyun 和 acs:开头,不能包含 http://或者 https://。

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

TestKey
Valuestring

预留实例券的标签值。N 的取值范围:1~20。一旦传入该值,允许为空字符串。最多支持 128 个字符,不能以 acs:开头,不能包含 http://或者 https://。

TestValue
ZoneIdstring

实例所属的可用区编号,当 Scope 为 Zone 时必填。更多详情,请参见 DescribeZones 获取可用区列表。

cn-hangzhou-z
ReservedInstanceNamestring

预留实例券名称。

testReservedInstanceName
LockReasonstring

锁定类型。取值范围:

  • financial:账号欠费或服务过期
  • security:安全原因
security
InstanceTypestring

实例资源的规格。取值请参见实例规格族

ecs.g5.large
InstanceTypeFamilystring

实例资源的规格族。取值请参见实例规格族

ecs.g5
Scopestring

预留实例券的范围。取值范围:

  • Region:地域级别
  • Zone:可用区级别

默认值:Region

Region
OfferingTypestring

预留实例券的付款类型。取值范围:

  • No Upfront:零预付
  • Partial Upfront:部分预付
  • All Upfront:全预付
All Upfront
AllocationTypestring

分配类型。取值范围:

  • Normal:查询当前账号下的预留实例券。
  • Shared:查询当前账号下已经建立主子账号共享的预留实例券。

默认值:Normal

Normal
ReservedInstanceIdarray

预留实例券 ID。N 的取值范围:1~100。

string

预留实例券 ID。N 的取值范围:1~100。

ri-bpzhex2ulpzf53****
Statusarray

预留实例券的状态,N 的取值范围:1~100。状态值取值范围:

  • Creating:正在创建
  • Active:在有效期中
  • Expired:已过期
  • Updating:正在更改预留实例券的属性
string

预留实例券的状态,N 的取值范围:1~100。状态值取值范围:

  • Creating:正在创建
  • Active:在有效期中
  • Expired:已过期
  • Updating:正在更改预留实例券的属性
Active

返回参数

名称类型描述示例值
object
PageSizeinteger

输入时设置的每页行数。

1
RequestIdstring

请求 ID。

E572643C-6A29-49D6-9D4E-6CFA4E063A3E
PageNumberinteger

预留实例券列表的页码。

1
TotalCountinteger

预留实例券的总数。

1
ReservedInstancesobject []

由 ReservedInstance 组成的数组格式,返回预留实例券的详细信息。

Statusstring

状态。

Active
CreationTimestring

创建时间。

2018-12-10T12:07Z
ReservedInstanceNamestring

名称。

riZbpzhex2ulpzf53****
ReservedInstanceIdstring

预留实例券 ID。

ri-bpzhex2ulpzf53****
InstanceTypestring

匹配的按量付费实例的规格。

ecs.g5.large
InstanceAmountinteger

可以匹配同规格按量付费实例的数量。

10
RegionIdstring

地域 ID。

cn-hangzhou
OfferingTypestring

付款类型。

All Upfront
StartTimestring

生效时间。

2018-12-10T12:00Z
Descriptionstring

描述。

testDescription
AllocationStatusstring

当 AllocationType 值为 Shared 时,该参数表示预留实例券的分配状态。可能值:

  • allocated:已分配给其他用户的预留实例券。
  • beAllocated:被其他用户分配的预留实例券。
allocated
ExpiredTimestring

到期时间。

2019-12-10T12:07Z
ResourceGroupIdstring

资源组。

EcsDocTest
ZoneIdstring

可用区 ID。

cn-hangzhou-z
Platformstring

实例使用的镜像的操作系统类型。可能值:

  • Windows:Windows Server 类型的操作系统。

  • Linux:Linux 及类 Unix 类型的操作系统。

Linux
Scopestring

范围。

region
OperationLocksobject []

是否被锁定。

LockReasonstring

锁定原因。

security
Tagsobject []

预留实例券的标签对信息。

TagValuestring

预留实例券的标签值。

TestValue
TagKeystring

预留实例券的标签键。

TestKey

示例

正常返回示例

JSON格式

{
  "PageSize": 1,
  "RequestId": "E572643C-6A29-49D6-9D4E-6CFA4E063A3E",
  "PageNumber": 1,
  "TotalCount": 1,
  "ReservedInstances": {
    "ReservedInstance": [
      {
        "Status": "Active",
        "CreationTime": "2018-12-10T12:07Z",
        "ReservedInstanceName": "riZbpzhex2ulpzf53****",
        "ReservedInstanceId": "ri-bpzhex2ulpzf53****",
        "InstanceType": "ecs.g5.large",
        "InstanceAmount": 10,
        "RegionId": "cn-hangzhou",
        "OfferingType": "All Upfront",
        "StartTime": "2018-12-10T12:00Z",
        "Description": "testDescription",
        "AllocationStatus": "allocated",
        "ExpiredTime": "2019-12-10T12:07Z",
        "ResourceGroupId": "EcsDocTest",
        "ZoneId": "cn-hangzhou-z",
        "Platform": "Linux",
        "Scope": "region",
        "OperationLocks": {
          "OperationLock": [
            {
              "LockReason": "security"
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagValue": "TestValue",
              "TagKey": "TestKey"
            }
          ]
        }
      }
    ]
  }
}

错误码

HTTP status code错误码错误信息描述
400MissingParamter.RegionIdThe regionId should not be null.参数 RegionId 不得为空。
400InvalidRegion.NotFoundThe specified parameter RegionId is not valid.RegionId 参数不合法。
400InvalidZone.NotFoundThe specified parameter ZoneId is not valid.指定的ZoneId不合法。
400InvalidReservedInstanceOfferingType.ValueNotSupportedthe OfferingType is not supported-
400InvalidReservedInstanceOfferingClass.ValueNotSupportedthe OfferingClass is not supported-
400OperationDeniedThe specified InstanceType or Zone is not authorized for current user.-
400InvalidEndTime.ValueNotSupportedThe specified endTime is out of the permitted range.指定的 EndTime 超过限制。
400InvalidReservedInstanceLockReason.ValueNotSupportedThe specified LockReason is not supported.-
400InvalidReservedInstanceStatus.ValueNotSupportedThe specified Status is not supported.-
400InvalidAllocationType.ValueNotSupportedThe specified AllocationType is not supported.指定的分配类型无效。
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.指定的RegionId不存在,请您检查此产品在该地域是否可用。

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

  • 本页导读 (1)
文档反馈