AddResourcesToDirectory
API Request
URLs
POST zstack/v1/add/resources/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": {
"resourceUuids": [
"ac852a8d7c8f3e15811e8f647f24d0f7",
"5bde5466936638648574ac73fa0abeb0"
],
"directoryUuid": "1eb4cb0f7ed33305aba79b4af9ac4594"
},
"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":{"resourceUuids":["ac852a8d7c8f3e15811e8f647f24d0f7","5bde5466936638648574ac73fa0abeb0"],"directoryUuid":"1eb4cb0f7ed33305aba79b4af9ac4594"}}' http://localhost:8080/zstack/v1/add/resources/directoryRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| resourceUuids | List | body (contained in the params structure) | The resource UUID. | 4.6.0 | |
| directoryUuid | String | body (contained in the params structure) | The directory UUID. | 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
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes an error field. For
example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
Java
SDK
AddResourcesToDirectoryAction action = new AddResourcesToDirectoryAction();
action.resourceUuids = asList("ac852a8d7c8f3e15811e8f647f24d0f7","5bde5466936638648574ac73fa0abeb0");
action.directoryUuid = "1eb4cb0f7ed33305aba79b4af9ac4594";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddResourcesToDirectoryAction.Result res = action.call();Python
SDK
AddResourcesToDirectoryAction action = AddResourcesToDirectoryAction()
action.resourceUuids = [ac852a8d7c8f3e15811e8f647f24d0f7, 5bde5466936638648574ac73fa0abeb0]
action.directoryUuid = "1eb4cb0f7ed33305aba79b4af9ac4594"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddResourcesToDirectoryAction.Result res = action.call()