CreateDiskOffering

API Request

URLs
POST zstack/v1/disk-offerings
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"name": "diskOffering1",
"diskSize": 100.0,
"sortKey": 0.0
  },
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"diskOffering1","diskSize":100.0,"sortKey":0.0}}' \
http://localhost:8080/zstack/v1/disk-offerings
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
diskSize long body (contained in the params structure) The volume size. 0.6
sortKey int body (contained in the params structure) Optional. The sort key. 0.6
allocationStrategy String body (contained in the params structure) Optional. The allocation strategy.
  • DefaultHostAllocatorStrategy
  • LastHostPreferredAllocatorStrategy
  • LeastVmPreferredHostAllocatorStrategy
  • MinimumCPUUsageHostAllocatorStrategy
  • MinimumMemoryUsageHostAllocatorStrategy
  • MaxInstancePerHostHostAllocatorStrategy
0.6
type String body (contained in the params structure) Optional. The type. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
Note:
  • When you create a disk offering in ZStack Cloud, you can customize the disk offering parameters by adding the diskOfferingUserConfig option to SystemTags.
    • Format of the diskOfferingUserConfig option: diskOfferingUserConfig::xxx. Here, xxx must be a JSON string.

API Response

Sample Response
{
"inventory": {
"uuid": "e7a865815cd34dd29812d335dc1019bf",
"name": "diskOffering1",
"diskSize": 100.0,
"state": "Enabled",
"type": "DefaultDiskOfferingType",
"allocatorStrategy": "DefaultPrimaryStorageAllocationStrategy"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory DiskOfferingInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
diskSize Long The volume size. 0.6
sortKey Integer 0.6
state String The state, including Enabled and Disabled. 0.6
type String The type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
allocatorStrategy String The allocator strategy. 0.6

SDK Sample

Java SDK
CreateDiskOfferingAction action = new CreateDiskOfferingAction();
action.name = "diskOffering1";
action.diskSize = 100.0;
action.sortKey = 0.0;
action.sessionId = "5c780b5178c0432b9f86a758c4c75ea1";
CreateDiskOfferingAction.Result res = action.call();
Python SDK
CreateDiskOfferingAction action = CreateDiskOfferingAction()
action.name = "diskOffering1"
action.diskSize = 100.0
action.sortKey = 0.0
action.sessionId = "f930e0f78ce948778c8c3f1cbcd0c4ec"
CreateDiskOfferingAction.Result res = action.call()

DeleteDiskOffering

API Request

URLs
DELETE/v1/disk-offerings/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e12cbd12fbd54afd96c463c093ce1ed9" \
-X DELETE http://localhost:8080/zstack/v1/disk-offerings/6313fb03124a4aa6b7f77d8d153c0bcb?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
deleteMode String body Optional. The delete mode. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
DeleteDiskOfferingAction action = new DeleteDiskOfferingAction();
action.uuid = "1d4e09f16c7c45abaab80be172b26cc1";
action.deleteMode = "Permissive";
action.sessionId = "1a31abeeef7e4ab5bc538168be6deb05";
DeleteDiskOfferingAction.Result res = action.call();
Python SDK
DeleteDiskOfferingAction action = DeleteDiskOfferingAction()
action.uuid = "4f0d2dc3a8f34685ad8543834bf4cfd8"
action.deleteMode = "Permissive"
action.sessionId = "dce93830769b427ca6edf3bda25f65f6"
DeleteDiskOfferingAction.Result res = action.call()

QueryDiskOffering

API Request

URLs
GET zstack/v1/disk-offerings
GET zstack/v1/disk-offerings/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth d6550daa638547498b8075f3ebd1e240" \
-X GET http://localhost:8080/zstack/v1/disk-offerings?q=uuid=85c065f24d024bf3920766692da392eb
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3b32284bc5344692a8bc77a43610f460" \
-X GET http://localhost:8080/zstack/v1/disk-offerings/2f25294896e24c89b63edb7a209ebb85

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryDiskOffering, and pressing the Tab key.

API Response

Sample Response
{
"inventories": [
    {
"uuid": "7bd03741125a48d485255601b639318b",
"name": "diskOffering1",
"diskSize": 100.0,
"state": "Enabled",
"type": "DefaultDiskOfferingType",
"allocatorStrategy": "DefaultPrimaryStorageAllocationStrategy"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
diskSize Long The volume size. 0.6
sortKey Integer 0.6
state String The state, including Enabled and Disabled. 0.6
type String The type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
allocatorStrategy String The allocator strategy. 0.6

SDK Sample

Java SDK
QueryDiskOfferingAction action = new QueryDiskOfferingAction();
action.conditions = asList("uuid=e01b8a266d05425ba2d0c05308763db8");
action.sessionId = "d8a3f3b62d8c4affab7c5d491f95d4de";
QueryDiskOfferingAction.Result res = action.call();
Python SDK
QueryDiskOfferingAction action = QueryDiskOfferingAction()
action.conditions = ["uuid=a1f7f68522e64783a37095a862f9bc28"]
action.sessionId = "593740538236497183e065e1251b6937"
QueryDiskOfferingAction.Result res = action.call()


Download

Already filled the basic info? Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack certification training consulting
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for choosing ZStack products and services.

Back to Top