本介面主要用於查詢指定地區下您已經購買的預留執行個體券資訊列表,支援您根據標籤、預留執行個體券屬性等參數擷取預留執行個體券詳細資料列表。
介面說明
適用情境
查詢指定地區下所有的預留執行個體券。
根據預留執行個體券 ID 或名稱查詢其詳細資料。
根據執行個體規格或者執行個體規格類型系列過濾查詢您已購買的預留執行個體券。
根據預留執行個體券範圍或者狀態過濾查詢您已購買的預留執行個體券。
請求樣本
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ecs:DescribeReservedInstances |
get |
ReservedInstance
ReservedInstance
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
是 |
預留執行個體券所屬的地區 ID。您可以調用 DescribeRegions 擷取最新的阿里雲地區列表。 |
cn-hangzhou |
| PageNumber |
integer |
否 |
預留執行個體券列表的頁碼,起始值:1。 預設值:1。 |
1 |
| PageSize |
integer |
否 |
分頁查詢時的每頁行數,最大值:100。 預設值:10。 |
50 |
| Tag |
array<object> |
否 |
標籤數組。數組長度:1~20。 |
|
|
object |
否 |
標籤。 |
||
| Key |
string |
否 |
預留執行個體券的標籤鍵。不允許為空白字串,最多支援 128 個字元,不能以 aliyun 和 acs:開頭,不能包含 http://或者 https://。 說明
使用一個標籤過濾資源,查詢到該標籤下的資源數量不能超過 1000 個;使用多個標籤過濾資源,查詢到同時綁定了多個標籤的資源數量不能超過 1000 個;如果資源數量超過 1000 個,請使用 ListTagResources 介面進行查詢。 |
TestKey |
| Value |
string |
否 |
預留執行個體券的標籤值。不允許為空白字串,最多支援 128 個字元,不能以 |
TestValue |
| RegionId |
string |
是 |
預留執行個體券所屬的地區 ID。您可以調用 DescribeRegions 擷取最新的阿里雲地區列表。 |
cn-hangzhou |
| ZoneId |
string |
否 |
執行個體所屬的可用性區域編號,當 Scope 為 Zone 時生效並且必填。您可以通過 DescribeZones 擷取可用性區域列表。 |
cn-hangzhou-z |
| ReservedInstanceName |
string |
否 |
預留執行個體券名稱。 說明
完全符合,暫不支援模糊查詢過濾。 |
testReservedInstanceName |
| LockReason |
string |
否 |
鎖定類型。取值範圍:
|
security |
| InstanceType |
string |
否 |
預留執行個體券對應的執行個體規格。取值請參見執行個體規格類型系列。 說明
購買預留執行個體券時選擇的執行個體規格,實際抵扣的時候,地區級預留執行個體券支援同規格組內的不同大小規格換算抵扣。 |
ecs.g5.large |
| InstanceTypeFamily |
string |
否 |
預留執行個體券對應的執行個體規格類型系列。取值請參見執行個體規格類型系列。 |
ecs.g5 |
| Scope |
string |
否 |
預留執行個體券的範圍。取值範圍:
|
Region |
| OfferingType |
string |
否 |
預留執行個體券的付款類型。取值範圍:
|
All Upfront |
| AllocationType |
string |
否 |
配置類型。取值範圍:
預設值:Normal。 |
Normal |
| ReservedInstanceId |
array |
否 |
預留執行個體券 ID 數組。數組長度:1~100。 |
ri-bpzhex2ulpzf53**** |
|
string |
否 |
預留執行個體券 ID。 |
ri-bpzhex2ulpzf53**** |
|
| Status |
array |
否 |
預留執行個體券的狀態數組。 |
Active |
|
string |
否 |
預留執行個體券的狀態。狀態值取值範圍:
|
Active |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| PageSize |
integer |
輸入時設定的每頁行數。 |
1 |
| RequestId |
string |
請求 ID。 |
E572643C-6A29-49D6-9D4E-6CFA4E063A3E |
| PageNumber |
integer |
預留執行個體券列表的頁碼。 |
1 |
| TotalCount |
integer |
預留執行個體券的總數。 |
1 |
| ReservedInstances |
object |
||
| ReservedInstance |
array<object> |
預留執行個體券的詳細資料列表。 |
|
|
array<object> |
預留執行個體券的詳細資料。 |
||
| Status |
string |
狀態。 |
Active |
| CreationTime |
string |
建立時間。 |
2018-12-10T12:07Z |
| ReservedInstanceName |
string |
名稱。 |
riZbpzhex2ulpzf53**** |
| ReservedInstanceId |
string |
預留執行個體券 ID。 |
ri-bpzhex2ulpzf53**** |
| InstanceType |
string |
匹配的隨用隨付執行個體的規格。 |
ecs.g5.large |
| InstanceAmount |
integer |
可以匹配同規格隨用隨付執行個體的數量。 |
10 |
| RegionId |
string |
地區 ID。 |
cn-hangzhou |
| OfferingType |
string |
付款類型。 |
All Upfront |
| StartTime |
string |
生效時間。 |
2018-12-10T12:00Z |
| Description |
string |
描述。 |
testDescription |
| AllocationStatus |
string |
當 AllocationType 值為 Shared 時,該參數表示預留執行個體券的分配狀態。可能值:
|
allocated |
| ExpiredTime |
string |
到期時間。 |
2019-12-10T12:07Z |
| ResourceGroupId |
string |
資源群組。 |
EcsDocTest |
| ZoneId |
string |
可用性區域 ID。 |
cn-hangzhou-z |
| Platform |
string |
執行個體使用的鏡像的作業系統類型。可能值:
|
Linux |
| Scope |
string |
範圍。 |
region |
| OperationLocks |
object |
||
| OperationLock |
array<object> |
是否被鎖定。 |
|
|
object |
是否被鎖定。 |
||
| LockReason |
string |
鎖定原因。 |
security |
| Tags |
object |
||
| Tag |
array<object> |
預留執行個體券的標籤對資訊列表。 |
|
|
object |
預留執行個體券的標籤對資訊。 |
||
| TagValue |
string |
預留執行個體券的標籤值。 |
TestValue |
| TagKey |
string |
預留執行個體券的標籤鍵。 |
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"
}
]
}
}
]
}
}
異常返回樣本
JSON格式
{
"code":"200",
"data":{
"data":[
{
"CreationTime":"2018-12-10T12:07Z",
"ExpiredTime":"2019-12-10T16:00Z",
"InstanceAmount":1,
"ReservedInstanceId":"ri-0xzhex2ulpzf53rxme2j",
"InstanceType":"ecs.g5.large",
"OfferingType":"All Upfront",
"RegionId":"cn-hangzhou-test-307",
"ReservedInstanceName":"riZ0xzhex2ulpzf53rxme2jZ",
"Scope":"region",
"StartTime":"2018-12-10T12:00Z",
"Status":"active"
}
],
"PageNumber":1,
"PageSize":50,
"Total":1
},
"httpStatusCode":200,
"message":"successful",
"requestId":"E572643C-6A29-49D6-9D4E-6CFA4E063A3E",
"success":true
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | MissingParamter.RegionId | The regionId should not be null. | 參數 RegionId 不得為空白。 |
| 400 | InvalidRegion.NotFound | The specified parameter RegionId is not valid. | RegionId 參數不合法。 |
| 400 | InvalidZone.NotFound | The specified parameter ZoneId is not valid. | 指定的ZoneId不合法。 |
| 400 | InvalidReservedInstanceOfferingType.ValueNotSupported | the OfferingType is not supported | |
| 400 | InvalidReservedInstanceOfferingClass.ValueNotSupported | the OfferingClass is not supported | |
| 400 | OperationDenied | The specified InstanceType or Zone is not authorized for current user. | |
| 400 | InvalidEndTime.ValueNotSupported | The specified endTime is out of the permitted range. | 指定的 EndTime 超過限制。 |
| 400 | InvalidReservedInstanceLockReason.ValueNotSupported | The specified LockReason is not supported. | |
| 400 | InvalidReservedInstanceStatus.ValueNotSupported | The specified Status is not supported. | |
| 400 | InvalidAllocationType.ValueNotSupported | The specified AllocationType is not supported. | 指定的配置類型無效。 |
| 403 | RAM.ApiNotSupported | This call is not supported from ram accessing. | RAM 使用者沒有許可權執行該操作。 |
| 404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | 指定的RegionId不存在,請您檢查此產品在該地區是否可用。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。