阿里云如何使用創(chuàng)建磁盤(pán)接口
來(lái)源:技術(shù)員聯(lián)盟┆發(fā)布時(shí)間:2017-12-06 00:02┆點(diǎn)擊:
創(chuàng)建磁盤(pán)需要通過(guò)實(shí)名認(rèn)證。沒(méi)有通過(guò)實(shí)名認(rèn)證的可以前往 阿里云官網(wǎng) 中的用戶(hù)中心 —> 會(huì)員信息中進(jìn)行實(shí)名認(rèn)證。
本接口是用于創(chuàng)建可卸載云盤(pán)的數(shù)據(jù)盤(pán),包括普通云盤(pán)、高效云盤(pán)和SSD云盤(pán),系統(tǒng)盤(pán)的快照不能用來(lái)創(chuàng)建數(shù)據(jù)盤(pán)。創(chuàng)建磁盤(pán)時(shí),默認(rèn)在刪除磁盤(pán)時(shí)刪除自動(dòng)快照,即 DeleteAutoSnapshot=true,可以通過(guò) 修改磁盤(pán)屬性 修改該參數(shù)。通過(guò)該接口創(chuàng)建的盤(pán)Portable屬性為true。收費(fèi)方式為按量付費(fèi)。
請(qǐng)求參數(shù)中 Size 和 SnapshotId 必須選擇其中一項(xiàng)來(lái)指定磁盤(pán)的大小或使用快照創(chuàng)建磁盤(pán)。
請(qǐng)求參數(shù)
名稱(chēng)
類(lèi)型
是否必須
描述
Action
String
是
操作接口名,系統(tǒng)規(guī)定參數(shù),取值:CreateDisk
RegionId
String
是
實(shí)例所屬的 Region ID
ZoneId
String
是
可用區(qū) ID
DiskName
String
否
磁盤(pán)名稱(chēng),不填則為空,默認(rèn)值為空,[2, 128] 英文或中文字符,必須以大小字母或中文開(kāi)頭,可包含數(shù)字,”.”,”_”或”-”,磁盤(pán)名稱(chēng)會(huì)展示在控制臺(tái)。不能以 和 https:// 開(kāi)頭。
Description
String
否
磁盤(pán)描述,不填則為空,默認(rèn)值為空,[2, 256] 個(gè)字符,磁盤(pán)描述會(huì)展示在控制臺(tái)。不能以 和 https:// 開(kāi)頭。
DiskCategory
String
否
數(shù)據(jù)盤(pán)的磁盤(pán)種類(lèi)
可選值:
cloud – 普通云盤(pán)
cloud_efficiency – 高效云盤(pán)
cloud_ssd – SSD云盤(pán)
默認(rèn)值:cloud
Size
Integer
否
容量大小,以GB為單位:
cloud:5 ~ 2000
cloud_efficiency:20 ~ 32768
cloud_ssd:20 ~ 32768
指定該參數(shù)后,Size大小必須 ≥ 指定快照 SnapshotId 的大小。
SnapshotId
String
否
創(chuàng)建數(shù)據(jù)盤(pán)使用的快照
指定該參數(shù)后 Size 會(huì)被忽略,實(shí)際創(chuàng)建的磁盤(pán)大小為指定快照的大小
2013 年 7 月 15 日(含)前的快照不能用來(lái)創(chuàng)建磁盤(pán)
ClientToken
String
否
用于保證請(qǐng)求的冪等性。由客戶(hù)端生成該參數(shù)值,要保證在不同請(qǐng)求間唯一,最大不值過(guò) 64 個(gè) ASCII 字符。
具體參見(jiàn)附錄:如何保證冪等性。
返回參數(shù)
名稱(chēng)
類(lèi)型
描述
DiskId
String
磁盤(pán) ID
錯(cuò)誤碼
錯(cuò)誤代碼
描述
Http 狀態(tài)碼
語(yǔ)義
MissingParameter
The input parameter “RegionId” that is mandatory for processing this request is not supplied.
400
RegionId 參數(shù)未指定
MissingParameter
The input parameter “ZoneId” that is mandatory for processing this request is not supplied.
400
缺少 ZoneId 值(實(shí)際情況也可能是該用戶(hù)無(wú)權(quán)使用此 Zone)
InvalidRegionId.NotFound
The specified region does not exist.
404
指定的 RegionId 不存在
InvalidZoneId.NotFound
The specified zone does not exist.
404
指定的 ZoneId 不存在
InvalidSnapshotId.NotFound
The specified snapshot does not exist.
404
指定的 SnapshotId 不存在
InvalidDiskName.Malformed
The specified disk name is wrongly formed.
400
指定的 DiskName 格式不合法
InvalidDescription.Malformed
The specified description is wrongly formed.
400
指定的 DescriptionName 格式不合法
InvalidParameter
The specified parameter “Size” is not valid.
400
Size 參數(shù)不合法
InstanceDiskCategoryLimitExceed
The total size of specified disk category in an instance exceeds.
403
指定的磁盤(pán)種類(lèi)超過(guò)了單實(shí)例的最大容量
InvalidSnapshot.TooOld
This operation is forbidden because the specified snapshot is created before 2013-07-15.
403
指定快照創(chuàng)建于 2013 年 7 月 15 日(含)之前,不能創(chuàng)建磁盤(pán)
InvalidSnapshot.TooLarge
The capacity of snapshot exceeds 2000GB.
403
指定快照的容量超過(guò)磁盤(pán)種類(lèi)的最大容量
OperationDenied
The specified snapshot is not allowed to create disk.
403
指定快照不允許創(chuàng)建磁盤(pán)
QuotaExceed.PortableCloudDisk
The quota of portable cloud disk exceeds.
403
可卸載普通云盤(pán)超過(guò)額度
MissingParameter
The input parameter either “SnapshotId” or “Size” should be specified.
400
SnapshotId 或者 Size 參數(shù)未指定
InvalidDiskCategory.ValueUnauthorized
The disk category is not authorized.
403
指定磁盤(pán)種類(lèi)無(wú)權(quán)限
InvalidSnapshotId.NotReady
The specified snapshot has not completed yet.
403
指定的快照未完成
InvalidSnapshotId.NotDataDiskSnapshot
The specified snapshot is system disk snapshot.
403
指定的快照不是數(shù)據(jù)盤(pán)快照,不能創(chuàng)建數(shù)據(jù)盤(pán)
InvalidSnapshotId.NotFound
The specified snapshot does not exist.
404
找不到指定的快照
示例
請(qǐng)求示例