閱讀305 返回首頁    go 阿裏雲


查詢磁盤__磁盤相關接口_API 參考_雲服務器 ECS-阿裏雲

描述

下麵的參數中,RegionIdZoneIdDiskIdsInstanceId,… 等參數都是過濾器的概念,參數間是邏輯與關係。其中 DiskIds 是一個 Json 格式的 Json Array,格式如下。

如果參數為空,則過濾器不起作用,但是 DiskIds 如果是一個空 Json Array(即[]),則視為該過濾器有效,且返回空。

請求參數

名稱 類型 是否必須 描述
Action String 係統規定參數,取值:DescribeDisks
RegionId String 磁盤所屬於的 Region ID
ZoneId String 默認值為空,空代表查詢所有可用區下的磁盤。
DiskIds String 磁盤 ID
一個帶有格式的 Json Array:[“d-xxxxxxxxx”, ”d-yyyyyyyyy”, … “d-zzzzzzzzz”],最多 100 個 Id,用半角逗號字符隔開。
InstanceId String 實例 ID
DiskType String all | system | data,默認值為 all。
Category String 磁盤種類
all | cloud | cloud_efficiency | cloud_ssd | ephemeral | ephemeral_ssd。默認值為all
Status String 磁盤狀態
In_use | Available | Attaching | Detaching | Creating | ReIniting | All,默認值為 All。
SnapshotId String 創建磁盤使用的快照
DiskName String 磁盤名稱
Portable String 磁盤是否支持卸載:
  • true 代表是可卸載雲盤,可以獨立存在且可以自由在可用區內掛載和下載
  • false 代表不可卸載雲盤,隻能和實例同生同滅
用戶如果需要做 attach 和 detach 操作,必須先查詢一下這個屬性為 true 的磁盤才能操作。
本地磁盤,本地SSD盤 和 普通雲盤,高效雲盤和SSD雲盤的係統盤 和 包月的普通雲盤,高效雲盤,SSD雲盤,該屬性都為 false。
這個屬性用戶不能更改。
DeleteWithInstance String 磁盤是否隨實例釋放:
  • true 表示 Instance 釋放時,這塊磁盤隨 Instance 一起釋放
  • false 表示 Instance 釋放時,這塊磁盤保留不釋放
DeleteAutoSnapshot String 刪除磁盤時,是否同時刪除自動快照。
  • true 表示同時刪除自動快照
  • false 表示保留自動快照
EnableAutoSnapshot String 磁盤是否執行自動快照策略(前提是用戶整體的自動快照策略已經開啟):
  • true,表示這塊磁盤執行自動快照策略
  • false,表示這塊磁盤不執行自動快照策略
默認值:無,表示不改變當前的值
DiskChargeType String 磁盤的付費方式。
  • PrePaid:預付費,即包年包月
  • PostPaid:後付費,即按量付費
Tag.n.Key String 標簽 key,n 從 1 開始,最大為 5。
不允許為空字符串。
Tag.n.Value String 標簽 value,n 從 1 開始,最大為 5。
允許為空字符串。
PageNumber Integer 磁盤狀態列表的頁碼,起始值為 1,默認值為 1
PageSize Integer 分頁查詢時設置的每頁行數,最大值 100 行,默認為 10

返回參數

名稱 類型 描述
RegionId String 鏡像所屬地域 Id
TotalCount Integer 磁盤總個數
PageNumber Integer 磁盤列表的頁碼
PageSize Integer 輸入時設置的每頁行數
Disks DiskItemType 磁盤信息 DiskItemType 組成的集合

錯誤碼

錯誤代碼 描述 Http 狀態碼 語義
MissingParameter The input parameter "RegionId" that is mandatory for processing this request is not supplied. 400 RegionId 參數未指定
InvalidDiskType.ValueNotSupported The specified disk type is not supported. 400 指定的磁盤屬性不支持
InvalidCategory.ValueNotSupported The specified disk category is not supported. 400 指定的磁盤種類不支持或者無權限
InvalidStatus.ValueNotSupported The specified disk status is not supported. 400 指定的磁盤狀態不支持
InvalidParameter The specified parameter ""Portable"" is not valid. 400 指定的 Portable 參數不合法
InvalidParameter The specified parameter ""DeleteWithInstance"" is not valid. 400 指定的 DeleteWithInstance 參數不合法
InvalidParameter The specified parameter ""DeleteAutoSnapshot"" is not valid. 400 指定的 DeleteAutoSnapshot 參數不合法
InvalidParameter The specified parameter ""PageNumber"" is not valid. 400 指定的 PageNumber 參數不合法
InvalidParameter The specified parameter ""PageSize"" is not valid. 400 指定的 PageSize 參數不合法
InvalidDiskIds.Malformed The amount of specified disk Ids exceeds the limit. 403 指定的 DiskId 格式不正確
InvalidDiskChargeType.NotFound The DiskChargeType does not exist in our records 404 指定的 DiskChargeType 不存在

