VM Related Interfaces

Create Resource Group Directory

POST/zstack/v1/create/directory

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "directory",
    "parentUuid": "a76994f58191389da72d093afdad61c7",
    "zoneUuid": "64a7b0eae75d336cb6954c6efedc79dc",
    "type": "default"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"directory","parentUuid":"a76994f58191389da72d093afdad61c7","zoneUuid":"64a7b0eae75d336cb6954c6efedc79dc","type":"default"}}' http://localhost:8080/zstack/v1/create/directory

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody(contained in params structure)Resource Name 4.6.0
parentUuid (optional)Stringbody(contained in params structure)Parent Directory UUID 4.6.0
zoneUuidStringbody(contained in params structure)Data Center UUID 4.6.0
typeStringbody(contained in params structure)  4.6.0
resourceUuid (optional)Stringbody(contained in params structure)Resource UUID 4.6.0
tagUuids (optional)Listbody(contained in params structure)Tag UUID List 4.6.0
systemTags (optional)ListbodySystem Tags 4.6.0
userTags (optional)ListbodyUser Tags 4.6.0

API Response

Return Example

{
  "inventory": {
    "uuid": "ac818da023833bcd83728b6374c2a4f0",
    "name": "test",
    "groupName": "admin/first/second",
    "parentUuid": "d6e5792bd4ef374ba99948ae83d3a7c3",
    "rootDirectoryUuid": "cf6a11447d5f38dd95a91cc392105b16",
    "zoneUuid": "3714f0cd0f3233dc96dc5fec67886c29",
    "type": "default"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.6.0
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. For details, see error4.6.0
inventoryVmInstanceInventoryFor details, see inventory4.6.0

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10014.6.0
descriptionStringBrief description of the error4.6.0
detailsStringDetailed error information4.6.0
elaborationStringReserved field, defaults to null4.6.0
opaqueLinkedHashMapReserved field, defaults to null4.6.0
causeErrorCodeRoot cause: the source error that triggered the current error. If there is no original error, this field is null4.6.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, a unique identifier for the resource4.6.0
nameStringResource Name4.6.0
groupNameStringGroup4.6.0
parentUuidStringParent Directory UUID4.6.0
rootDirectoryUuidStringRoot Directory UUID4.6.0
zoneUuidStringData Center UUID4.6.0
typeStringDirectory Type4.6.0
createDateTimestampCreation Time4.6.0
lastOpDateTimestampLast Operation Date4.6.0

SDK Examples

Java SDK

CreateDirectoryAction action = new CreateDirectoryAction();
action.name = "directory";
action.parentUuid = "a76994f58191389da72d093afdad61c7";
action.zoneUuid = "64a7b0eae75d336cb6954c6efedc79dc";
action.type = "default";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDirectoryAction.Result res = action.call();

Python SDK

CreateDirectoryAction action = CreateDirectoryAction()
action.name = "directory"
action.parentUuid = "a76994f58191389da72d093afdad61c7"
action.zoneUuid = "64a7b0eae75d336cb6954c6efedc79dc"
action.type = "default"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateDirectoryAction.Result res = action.call()