CreateDisks
1. API Description
This API is used to create one or more disks.
2. Input Parameters
The following request parameter list only provides API request parameters.
zoneId
Yes
String
ID of availability zone to which the disk belongs.
diskName
Yes
String
Disk name.
This parameter must start with a number or a letter, containing up to 64 characters.
Only letters, numbers, - and periods (.) are supported.
diskSize
Yes
Integer
Storage space.
Unit: GB.
diskAmount
Yes
Integer
Quantity of disks.
Minimum value: 1 (default value); Maximum value: 50.
instanceId
No
String
ID of instance to which the disks are attached. Specify the ID of an instance in the current zone to which the disks are attached.
resourceGroupId
No
String
Resource group ID.
If the value is null, the disk will be added into default resource group.
diskCategory
No
String
Disk type.
Basic NVMe SSD
: the Basic NVMe SSD.Standard NVMe SSD
: the Standard NVMe SSD.
Default value: Standard NVMe SSD
.
Call DescribeDiskCategory
to obtain disk type.
snapshotId
No
String
ID of the snapshot to create a disk. If this parameter is specified, the disk will be created from the snapshot. The snapshot’s disk info must be of type disk.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
diskIds
Array of String
ID list of disks.
orderNumber
String
Number of order.
4. Code Example
Create one or more disks.
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateDisks
<Common Request Params>
Request:
{
"diskName": "Test-Disk",
"diskSize": 30,
"diskAmount": 1,
"zoneId": "HKG-A"
}
Response:
{
"requestId": "T842EE571-4490-4AFE-9F17-931030D3B4F9",
"response": {
"requestId": "T842EE571-4490-4AFE-9F17-931030D3B4F9",
"diskIds": [
"862857204414550690"
],
"orderNumber": "862857208122313378"
}
}
5. Developer Resources
Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.
6. Error Codes
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
400
INVALID_CHARGE_TYPE
Invalid billing model.
400
INVALID_DISK_CATEGORY_ZONE_NO_SELL
Disk type not for sale in the zone.
400
INVALID_DISK_SIZE_EXCEED_MAXIMUM
Disk size exceeds the maximum limit.
400
INVALID_DISK_SIZE_LESS_MINIMUM
Disk size exceeds the minimum limit.
404
INVALID_DISK_SNAPSHOT_NOT_FOUND
Snapshot does not exist.
400
INVALID_DISK_SNAPSHOT_SIZE_MISMATCH
The capacity of the created disk is smaller than the source disk size of the snapshot.
404
INVALID_DISK_SNAPSHOT_ZONE_MISMATCH
The snapshot does not match the specified zone.
404
INVALID_INSTANCE_NOT_FOUND
Instance to which the disks to be attached does not exist.
404
INVALID_INSTANCE_OR_ZONE_CANNOT_BE_BOTH_EMPTY
Specify at least one of the parameters: instance and zone.
404
INVALID_ZONE_NOT_FOUND
Availability zone does not exist.
400
LIMIT_EXCEEDED_INSTANCE_CAN_ATTACH
Quantity of attached disks exceeds the maximum limit.
400
OPERATION_DENIED_DISK_SNAPSHOT_STATUS
The operation is not supported for current snapshot state.
400
OPERATION_DENIED_DISK_SYSTEM_TYPE
The operation is not supported for system disks.
400
UNSUPPORTED_OPERATION_INSTANCE_STATUS
The operation is not supported for current instance state.
Last updated