示例

請求示例

https://ecs.aliyuncs.com/?action=DescribeDisks
&RegionId=cn-qingdao
&PageNumber=1
&ZoneId=cn-qingdao-b
&<公共請求參數>

返回示例

XML格式:

<DescribeDisksResponse>
    <Disks>
        <Disk>
            <DeleteAutoSnapshot>true</DeleteAutoSnapshot>
            <DeleteWithInstance>false</DeleteWithInstance>
            <EnableAutoSnapshot>false</EnableAutoSnapshot>
            <Category>cloud</Category>
            <Description></Description>
            <DiskName></DiskName>
            <Size>5</Size>
            <Type>data</Type>
            <InstanceId></InstanceId>
            <CreationTime>2014-07-23T02:44:07Z</CreationTime>
            <ImageId></ImageId>
            <ZoneId>cn-qingdao-b</ZoneId>
            <AttachedTime>2014-07-23T07:47:35Z</AttachedTime>
            <DetachedTime>2014-07-23T08:28:48Z</DetachedTime>
            <Device></Device>
            <OperationLocks></OperationLocks>
            <Portable>true</Portable>
            <ProductCode></ProductCode>
            <RegionId>cn-qingdao</RegionId>
            <DiskId>d-28m5zbua0</DiskId>
            <SourceSnapshotId></SourceSnapshotId>
            <Status>Available</Status>
        </Disk>
        <Disk>
            <DeleteAutoSnapshot>true</DeleteAutoSnapshot>
            <DeleteWithInstance>false</DeleteWithInstance>
            <EnableAutoSnapshot>false</EnableAutoSnapshot>
            <Category>cloud</Category>
            <Description></Description>
            <DiskName></DiskName>
            <Size>5</Size>
            <Type>data</Type>
            <InstanceId></InstanceId>
            <CreationTime>2014-07-23T02:44:06Z</CreationTime>
            <ImageId></ImageId>
            <ZoneId>cn-qingdao-b</ZoneId>
            <AttachedTime></AttachedTime>
            <DetachedTime></DetachedTime>
            <Device></Device>
            <OperationLocks></OperationLocks>
            <Portable>true</Portable>
            <ProductCode></ProductCode>
            <RegionId>cn-qingdao</RegionId>
            <DiskId>d-28zfrmo13</DiskId>
            <SourceSnapshotId></SourceSnapshotId>
            <Status>Available</Status>
        </Disk>
    </Disks>
    <PageNumber>1</PageNumber>
    <PageSize>2</PageSize>
    <TotalCount>9</TotalCount>
    <RequestId>ED5CF6DD-71CA-462C-9C94-A61A78A01479</RequestId>
</DescribeDisksResponse>

JSON格式:

{
  "Disks": {
    "Disk": [
      {
        "AttachedTime": "2014-07-23T07:47:35Z",
        "Category": "cloud",
        "CreationTime": "2014-07-23T02:44:07Z",
        "DeleteAutoSnapshot": true,
        "DeleteWithInstance": false,
        "EnableAutoSnapshot": false
        "Description": "",
        "DetachedTime": "2014-07-23T08:28:48Z",
        "Device": "",
        "DiskId": "d-28m5zbua0",
        "DiskName": "",
        "ImageId": "",
        "InstanceId": "",
        "OperationLocks": {
            "OperationLock": []
        },
        "Portable": true,
        "ProductCode": "",
        "RegionId": "cn-qingdao",
        "Size": 5,
        "SourceSnapshotId": "",
        "Status": "Available",
        "Type": "data",
        "ZoneId": "cn-qingdao-b"
      },
      {
        "AttachedTime": "",
        "Category": "cloud",
        "CreationTime": "2014-07-23T02:44:06Z",
        "DeleteAutoSnapshot": true,
        "DeleteWithInstance": false,
        "EnableAutoSnapshot": false
        "Description": "",
        "DetachedTime": "",
        "Device": "",
        "DiskId": "d-28zfrmo13",
        "DiskName": "",
        "ImageId": "",
        "InstanceId": "",
        "OperationLocks": {
            "OperationLock": []
        },
        "Portable": true,
        "ProductCode": "",
        "RegionId": "cn-qingdao",
        "Size": 5,
        "SourceSnapshotId": "",
        "Status": "Available",
        "Type": "data",
        "ZoneId": "cn-qingdao-b"
      }
    ]
  },
  "PageNumber": 1,
  "PageSize": 2,
  "RequestId": "ACD9BBB0-A9D1-46D7-9630-B7A69889E110",
  "TotalCount": 9
}

最後更新:2016-11-23 16:03:50

  上一篇:go 創建磁盤__磁盤相關接口_API 參考_雲服務器 ECS-阿裏雲
  下一篇:go 掛載磁盤__磁盤相關接口_API 參考_雲服務器 ECS-阿裏雲