POST zstack/v1/affinity-groups
Authorization: OAuth the-session-uuid
{
"params": {
"name": "vm-affinity-group",
"description": "vm affinity group for test vms",
"policy": "antiSoft",
"type": "host"
},
"systemTags": [],
"userTags": []
}
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"vm-affinity-group","description":"vm affinity group for test vms","policy":"antiSoft","type":"host"}}' \
http://localhost:8080/zstack/v1/affinity-groups
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
name | String | body (contained in the params structure) | The affinity group name. | 2.3 | |
description | String | body (contained in the params structure) | Optional. The detailed description of the affinity group. | 2.3 | |
policy | String | body (contained in the params structure) | The affinity group policy. |
| 2.3 |
type | String | body (contained in the params structure) | Optional. The affinity group type.
|
| 2.3 |
resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 2.3 | |
systemTags | List | body | Optional. The system tags. | 2.3 | |
userTags | List | body | Optional. The user tags. | 2.3 |
{
"inventory": {
"uuid": "05ad02be7c5f4a6a9b6d164cb2980be6",
"name": "affinity-group-test",
"description": "affinity group for test",
"policy": "ANTISOFT",
"version": "1.0",
"type": "HOST"
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.3 |
inventory | AffinityGroupInventory | See inventory. | 2.3 |
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. | 2.3 |
description | String | The brief description of the error. | 2.3 |
details | String | The details about the error. | 2.3 |
elaboration | String | The reserved field. Default value: null. | 2.3 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 2.3 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.3 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.3 |
name | String | The resource name. | 2.3 |
description | String | The detailed description of the resource. | 2.3 |
policy | String | The affinity group policy. | 2.3 |
version | String | The version of the affinity group allocation algorithm. | 2.3 |
type | String | The affinity group type.
| 2.3 |
appliance | String | The affinity group appliance. | 2.3 |
state | String | 2.3 | |
createDate | Timestamp | The creation date. | 2.3 |
lastOpDate | Timestamp | The last operation date. | 2.3 |
usages | List | See usages. | 2.3 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource binding UUID of the affinity group. | 2.3 |
affinityGroupUuid | String | The affinity group UUID. | 2.3 |
resourceUuid | String | The UUID of the resource that joins the affinity group. | 2.3 |
resourceType | String | The type of the resource that joins the affinity group. | 2.3 |
createDate | Timestamp | The creation date. | 2.3 |
lastOpDate | Timestamp | The last operation date. | 2.3 |
CreateAffinityGroupAction action = new CreateAffinityGroupAction();
action.name = "vm-affinity-group";
action.description = "vm affinity group for test vms";
action.policy = "antiSoft";
action.type = "host";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAffinityGroupAction.Result res = action.call();
CreateAffinityGroupAction action = CreateAffinityGroupAction()
action.name = "vm-affinity-group"
action.description = "vm affinity group for test vms"
action.policy = "antiSoft"
action.type = "host"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAffinityGroupAction.Result res = action.call()
DELETE zstack/v1/affinity-groups/{uuid}?deleteMode={deleteMode}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/affinity-groups/ed0b2f029cc53ca385adc19dd36b51be?deleteMode=Permissive
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 2.2 | |
deleteMode | String | url | Optional. The delete mode. | 2.2 | |
systemTags | List | body | Optional. The system tags. | 2.2 | |
userTags | List | body | Optional. The user tags. | 2.2 |
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
DeleteAffinityGroupAction action = new DeleteAffinityGroupAction();
action.uuid = "ed0b2f029cc53ca385adc19dd36b51be";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAffinityGroupAction.Result res = action.call();
DeleteAffinityGroupAction action = DeleteAffinityGroupAction()
action.uuid = "ed0b2f029cc53ca385adc19dd36b51be"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAffinityGroupAction.Result res = action.call()
GET zstack/v1/affinity-groups
GET zstack/v1/affinity-groups/{uuid}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/affinity-groups?q=uuid=656ebc992c3333fea209c6c90e6a76cf
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/affinity-groups/b49759dff8593098a1d106c8129974cf
Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAffinityGroup
, and pressing the Tab key.
{
"inventories": [
{
"uuid": "99fa95af4aac4eaabd320dbdd6d36ef8",
"name": "affinity-group-test",
"description": "affinity group for test",
"policy": "ANTISOFT",
"version": "1.0",
"type": "HOST",
"usages": [
{
"resourceUuid": "acedd8848c874cd7b1c68df7c593f6c1",
"resourceType": "HOST"
}
]
}
]
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.3 |
inventories | List | See inventories. | 2.3 |
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. | 2.3 |
description | String | The brief description of the error. | 2.3 |
details | String | The details about the error. | 2.3 |
elaboration | String | The reserved field. Default value: null. | 2.3 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 2.3 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.3 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.3 |
name | String | The resource name. | 2.3 |
description | String | The detailed description of the resource. | 2.3 |
policy | String | The affinity group policy. | 2.3 |
version | String | The version of the affinity group allocation algorithm. | 2.3 |
type | String | The affinity group type.
| 2.3 |
appliance | String | The affinity group appliance. | 2.3 |
state | String | 2.3 | |
createDate | Timestamp | The creation date. | 2.3 |
lastOpDate | Timestamp | The last operation date. | 2.3 |
usages | List | See usages. | 2.3 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource binding UUID of the affinity group. | 2.3 |
affinityGroupUuid | String | The affinity group UUID. | 2.3 |
resourceUuid | String | The UUID of the resource that joins the affinity group. | 2.3 |
resourceType | String | The type of the resource that joins the affinity group. | 2.3 |
createDate | Timestamp | The creation date. | 2.3 |
lastOpDate | Timestamp | The last operation date. | 2.3 |
QueryAffinityGroupAction action = new QueryAffinityGroupAction();
action.conditions = asList("uuid=bceb37906e673f37bb425933bdf2df46");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAffinityGroupAction.Result res = action.call();
QueryAffinityGroupAction action = QueryAffinityGroupAction()
action.conditions = ["uuid=3714ccec7a933aba94c073fcba6e52bd"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAffinityGroupAction.Result res = action.call()
Email Us
contact@zstack.ioEmail Us
contact@zstack.ioThe download link is sent to your email address.
If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.Thank you for using ZStack products and services.
Submit successfully.
We'll connect soon.Thank you for choosing ZStack products and services.