POST zstack/v1/cloudformation/templateAuthorization: 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 | String | body(包含在params结构中) | 资源名称 | 2.5.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.5.0 | |
| type (可选) | String | body(包含在params结构中) | 模板类型,默认为zstack | 
 | 2.5.0 | 
| templateContent | String | body(包含在params结构中) | 模板内容,json字符串 | 2.5.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 2.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 2.5.0 | |
| userTags (可选) | List | body | 用户标签 | 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\"}    }  }}"   } }| 名字 | 类型 | 描述 | 起始版本 | 
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.5.0 | 
| inventory | StackTemplateInventory | 详情参考inventory | 2.5.0 | 
| 名字 | 类型 | 描述 | 起始版本 | 
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 | 
| description | String | 错误的概要描述 | 0.6 | 
| details | String | 错误的详细信息 | 0.6 | 
| elaboration | String | 保留字段,默认为null | 0.6 | 
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 | 
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 | 
| 名字 | 类型 | 描述 | 起始版本 | 
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.5.0 | 
| name | String | 资源名称 | 2.5.0 | 
| description | String | 资源的详细描述 | 2.5.0 | 
| type | String | 模板类型,默认zstack | 2.5.0 | 
| version | String | 模板版本号 | 2.5.0 | 
| state | Boolean | 模板是否启用 | 2.5.0 | 
| content | String | 模板内容,json字符串 | 2.5.0 | 
| md5sum | String | content字段内容的md5校验值 | 2.5.0 | 
| createDate | Timestamp | 创建时间 | 2.5.0 | 
| lastOpDate | Timestamp | 最后一次修改时间 | 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-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X DELETE http://localhost:8080/zstack/v1/cloudformation/template/dbeed1e724c13eb49650b3bdf7993d7b| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 | 
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.5.0 | |
| deleteMode (可选) | String | body | 2.5.0 | ||
| systemTags (可选) | List | body | 系统标签 | 2.5.0 | |
| userTags (可选) | List | body | 用户标签 | 2.5.0 | 
{},出错时返回的JSON结构包含一个error字段,例如:{ "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()学习路径
ZStack Cloud 产品学习路径
快速梳理文档,点击相应文本链接,快速跳转到相应文档的页面,学习 ZStack Cloud 产品。
业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1ZStack学院:
training@zstack.io业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io下载链接已发送至您的邮箱。
如未收到,请查看您的垃圾邮件、订阅邮件、广告邮件。 当您收到电子邮件后,请点击 URL 链接,以完成下载。感谢您使用 ZStack 产品和服务。
成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。
信息提交成功。
我们将安排工作人员尽快与您取得联系,请保持电话畅通。感谢您使用 ZStack 产品和服务。
商务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2商务联系:
sales@zstack.io成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。