CreateDirectory
API Request
URLs
POST zstack/v1/create/directoryHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "directory",
"parentUuid": "a76994f58191389da72d093afdad61c7",
"zoneUuid": "64a7b0eae75d336cb6954c6efedc79dc",
"type": "default"
},
"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":"directory","parentUuid":"a76994f58191389da72d093afdad61c7","zoneUuid":"64a7b0eae75d336cb6954c6efedc79dc","type":"default"}}' http://localhost:8080/zstack/v1/create/directoryRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 4.6.0 | |
| parentUuid | String | body (contained in the params structure) | The parent directory UUID. | 4.6.0 | |
| zoneUuid | String | body (contained in the params structure) | The zone UUID. | 4.6.0 | |
| type | String | body (contained in the params structure) | 4.6.0 | ||
| resourceUuid | String | body (contained in the params structure) | The resource UUID. | 4.6.0 | |
| tagUuids | List | body (contained in the params structure) | The tag UUID list. | 4.6.0 | |
| systemTags | List | body | Optional. The system tags. | 4.6.0 | |
| userTags | List | body | Optional. The user tags. | 4.6.0 |
API Response
Sample Response
{
"inventory": {
"uuid": "ac818da023833bcd83728b6374c2a4f0",
"name": "test",
"groupName": "admin/first/second",
"parentUuid": "d6e5792bd4ef374ba99948ae83d3a7c3",
"rootDirectoryUuid": "cf6a11447d5f38dd95a91cc392105b16",
"zoneUuid": "3714f0cd0f3233dc96dc5fec67886c29",
"type": "default"
}
}#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. | 4.6.0 |
| description | String | The brief description of the error. | 4.6.0 |
| details | String | The details about the error. | 4.6.0 |
| elaboration | String | The reserved field. Default value: null. | 4.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.6.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. | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.6.0 |
| name | String | The resource name. | 4.6.0 |
| groupName | String | The name of the group that the directory is affiliated to. | 4.6.0 |
| parentUuid | String | The parent directory UUID. | 4.6.0 |
| rootDirectoryUuid | String | The root directory UUID. | 4.6.0 |
| zoneUuid | String | The zone UUID. | 4.6.0 |
| type | String | The directory type. | 4.6.0 |
| createDate | Timestamp | The creation time. | 4.6.0 |
| lastOpDate | Timestamp | The last update time. | 4.6.0 |
SDK Sample
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()