Tag Operations
CreateSystemTag
API Request
POST zstack/v1/system-tagsAuthorization: OAuth the-session-uuid{
"params": {
"resourceType": "HostVO",
"resourceUuid": "c31d63c6d40d489e87fa7e1ee5707d47",
"tag": "reservedMemory::1G"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceType":"HostVO","resourceUuid":"47609e353c6f331f93ac114d06379f8d","tag":"reservedMemory::1G"}}' \
http://localhost:8080/zstack/v1/system-tags| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| resourceType | String | body (contained in the params structure) | The resource type, which must be specified when you create a tag. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | The resource UUID. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 | |
| tag | String | body (contained in the params structure) | The tag string. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
Note:
- When you create a system tag in ZStack Cloud, you can specify whether to automatically
uninstall the physical PCI device allocated from the device
specifications when the VM instance is shut down. You can also delete or
change the configurations of existing VM instances. Note that you can
add the autoReleaseSpecReleatedPhysicalPciDevice option to
SystemTags.
- Format of the autoReleaseSpecReleatedPhysicalPciDevice
option:
autoReleaseSpecReleatedPhysicalPciDevice - Example:
autoReleaseSpecReleatedPhysicalPciDevice
- Format of the autoReleaseSpecReleatedPhysicalPciDevice
option:
- When you create a system tag in ZStack Cloud, you
can specify whether to automatically uninstall the virtual PCI device
allocated from the device specifications when the VM instance is shut
down. You can also delete or change the configurations of existing VM
instances. Note that you can add the
autoReleaseSpecReleatedVirtualPciDevice option to
SystemTags.
- Format of the autoReleaseSpecReleatedVirtualPciDevice
option:
autoReleaseSpecReleatedVirtualPciDevice - Example:
autoReleaseSpecReleatedVirtualPciDevice
- Format of the autoReleaseSpecReleatedVirtualPciDevice
option:
- You create system tags in ZStack Cloud to
identify VM instances or VPC vRouters for which high availability policy
is enabled or disabled. You can specify the resourceBindings
option when you create SystemTags.
- Format:
resourceBindings::Cluster:clusterUuid - Example:
resourceBindings::Cluster:2sdasf231jvznsdak
- Format:
- You create system tags in ZStack Cloud to
identify and filter the images of HA load balancers or VPC vRouters. You
can specify the applianceType option when you create
SystemTags.
- Format:
applianceType::type - Example:
applianceType::slb
- Format:
- You create system tags in ZStack Cloud to
identify HA load balancers. You can specify the SlbGroupUuid
option when you create SystemTags.
- Format:
SlbGroupUuid::uuid - Example:
SlbGroupUuid::12345678
- Format:
- When you add a system tag on ZStack Cloud, you
can specify a custom parameter to the boot.ipxe file by adding
extraBootParams to the SystemTags option.
- Format:
extraBootParams::{custom parameter} - Example:
extraBootParams::{acpi=noirq noapic}
- Format:
API Response
{
"inventory": {
"inherent": false,
"uuid": "55d86810cb564ecc934fa79d498b9dc3",
"resourceType": "HostVO",
"tag": "reservedMemory::1G",
"type": "System",
"createDate": "Apr 24, 2017 7:10:55 PM",
"lastOpDate": "Apr 24, 2017 7:10:55 PM"
}
}| 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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inherent | Boolean | The inherent system tag. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| resourceUuid | String | The resource UUID. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 |
| resourceType | String | The resource type, which must be specified when you create a tag. | 0.6 |
| tag | String | The tag string. | 0.6 |
| type | String | The reserved field for internal use. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
CreateSystemTagAction action = new CreateSystemTagAction();
action.resourceType = "HostVO";
action.resourceUuid = "c63dfecc5c3f4f24bdab3eda92036eef";
action.tag = "reservedMemory::1G";
action.sessionId = "494209d421304d1cb9b8aaab7cac3a45";
CreateSystemTagAction.Result res = action.call();CreateSystemTagAction action = CreateSystemTagAction()
action.resourceType = "HostVO"
action.resourceUuid = "d8f0bf84c4bc41c99ff7129a369515c1"
action.tag = "reservedMemory::1G"
action.sessionId = "f84ee562742b4aaab791842d71f5d472"
CreateSystemTagAction.Result res = action.call()QuerySystemTag
API Request
GET zstack/v1/system-tags
GET zstack/v1/system-tags/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 67bf58bea6854e568556b0e9f4bc84f6" \
-X GET http://localhost:8080/zstack/v1/system-tags?q=inherent=true&q=resourceType=HostVOcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c798e7031aaa430386636f9ff8d6bb17" \
-X GET http://localhost:8080/zstack/v1/system-tags/7c8162efed2840c08a43e0afdcebf01bQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QuerySystemTag, and pressing the Tab key.
API Response
{
"inventories": [
{
"inherent": false,
"uuid": "0bba7cb618314646aea4e70b9be3bfea",
"resourceType": "HostVO",
"tag": "reservedMemory::1G",
"type": "System",
"createDate": "May 11, 2017 1:22:40 PM",
"lastOpDate": "May 11, 2017 1:22:40 PM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventories | List | See inventories. | 0.6 |
| 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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inherent | Boolean | The inherent system tag. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| resourceUuid | String | The resource UUID. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 |
| resourceType | String | The resource type, which must be specified when you create a tag. | 0.6 |
| tag | String | The tag string. | 0.6 |
| type | String | The reserved field for internal use. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
QuerySystemTagAction action = new QuerySystemTagAction();
action.conditions = asList("inherent=true","resourceType=HostVO");
action.sessionId = "05c74fc02e574e678a407f0ccef8ae5f";
QuerySystemTagAction.Result res = action.call();QuerySystemTagAction action = QuerySystemTagAction()
action.conditions = ["inherent=true","resourceType=HostVO"]
action.sessionId = "a1d2f95577514d0a918ce1502dc27e33"
QuerySystemTagAction.Result res = action.call()UpdateSystemTag
API Request
PUT zstack/v1/system-tags/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateSystemTag": {
"tag": "for-large-DB"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSystemTag":{"tag":"for-large-DB"}}' \
http://localhost:8080/zstack/v1/system-tags/2cb4ac52794535c3ae61f9612c1579e7/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| tag | String | body (contained in the updateSystemTag structure) | The tag string. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
{
"inventory": {
"inherent": false,
"uuid": "c17377dfd0794521a4fe02b6eb16cc5a",
"resourceType": "HostVO",
"tag": "reservedMemory::1G",
"type": "System",
"createDate": "May 11, 2017 1:22:30 PM",
"lastOpDate": "May 11, 2017 1:22:30 PM"
}
}| 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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inherent | Boolean | The inherent system tag. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| resourceUuid | String | The resource UUID. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 |
| resourceType | String | The resource type, which must be specified when you create a tag. | 0.6 |
| tag | String | The tag string. | 0.6 |
| type | String | The reserved field for internal use. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
UpdateSystemTagAction action = new UpdateSystemTagAction();
action.uuid = "1ba32bc1af0446b29bd969029a6052a5";
action.tag = "for-large-DB";
action.sessionId = "367f6162107a47d58c471c9164139fab";
UpdateSystemTagAction.Result res = action.call();UpdateSystemTagAction action = UpdateSystemTagAction()
action.uuid = "be98b2f4e342485486cfa612eeabcaa5"
action.tag = "for-large-DB"
action.sessionId = "6b7af956a9a9477eba02753417380070"
UpdateSystemTagAction.Result res = action.call()CreateUserTag
API Request
POST zstack/v1/user-tagsAuthorization: OAuth the-session-uuid{
"params": {
"resourceType": "DiskOfferingVO",
"resourceUuid": "beff527f6ccb45c8b215c59434b2fa5c",
"tag": "for-large-DB"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceType":"DiskOfferingVO","resourceUuid":"0a93a8d099a9339bb21b6e14a4ca3eea","tag":"for-large-DB"}}' \
http://localhost:8080/zstack/v1/user-tags| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| resourceType | String | body (contained in the params structure) | The resource type, which must be specified when you create a tag. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | The resource UUID. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 | |
| tag | String | body (contained in the params structure) | The tag string. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
{
"inventory": {
"uuid": "b97c64cbf0524f809c05bf9eaf262b79",
"resourceType": "DiskOfferingVO",
"tag": "for-large-DB",
"type": "User",
"createDate": "May 11, 2017 1:22:33 PM",
"lastOpDate": "May 11, 2017 1:22:33 PM"
}
}| 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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| resourceUuid | String | The resource UUID. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 |
| resourceType | String | The resource type, which must be specified when you create a tag. | 0.6 |
| tag | String | The tag string. | 0.6 |
| type | String | The reserved field for internal use. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
CreateUserTagAction action = new CreateUserTagAction();
action.resourceType = "DiskOfferingVO";
action.resourceUuid = "824246fa21d8405fbd48ea1cc7dbf049";
action.tag = "for-large-DB";
action.sessionId = "5d9cde1f7e6a43f586ec78dedf743201";
CreateUserTagAction.Result res = action.call();CreateUserTagAction action = CreateUserTagAction()
action.resourceType = "DiskOfferingVO"
action.resourceUuid = "11f5e230f43d49e69815c35fbd39bad5"
action.tag = "for-large-DB"
action.sessionId = "6301b756253c4103adbf8c891d858e5f"
CreateUserTagAction.Result res = action.call()QueryUserTag
API Request
URLs
GET zstack/v1/user-tags
GET zstack/v1/user-tags/{uuid}
Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/user-tags?q=resourceType=DiskOfferingVO&q=tag=for-large-DBcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/user-tags/e2a3aa3463dd382fb9e434304167f331
Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryUserTag, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "ae4f2dd05a513e1e8d350d448c2071a9",
"resourceType": "DiskOfferingVO",
"tag": "for-large-DB",
"type": "User",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventories | List | See inventories. | 0.6 |
| 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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| resourceUuid | String | The UUID of the associated resource. If specified, the system will not allocate randomly a UUID to the resource. | 0.6 |
| resourceType | String | The resource type, which must be specified when you create a tag. | 0.6 |
| tag | String | The tag string. | 0.6 |
| type | String | The reserved field for internal use. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
QueryUserTagAction action = new QueryUserTagAction();
action.conditions = asList("resourceType=DiskOfferingVO","tag=for-large-DB");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryUserTagAction.Result res = action.call();QueryUserTagAction action = QueryUserTagAction()
action.conditions = ["resourceType=DiskOfferingVO","tag=for-large-DB"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryUserTagAction.Result res = action.call()DeleteTag
API Request
DELETE zstack/v1/tags/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 7a2a51da1758430382624e00144e70c5" \
-X DELETE http://localhost:8080/zstack/v1/tags/1d33d909355247508cdbf9a0c0037dbe?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource name. | 0.6 | |
| deleteMode | String | body | Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
Note:
- When you delete a tag in ZStack Cloud, you can specify whether to automatically
uninstall the physical PCI device allocated from the device
specifications when the VM instance is shut down. You can also delete or
change the configurations of existing VM instances. Note that you can
add the autoReleaseSpecReleatedPhysicalPciDevice option to
SystemTags.
- Format of the autoReleaseSpecReleatedPhysicalPciDevice
option:
autoReleaseSpecReleatedPhysicalPciDevice - Example:
autoReleaseSpecReleatedPhysicalPciDevice
- Format of the autoReleaseSpecReleatedPhysicalPciDevice
option:
- When you delete a tag in ZStack Cloud, you can
specify whether to automatically uninstall the virtual PCI device
allocated from the device specifications when the VM instance is shut
down. You can also delete or change the configurations of existing VM
instances. Note that you can add the
autoReleaseSpecReleatedVirtualPciDevice option to
SystemTags.
- Format of the autoReleaseSpecReleatedVirtualPciDevice
option:
autoReleaseSpecReleatedVirtualPciDevice - Example:
autoReleaseSpecReleatedVirtualPciDevice
- Format of the autoReleaseSpecReleatedVirtualPciDevice
option:
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteTagAction action = new DeleteTagAction();
action.uuid = "8262e178c23140f6a4de6f0d9e6a0913";
action.deleteMode = "Permissive";
action.sessionId = "94c2bff91f834a96b691a36e47888967";
DeleteTagAction.Result res = action.call();DeleteTagAction action = DeleteTagAction()
action.uuid = "86a3f5e633dd40358cab072951058ec9"
action.deleteMode = "Permissive"
action.sessionId = "87c504af0b5a484d87a5ad4ddac57baa"
DeleteTagAction.Result res = action.call()CreateTag
API Request
POST zstack/v1/tagsAuthorization: OAuth the-session-uuid{
"params": {
"name": "new-tag",
"value": "new-tag",
"description": "tag-for-volume",
"color": "#FFFFFF",
"type": "simple"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"new-tag","value":"new-tag","description":"tag-for-volume","color":"#FFFFFF","type":"simple"}}' http://localhost:8080/zstack/v1/tags| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 3.2.0 | |
| value | String | body (contained in the params structure) | The tag value. | 3.2.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.2.0 | |
| color | String | body (contained in the params structure) | Optional. The tag color. | 3.2.0 | |
| type | String | body (contained in the params structure) | Optional. The tag type. |
|
3.2.0 |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.2.0 | |
| systemTags | List | body | Optional. | 3.2.0 | |
| userTags | List | body | Optional. | 3.2.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
CreateTagAction action = new CreateTagAction();
action.name = "new-tag";
action.value = "new-tag";
action.description = "tag-for-volume";
action.color = "#FFFFFF";
action.type = "simple";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateTagAction.Result res = action.call();CreateTagAction action = new CreateTagAction();
action.name = "new-tag";
action.value = "new-tag";
action.description = "tag-for-volume";
action.color = "#FFFFFF";
action.type = "simple";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateTagAction.Result res = action.call();QueryTag
API Request
GET zstack/v1/tagsGET zstack/v1/tags/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/tagscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/tags/6f81ada534e3363f9e8a00caa2f48564Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryTag, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "f7ac675964d0386b89d8df713f68aee0",
"name": "SSD",
"value": "SSD",
"description": "SSD volume",
"color": "#FFFFFF",
"type": "simple",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.2.0 |
| inventories | List | See inventories. | 3.2.0 |
| 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. | 3.2.0 |
| description | String | The brief description of the error. | 3.2.0 |
| details | String | The details about the error. | 3.2.0 |
| elaboration | String | The reserved field. Default value: null. | 3.2.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.2.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. | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.2.0 |
| name | String | The resource name. | 3.2.0 |
| value | String | 3.2.0 | |
| description | String | The detailed description of the resource. | 3.2.0 |
| color | String | 3.2.0 | |
| createDate | Timestamp | The creation date. | 3.2.0 |
| lastOpDate | Timestamp | The last operation date. | 3.2.0 |
| type | TagPatternType | See type. | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 3.2.0 |
| ordinal | int | 3.2.0 |
SDK Sample
QueryTagAction action = new QueryTagAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryTagAction.Result res = action.call();QueryTagAction action = QueryTagAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryTagAction.Result res = action.call()UpdateTag
API Request
PUT zstack/v1/tags/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateTag": {
"value": "new-tag",
"description": "tag-for-volume",
"color": "#FFFFFF"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateTag":{"value":"new-tag","description":"tag-for-volume","color":"#FFFFFF"}}' http://localhost:8080/zstack/v1/tags/bc54e798f6ad4b9aa6a71365271d9464/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.2.0 | |
| name | String | body (contained in the updateTag structure) | Optional. The resource name. | 3.2.0 | |
| value | String | body (contained in the updateTag structure) | Optional. The tag value. | 3.2.0 | |
| description | String | body (contained in the updateTag structure) | Optional. The detailed description of the resource. | 3.2.0 | |
| color | String | body (contained in the updateTag structure) | Optional. The tag color. | 3.2.0 | |
| systemTags | List | body | Optional. The system tags. | 3.2.0 | |
| userTags | List | body | Optional. The user tags. | 3.2.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
UpdateTagAction action = new UpdateTagAction();
action.uuid = "a2bdf841dfdd48ecae5cabf44d0088e1";
action.value = "new-tag";
action.description = "tag-for-volume";
action.color = "#FFFFFF";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateTagAction.Result res = action.call();UpdateTagAction action = UpdateTagAction()
action.uuid = "982dddcd308b423baf8f82a74afc4e1c"
action.value = "new-tag"
action.description = "tag-for-volume"
action.color = "#FFFFFF"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateTagAction.Result res = action.call()AttachTagToResources
API Request
POST zstack/v1/tags/{tagUuid}/resourcesAuthorization: OAuth the-session-uuid{
"params": {
"resourceUuids": [
"bcd0e0f674aa47298dcbdc0efeffb55d"
]
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceUuids":["80ed93103b624518ab0e642c6611bc0f"]}}' http://localhost:8080/zstack/v1/tags/05811acb63e34f4c9c62b19a8eb4090b/resources| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| tagUuid | String | url | The tag UUID. | 3.2.0 | |
| resourceUuids | List | body (contained in the params structure) | The resource UUID list. | 3.2.0 | |
| tokens | Map | body (contained in the params structure) | Optional. The key and the value stored by the tag. | 3.2.0 | |
| systemTags | List | body | Optional. The system tags. | 3.2.0 | |
| userTags | List | body | Optional. The user tags. | 3.2.0 |
API Response
Note:
After the API call succeeded, the success is returned as true. The number of successfully cloned VM instances can be returned by numberOfClonedVm. Actually, due to resource limitations, a portion of VM instances are cloned successfully, while another portion of VM instances fail to be cloned. The reason for each cloning failure is stored in the error field of inventories.
{
"results": [
{
"inventory": {
"tagPatternUuid": "f9060711c8453a2580f840d7aa1c5485",
"uuid": "b2f817b3400232018956a4d2d198edc4",
"resourceType": "DiskOfferingVO",
"tag": "for-large-DB",
"type": "User",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
},
"success": true
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 3.2.0 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.2.0 |
| results | List | See results. | 3.2.0 |
| 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. | 3.2.0 |
| description | String | The brief description of the error. | 3.2.0 |
| details | String | The details about the error. | 3.2.0 |
| elaboration | String | The reserved field. Default value: null. | 3.2.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.2.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. | 3.2.0 |
| 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. | 3.2.0 |
| description | String | The brief description of the error. | 3.2.0 |
| details | String | The details about the error. | 3.2.0 |
| elaboration | String | The reserved field. Default value: null. | 3.2.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.2.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. | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tagPatternUuid | String | 3.2.0 | |
| uuid | String | The resource UUID. | 3.2.0 |
| resourceUuid | String | 3.2.0 | |
| resourceType | String | 3.2.0 | |
| tag | String | 3.2.0 | |
| type | String | 3.2.0 | |
| createDate | Timestamp | The creation date. | 3.2.0 |
| lastOpDate | Timestamp | The last operation date. | 3.2.0 |
| tagPattern | TagPatternInventory | See tagPattern. | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.2.0 |
| name | String | The resource name. | 3.2.0 |
| value | String | 3.2.0 | |
| description | String | The detailed description of the resource. | 3.2.0 |
| color | String | 3.2.0 | |
| createDate | Timestamp | The creation date. | 3.2.0 |
| lastOpDate | Timestamp | The last operation date. | 3.2.0 |
| type | TagPatternType | See type. | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 3.2.0 |
| ordinal | int | 3.2.0 |
SDK Sample
AttachTagToResourcesAction action = new AttachTagToResourcesAction();
action.tagUuid = "6369948f4523457b87c311c550aa3e16";
action.resourceUuids = asList("ae2fdc6bbd254fcba9c36ac174c87a31");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachTagToResourcesAction.Result res = action.call();AttachTagToResourcesAction action = AttachTagToResourcesAction()
action.tagUuid = "1e9bee8a666340fe86599fa03962af90"
action.resourceUuids = [a4bb584d6c50401c98b7535dca839ba0]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachTagToResourcesAction.Result res = action.call()DetachTagFromResources
API Request
DELETE zstack/v1/tags/{tagUuid}/resources?resourceUuids={resourceUuids}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/tags/a8d23deaee2f4e7f96d11f066a180b92/resources?resourceUuids=44f7b0ec930f458c9f4e7705ad7a0cb9| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| tagUuid | String | url | The tag UUID. | 3.2.0 | |
| resourceUuids | List | url | The resource UUID list. | 3.2.0 | |
| systemTags | List | body | Optional. The system tags. | 3.2.0 | |
| userTags | List | body | Optional. The user tags. | 3.2.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DetachTagFromResourcesAction action = new DetachTagFromResourcesAction();
action.tagUuid = "09f0323668dc47fdac599724f1e6eb26";
action.resourceUuids = asList("170664525bde452db0923d200ac8e57b");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachTagFromResourcesAction.Result res = action.call();DetachTagFromResourcesAction action = DetachTagFromResourcesAction()
action.tagUuid = "ff438628636242909e58eed72696aae8"
action.resourceUuids = [7719cc49d1574d479316d43f77183899]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachTagFromResourcesAction.Result res = action.call()