CreateInstanceOffering

API Request

URLs
POST zstack/v1/instance-offerings
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"name": "instanceOffering",
"cpuNum": 2.0,
"memorySize": 2097152.0,
"sortKey": 0.0,
"type": "UserVm"
  },
"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":"instanceOffering","cpuNum":2.0,"memorySize":2097152.0,"sortKey":0.0,"type":"UserVm"}}' \
http://localhost:8080/zstack/v1/instance-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
cpuNum int body (contained in the params structure) The CPU count. 0.6
memorySize long body (contained in the params structure) The memory size. Unit: byte. 0.6
allocatorStrategy String body (contained in the params structure) Optional. The allocator strategy.
  • DefaultHostAllocatorStrategy
  • LastHostPreferredAllocatorStrategy
  • LeastVmPreferredHostAllocatorStrategy
  • MinimumCPUUsageHostAllocatorStrategy
  • MinimumMemoryUsageHostAllocatorStrategy
  • MaxInstancePerHostHostAllocatorStrategy
0.6
sortKey int body (contained in the params structure) Optional. The sort key. 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 an instance offering in ZStack Cloud, you can add a GPU specification by adding the pciRom option to SystemTags.
    • Format of the pciRom option: pciRomUuid::UUID. Here, the UUID is the UUID of the PCI device firmware.
    • Example: pciRomUuid::5fd71606d5af451d981413f35367a8d6
  • When you create an instance offering in ZStack Cloud, you can customize the instance offering parameters by adding the instanceOfferingUserConfig option to SystemTags.
    • Format of the instanceOfferingUserConfig option: instanceOfferingUserConfig::xxx. Here, xxx must be a JSON string.

API Response

Sample Response
{
"inventory": {
"uuid": "d04e02a97d6c4ad0b0acee2a2f6c7084",
"name": "instanceOffering1",
"cpuNum": 2.0,
"cpuSpeed": 1.0,
"type": "UserVm",
"allocatorStrategy": "Mevoco",
"createDate": "Jun 7, 2017 9:20:40 PM",
"lastOpDate": "Jun 7, 2017 9:20:40 PM",
"state": "Enabled"
  }
}
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 InstanceOfferingInventory 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
cpuNum Integer The CPU count. 0.6
cpuSpeed Integer The CPU speed. 0.6
memorySize Long The memory size. 0.6
type String The type. 0.6
allocatorStrategy String The allocator strategy. 0.6
sortKey Integer 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
state String The state, including Enabled and Disabled. 0.6

SDK Sample

Java SDK
CreateInstanceOfferingAction action = new CreateInstanceOfferingAction();
action.name = "instanceOffering";
action.cpuNum = 2.0;
action.memorySize = 2097152.0;
action.sortKey = 0.0;
action.type = "UserVm";
action.sessionId = "1567ec4024724d2ea60eba29b957158c";
CreateInstanceOfferingAction.Result res = action.call();

Python SDK

CreateInstanceOfferingAction action = CreateInstanceOfferingAction()
action.name = "instanceOffering"
action.cpuNum = 2.0
action.memorySize = 2097152.0
action.sortKey = 0.0
action.type = "UserVm"
action.sessionId = "427dd2d091a54a0999e7e31eac07fc83"
CreateInstanceOfferingAction.Result res = action.call()

DeleteInstanceOffering

API Request

URLs
DELETE zstack/v1/instance-offerings/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth cd94b78dc89842c19ea248ddb04816c0" \
-X DELETE http://localhost:8080/zstack/v1/instance-offerings/d4061032ef3940b990ba671acd1221fc?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
DeleteInstanceOfferingAction action = new DeleteInstanceOfferingAction();
action.uuid = "07ce817b8d9d4f629c2bd65daae9b7bb";
action.deleteMode = "Permissive";
action.sessionId = "fd2aa30babca411780c7df97d3ae6f9f";
DeleteInstanceOfferingAction.Result res = action.call();
Python SDK
DeleteInstanceOfferingAction action = DeleteInstanceOfferingAction()
action.uuid = "694e24b4a64d4b45936a9bbcf878078b"
action.deleteMode = "Permissive"
action.sessionId = "a13ac6edf7f546e48c4dbfea66429610"
DeleteInstanceOfferingAction.Result res = action.call()

QueryInstanceOffering

API Request

URLs
GET zstack/v1/instance-offerings
GET zstack/v1/instance-offerings/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth d4743a8bc4eb4dd7a827c58e20437e85" \
-X GET http://localhost:8080/zstack/v1/instance-offerings?q=uuid=3695f87b54594284b9ce542b2b653fb7
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e053145ce7d74cad8686d9b2a91e2754" \
-X GET http://localhost:8080/zstack/v1/instance-offerings/b1c967830a5f4b198b291d7f22cc8a2f

Queryable Fields

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

API Response

Sample Response

{
"inventories": [
    {
"uuid": "4f7e7eff5bb04f7cacc33a18006a0c72",
"name": "instanceOffering1",
"cpuNum": 2.0,
"cpuSpeed": 1.0,
"type": "UserVm",
"allocatorStrategy": "Mevoco",
"createDate": "Jun 7, 2017 9:20:13 PM",
"lastOpDate": "Jun 7, 2017 9:20:13 PM",
"state": "Enabled"
    }
  ]
}
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
cpuNum Integer The CPU count. 0.6
cpuSpeed Integer The CPU speed. 0.6
memorySize Long The memory size. 0.6
type String The type. 0.6
allocatorStrategy String The allocator strategy. 0.6
sortKey Integer 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
state String The state, including Enabled and Disabled. 0.6

SDK Sample

Java SDK
QueryInstanceOfferingAction action = new QueryInstanceOfferingAction();
action.conditions = asList("uuid=8c77205cdc114a9090bc5d978b9d5285");
action.sessionId = "7d91852598ca41ca904539b34396c2ec";
QueryInstanceOfferingAction.Result res = action.call();
Python SDK
QueryInstanceOfferingAction action = QueryInstanceOfferingAction()
action.conditions = ["uuid=6539c13e7a8843b7860ebc53c3f7e892"]
action.sessionId = "8700ab8ae22e48fb81a793b9a51e970a"
QueryInstanceOfferingAction.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