Skip to main content
Resource Center/CloudFormation Operations
POSTCloudFormation OperationsSince 2.5.0SynchronousAuth Required

CreateResourceStack

CreateResourceStack

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • paramsObjectRequired

    Request body parameter object.

    • nameStringRequired

      The resource name.

    • descriptionString

      Optional. The detailed description of the resource.

    • typeString

      Optional. The stack type. Default type: zstack.

    • rollbackBoolean

      Optional. Whether to roll back if stack creation fails. By default, rollback is performed on failure.

    • templateContentString

      Optional. The stack content, which is a JSON string.Note: Make sure that at least one of templateContent and templateUuid is not null.

    • templateUuidString

      Optional. The template UUID.Note: Make sure that at least one of templateContent and templateUuid is not null.

    • parametersStringRequired

      The parameters in the stack. The parameters are JSON strings.

    • resourceUuidString

      Optional. The resource UUID.

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryResourceStackInventoryRequired

    See inventory.

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      The resource name.

    • descriptionStringRequired

      The detailed description of the resource.

    • versionStringRequired

      The stack version.

    • typeStringRequired

      The stack type. Default type: zstack.

    • templateContentStringRequired

      The stack content, which is a JSON string.

    • paramContentStringRequired

      The parameters in the stack. The parameters are JSON strings.

    • statusStringRequired

      The stack status.

    • reasonStringRequired

      The reason for stack creation failure.

    • enableRollbackbooleanRequired

      Whether to roll back if stack creation fails.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

Endpoint

POST/zstack/v1/cloudformation/stack

/zstack/v1/cloudformation/stack

Operation ID

CreateResourceStack

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/cloudformation/stack' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","type":"<type>","rollback":true,"templateContent":"<templateContent>","templateUuid":"<templateUuid>","parameters":"<parameters>","resourceUuid":"<resourceUuid>"},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "d6ad19356c623599a29140e063c18d74", "name": "test", "description": "description", "version": "2018-06-18", "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\", \"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\"} } }}", "paramContent": "{ \"imageUuid\": \"8fcfe758a7eb13118d7344a08ff790a5\", \"instanceOfferingUuid\": \"751f662a32184933aff487f5c6e167a6\", \"l3NetworkUuid\": \"1245de5c2d28454bb63e60575ec611cb\", \"DiskOfferingUuid\": \"ad0b4ea4c747401c92a7c990f7375cf1\", \"PrimaryStorageUuid\": \"06c35e7f42264a74abb5b828367169fe\", \"HostUuid\": \"9b57690de23f449e99c8f0da311e568e\"}", "status": "Created", "enableRollback": true } }

Change History

This API has no change history records yet.

View all change history