POST zstack/v1/cloudformation/template
Authorization: OAuth the-session-uuid
{ "params": { "name": "stack", "description": "description", "type": "zstack", "templateContent": "{ \"ZStackTemplateFormatVersion\" : \"2018-06-18\", \"Description\": \"Example for create a group vm instance in zstack.\", \"Parameters\" : { \"imageUuid\": { \"Type\" : \"String\", \"Description\": \"Image Uuid, represents the image resource to startup one vm instance\" }, \"instanceOfferingUuid\": { \"Type\": \"String\", \"DefaultValue\" : \"instanceoffering-123\", \"Description\": \"The instance offering uuid\" }, \"l3NetworkUuid\": { \"Type\": \"String\", \"Description\": \"The l3 network uuid\" }, \"DiskOfferingUuid\": { \"Type\": \"String\", \"Description\": \"DiskOffering for empty disk\" }, \"PrimaryStorageUuid\": { \"Type\": \"String\", \"Description\": \"primarystorage for initial disk\" }, \"HostUuid\": { \"Type\": \"String\", \"Description\": \"host for initial disk\" } }, \"Resources\" : { \"WebServer1\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DeletionPolicy\": \"Retain\" }, \"WebServer2\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm-2\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DependsOn\": [{\"Ref\": \"WebServer1\"}] }, \"EmptyVolume\": { \"Type\": \"ZStack::Resource::DataVolume\", \"Properties\": { \"name\" : \"empty-volume\", \"diskOfferingUuid\": {\"Ref\": \"DiskOfferingUuid\"}, \"primaryStorageUuid\": {\"Ref\": \"PrimaryStorageUuid\"}, \"systemTags\": [{\"Fn::Join\": [\"::\", [\"localStorage\", \"hostUuid\", {\"Ref\": \"HostUuid\"}]]}] }, \"DependsOn\": [{\"Ref\": \"WebServer2\"}] }, \"AttachDataVolumeToVm\": { \"Type\": \"ZStack::Action::AttachDataVolumeToVm\", \"Properties\": { \"vmInstanceUuid\": {\"Fn::GetAtt\" : [\"WebServer1\", \"uuid\"]}, \"volumeUuid\": {\"Fn::GetAtt\" : [\"EmptyVolume\", \"uuid\"]} } } }, \"Outputs\": { \"VmInstance\": { \"Description\" : \"print vm instance\", \"Value\" : {\"Ref\": \"WebServer1\"} } }}" }, "systemTags": [], "userTags": [] }
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"stack","description":"description","type":"zstack","templateContent":"{ \"ZStackTemplateFormatVersion\" : \"2018-06-18\", \"Description\": \"Example for create a group vm instance in zstack.\", \"Parameters\" : { \"imageUuid\": { \"Type\" : \"String\", \"Description\": \"Image Uuid, represents the image resource to startup one vm instance\" }, \"instanceOfferingUuid\": { \"Type\": \"String\", \"DefaultValue\" : \"instanceoffering-123\", \"Description\": \"The instance offering uuid\" }, \"l3NetworkUuid\": { \"Type\": \"String\", \"Description\": \"The l3 network uuid\" }, \"DiskOfferingUuid\": { \"Type\": \"String\", \"Description\": \"DiskOffering for empty disk\" }, \"PrimaryStorageUuid\": { \"Type\": \"String\", \"Description\": \"primarystorage for initial disk\" }, \"HostUuid\": { \"Type\": \"String\", \"Description\": \"host for initial disk\" } }, \"Resources\" : { \"WebServer1\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DeletionPolicy\": \"Retain\" }, \"WebServer2\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm-2\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DependsOn\": [{\"Ref\": \"WebServer1\"}] }, \"EmptyVolume\": { \"Type\": \"ZStack::Resource::DataVolume\", \"Properties\": { \"name\" : \"empty-volume\", \"diskOfferingUuid\": {\"Ref\": \"DiskOfferingUuid\"}, \"primaryStorageUuid\": {\"Ref\": \"PrimaryStorageUuid\"}, \"systemTags\": [{\"Fn::Join\": [\"::\", [\"localStorage\", \"hostUuid\", {\"Ref\": \"HostUuid\"}]]}] }, \"DependsOn\": [{\"Ref\": \"WebServer2\"}] }, \"AttachDataVolumeToVm\": { \"Type\": \"ZStack::Action::AttachDataVolumeToVm\", \"Properties\": { \"vmInstanceUuid\": {\"Fn::GetAtt\" : [\"WebServer1\", \"uuid\"]}, \"volumeUuid\": {\"Fn::GetAtt\" : [\"EmptyVolume\", \"uuid\"]} } } }, \"Outputs\": { \"VmInstance\": { \"Description\" : \"print vm instance\", \"Value\" : {\"Ref\": \"WebServer1\"} } }}"}}' \ http://localhost:8080/zstack/v1/cloudformation/template
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
name | String | body (contained in the params structure) | The resource name. | 2.5.0 | |
description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 2.5.0 | |
type | String | body (contained in the params structure) | Optional. The template type. Default type: zstack. |
| 2.5.0 |
templateContent | String | body (contained in the params structure) | The template content, which is a JSON string. | 2.5.0 | |
resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 2.5.0 | |
systemTags | List | body | Optional. The system tags. | 2.5.0 | |
userTags | List | body | Optional. The user tags. | 2.5.0 |
{ "inventory": { "uuid": "9e3dd776d9ed3c048b74b930aadded5d", "name": "stack", "type": "zstack", "version": "2018-06-18", "state": true, "content": "{ \"ZStackTemplateFormatVersion\" : \"2018-06-18\", \"Description\": \"Example for create a group vm instance in zstack.\", \"Parameters\" : { \"imageUuid\": { \"Type\" : \"String\", \"Description\": \"Image Uuid, represents the image resource to startup one vm instance\" }, \"instanceOfferingUuid\": { \"Type\": \"String\", \"DefaultValue\" : \"instanceoffering-123\", \"Description\": \"The instance offering uuid\" }, \"l3NetworkUuid\": { \"Type\": \"String\", \"Description\": \"The l3 network uuid\" }, \"DiskOfferingUuid\": { \"Type\": \"String\", \"Description\": \"DiskOffering for empty disk\" }, \"PrimaryStorageUuid\": { \"Type\": \"String\", \"Description\": \"primarystorage for initial disk\" }, \"HostUuid\": { \"Type\": \"String\", \"Description\": \"host for initial disk\" } }, \"Resources\" : { \"WebServer1\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DeletionPolicy\": \"Retain\" }, \"WebServer2\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm-2\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DependsOn\": [{\"Ref\": \"WebServer1\"}] }, \"EmptyVolume\": { \"Type\": \"ZStack::Resource::DataVolume\", \"Properties\": { \"name\" : \"empty-volume\", \"diskOfferingUuid\": {\"Ref\": \"DiskOfferingUuid\"}, \"primaryStorageUuid\": {\"Ref\": \"PrimaryStorageUuid\"}, \"systemTags\": [{\"Fn::Join\": [\"::\", [\"localStorage\", \"hostUuid\", {\"Ref\": \"HostUuid\"}]]}] }, \"DependsOn\": [{\"Ref\": \"WebServer2\"}] }, \"AttachDataVolumeToVm\": { \"Type\": \"ZStack::Action::AttachDataVolumeToVm\", \"Properties\": { \"vmInstanceUuid\": {\"Fn::GetAtt\" : [\"WebServer1\", \"uuid\"]}, \"volumeUuid\": {\"Fn::GetAtt\" : [\"EmptyVolume\", \"uuid\"]} } } }, \"Outputs\": { \"VmInstance\": { \"Description\" : \"print vm instance\", \"Value\" : {\"Ref\": \"WebServer1\"} } }}" } }
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.5.0 |
inventory | StackTemplateInventory | See inventory. | 2.5.0 |
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 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.5.0 |
name | String | The resource name. | 2.5.0 |
description | String | The detailed description of the resource. | 2.5.0 |
type | String | The template content, which is a JSON string. | 2.5.0 |
version | String | The template version. | 2.5.0 |
state | Boolean | Whether the template is available. | 2.5.0 |
content | String | The template content, which is a JSON string. | 2.5.0 |
md5sum | String | The MD5 checksum value of the content field. | 2.5.0 |
createDate | Timestamp | The creation date. | 2.5.0 |
lastOpDate | Timestamp | The last operation date. | 2.5.0 |
AddStackTemplateAction action = new AddStackTemplateAction(); action.name = "stack"; action.description = "description"; action.type = "zstack"; action.templateContent = "{ "ZStackTemplateFormatVersion" : "2018-06-18", "Description": "Example for create a group vm instance in zstack.", "Parameters" : { "imageUuid": { "Type" : "String", "Description": "Image Uuid, represents the image resource to startup one vm instance" }, "instanceOfferingUuid": { "Type": "String", "DefaultValue" : "instanceoffering-123", "Description": "The instance offering uuid" }, "l3NetworkUuid": { "Type": "String", "Description": "The l3 network uuid" }, "DiskOfferingUuid": { "Type": "String", "Description": "DiskOffering for empty disk" }, "PrimaryStorageUuid": { "Type": "String", "Description": "primarystorage for initial disk" }, "HostUuid": { "Type": "String", "Description": "host for initial disk" } }, "Resources" : { "WebServer1": { "Type": "ZStack::Resource::VmInstance", "Properties": { "name" : "vm", "imageUuid" : {"Ref": "imageUuid"}, "instanceOfferingUuid": {"Ref": "instanceOfferingUuid"}, "l3NetworkUuids": [{"Ref": "l3NetworkUuid"}] }, "DeletionPolicy": "Retain" }, "WebServer2": { "Type": "ZStack::Resource::VmInstance", "Properties": { "name" : "vm-2", "imageUuid" : {"Ref": "imageUuid"}, "instanceOfferingUuid": {"Ref": "instanceOfferingUuid"}, "l3NetworkUuids": [{"Ref": "l3NetworkUuid"}] }, "DependsOn": [{"Ref": "WebServer1"}] }, "EmptyVolume": { "Type": "ZStack::Resource::DataVolume", "Properties": { "name" : "empty-volume", "diskOfferingUuid": {"Ref": "DiskOfferingUuid"}, "primaryStorageUuid": {"Ref": "PrimaryStorageUuid"}, "systemTags": [{"Fn::Join": ["::", ["localStorage", "hostUuid", {"Ref": "HostUuid"}]]}] }, "DependsOn": [{"Ref": "WebServer2"}] }, "AttachDataVolumeToVm": { "Type": "ZStack::Action::AttachDataVolumeToVm", "Properties": { "vmInstanceUuid": {"Fn::GetAtt" : ["WebServer1", "uuid"]}, "volumeUuid": {"Fn::GetAtt" : ["EmptyVolume", "uuid"]} } } }, "Outputs": { "VmInstance": { "Description" : "print vm instance", "Value" : {"Ref": "WebServer1"} } }}"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; AddStackTemplateAction.Result res = action.call();
AddStackTemplateAction action = AddStackTemplateAction() action.name = "stack" action.description = "description" action.type = "zstack" action.templateContent = "{ "ZStackTemplateFormatVersion" : "2018-06-18", "Description": "Example for create a group vm instance in zstack.", "Parameters" : { "imageUuid": { "Type" : "String", "Description": "Image Uuid, represents the image resource to startup one vm instance" }, "instanceOfferingUuid": { "Type": "String", "DefaultValue" : "instanceoffering-123", "Description": "The instance offering uuid" }, "l3NetworkUuid": { "Type": "String", "Description": "The l3 network uuid" }, "DiskOfferingUuid": { "Type": "String", "Description": "DiskOffering for empty disk" }, "PrimaryStorageUuid": { "Type": "String", "Description": "primarystorage for initial disk" }, "HostUuid": { "Type": "String", "Description": "host for initial disk" } }, "Resources" : { "WebServer1": { "Type": "ZStack::Resource::VmInstance", "Properties": { "name" : "vm", "imageUuid" : {"Ref": "imageUuid"}, "instanceOfferingUuid": {"Ref": "instanceOfferingUuid"}, "l3NetworkUuids": [{"Ref": "l3NetworkUuid"}] }, "DeletionPolicy": "Retain" }, "WebServer2": { "Type": "ZStack::Resource::VmInstance", "Properties": { "name" : "vm-2", "imageUuid" : {"Ref": "imageUuid"}, "instanceOfferingUuid": {"Ref": "instanceOfferingUuid"}, "l3NetworkUuids": [{"Ref": "l3NetworkUuid"}] }, "DependsOn": [{"Ref": "WebServer1"}] }, "EmptyVolume": { "Type": "ZStack::Resource::DataVolume", "Properties": { "name" : "empty-volume", "diskOfferingUuid": {"Ref": "DiskOfferingUuid"}, "primaryStorageUuid": {"Ref": "PrimaryStorageUuid"}, "systemTags": [{"Fn::Join": ["::", ["localStorage", "hostUuid", {"Ref": "HostUuid"}]]}] }, "DependsOn": [{"Ref": "WebServer2"}] }, "AttachDataVolumeToVm": { "Type": "ZStack::Action::AttachDataVolumeToVm", "Properties": { "vmInstanceUuid": {"Fn::GetAtt" : ["WebServer1", "uuid"]}, "volumeUuid": {"Fn::GetAtt" : ["EmptyVolume", "uuid"]} } } }, "Outputs": { "VmInstance": { "Description" : "print vm instance", "Value" : {"Ref": "WebServer1"} } }}" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" AddStackTemplateAction.Result res = action.call()
DELETE zstack/v1/cloudformation/template/{uuid}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X DELETE http://localhost:8080/zstack/v1/cloudformation/template/dbeed1e724c13eb49650b3bdf7993d7b
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 2.5.0 | |
deleteMode | String | body | Optional. The delete mode. | 2.5.0 | |
systemTags | List | body | Optional. The system tags. | 2.5.0 | |
userTags | List | body | Optional. The user tags. | 2.5.0 |
{ "error": { "code": "SYS.1001", "description": "A message or a operation timeout", "details": "Create VM on KVM timeout after 300s" } }
DeleteStackTemplateAction action = new DeleteStackTemplateAction(); action.uuid = "dbeed1e724c13eb49650b3bdf7993d7b"; action.deleteMode = "Permissive"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; DeleteStackTemplateAction.Result res = action.call();
DeleteStackTemplateAction action = DeleteStackTemplateAction() action.uuid = "dbeed1e724c13eb49650b3bdf7993d7b" action.deleteMode = "Permissive" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" DeleteStackTemplateAction.Result res = action.call()
GET zstack/v1/cloudformation/template GET zstack/v1/cloudformation/template/{uuid}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X GET http://localhost:8080/zstack/v1/cloudformation/template?q=name=test
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X GET http://localhost:8080/zstack/v1/cloudformation/template/285b46cc67623c6d92eebc1ecab8f139
Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryStackTemplate
, and pressing the Tab key.
{ "inventories": [ { "uuid": "5c1bb041907e3f29a27c7818e7fd07de", "name": "test", "description": "description", "type": "zstack", "version": "2018-06-18", "state": true, "content": "{ \"ZStackTemplateFormatVersion\" : \"2018-06-18\", \"Description\": \"Example for create a group vm instance in zstack.\", \"Parameters\" : { \"imageUuid\": { \"Type\" : \"String\", \"Description\": \"Image Uuid, represents the image resource to startup one vm instance\" }, \"instanceOfferingUuid\": { \"Type\": \"String\", \"Description\": \"The instance offering uuid\" }, \"l3NetworkUuid\": { \"Type\": \"String\", \"Description\": \"The l3 network uuid\" }, \"DiskOfferingUuid\": { \"Type\": \"String\", \"Description\": \"DiskOffering for empty disk\" }, \"PrimaryStorageUuid\": { \"Type\": \"String\", \"Description\": \"primarystorage for initial disk\" }, \"HostUuid\": { \"Type\": \"String\", \"Description\": \"host for initial disk\" } }, \"Resources\" : { \"WebServer1\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DeletionPolicy\": \"Retain\" }, \"WebServer2\": { \"Type\": \"ZStack::Resource::VmInstance\", \"Properties\": { \"name\" : \"vm-2\", \"imageUuid\" : {\"Ref\": \"imageUuid\"}, \"instanceOfferingUuid\": {\"Ref\": \"instanceOfferingUuid\"}, \"l3NetworkUuids\": [{\"Ref\": \"l3NetworkUuid\"}] }, \"DependsOn\": [{\"Ref\": \"WebServer1\"}] }, \"EmptyVolume\": { \"Type\": \"ZStack::Resource::DataVolume\", \"Properties\": { \"name\" : \"empty-volume\", \"diskOfferingUuid\": {\"Ref\": \"DiskOfferingUuid\"}, \"primaryStorageUuid\": {\"Ref\": \"PrimaryStorageUuid\"}, \"systemTags\": [{\"Fn::Join\": [\"::\", [\"localStorage\", \"hostUuid\", {\"Ref\": \"HostUuid\"}]]}] }, \"DependsOn\": [{\"Ref\": \"WebServer2\"}] }, \"AttachDataVolumeToVm\": { \"Type\": \"ZStack::Action::AttachDataVolumeToVm\", \"Properties\": { \"vmInstanceUuid\": {\"Fn::GetAtt\" : [\"WebServer1\", \"uuid\"]}, \"volumeUuid\": {\"Fn::GetAtt\" : [\"EmptyVolume\", \"uuid\"]} } } }, \"Outputs\": { \"VmInstance\": { \"Description\" : \"print vm instance\", \"Value\" : {\"Ref\": \"WebServer1\"} } }}" } ] }
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.5.0 |
inventories | List | See inventories. | 2.5.0 |
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. | 2.5.0 |
description | String | The brief description of the error. | 2.5.0 |
details | String | The details about the error. | 2.5.0 |
elaboration | String | The reserved field. Default value: null. | 2.5.0 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 2.5.0 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.5.0 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.5.0 |
name | String | The resource name. | 2.5.0 |
description | String | The detailed description of the resource. | 2.5.0 |
type | String | The template type. Default type: zstack. | 2.5.0 |
version | String | The template version. | 2.5.0 |
state | Boolean | Whether the template is available. | 2.5.0 |
content | String | The template content, which is a JSON string. | 2.5.0 |
createDate | Timestamp | The creation date. | 2.5.0 |
lastOpDate | Timestamp | The last operation date. | 2.5.0 |
QueryStackTemplateAction action = new QueryStackTemplateAction(); action.conditions = asList("name=test"); action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; QueryStackTemplateAction.Result res = action.call();
QueryStackTemplateAction action = QueryStackTemplateAction() action.conditions = ["name=test"] action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" QueryStackTemplateAction.Result res = action.call()
Back to Top
Email Us
contact@zstack.ioEmail Us
contact@zstack.ioEmail Us
contact@zstack.ioThe 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.Thank you for using ZStack products and services.
Submit successfully.
We'll connect soon.Thank you for using ZStack products and services.