Tag Management APIs
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 example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceType | String | body (contained in the params structure) | When creating a tag, the user must specify the resource type associated with the tag. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. | 0.6 | |
| tag | String | body (contained in the params structure) | Tag string | 0.6 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | User tags | 0.6 |
Note:
- ZStack ZSphere supports configuring whether to automatically release physical PCI devices allocated from device specifications when a VM is stopped. This can also be deleted or changed for existing VMs. The SystemTags option autoReleaseSpecReleatedPhysicalPciDevice is added.
- Option format:
autoReleaseSpecReleatedPhysicalPciDevice - Example:
autoReleaseSpecReleatedPhysicalPciDevice
- Option format:
- ZStack ZSphere supports configuring whether to automatically release virtual PCI devices allocated from device specifications when a VM is stopped. This can also be deleted or changed for existing VMs. The SystemTags option autoReleaseSpecReleatedVirtualPciDevice is added.
- Option format:
autoReleaseSpecReleatedVirtualPciDevice - Example:
autoReleaseSpecReleatedVirtualPciDevice
- Option format:
- ZStack ZSphere supports setting cross-cluster HA policies for VMs when creating system tags. The SystemTags option resourceBindings is added.
- Option format:
resourceBindings::Cluster:clusterUuid, where clusterUuid is the UUID of the corresponding cluster. - Example:
resourceBindings::Cluster:2sdasf231jvznsdak
- Option format:
- ZStack ZSphere supports adding custom parameters to the boot.ipxe file when creating system tags. The SystemTags option extraBootParams is added.
- Option format:
extraBootParams::{custom parameters} - Example:
extraBootParams::{acpi=noirq noapic}
- Option 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 |
|---|---|---|---|
| ode | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001. | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null. | 0.6 |
| cause | ErrorCode | The root error. The source error that caused the current error. If there is no root error, this field is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inherent | Boolean | Internal system tag | 0.6 |
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 0.6 |
| resourceUuid | String | User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. | 0.6 |
| resourceType | String | When creating a tag, the user must specify the resource type associated with the tag. | 0.6 |
| tag | String | Tag string | 0.6 |
| type | String | Reserved field. Do not use. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
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
Run the CLI command line tool, type QuerySystemTag and press the Tab key to view all queryable fields and cross-table queryable resource names.
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 failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventories | List | For details, see inventories | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001. | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null. | 0.6 |
| cause | ErrorCode | The root error. The source error that caused the current error. If there is no root error, this field is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inherent | Boolean | Internal system tag | 0.6 |
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 0.6 |
| resourceUuid | String | User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. | 0.6 |
| resourceType | String | When creating a tag, the user must specify the resource type associated with the tag. | 0.6 |
| tag | String | Tag string | 0.6 |
| type | String | Reserved field. Do not use. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
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 example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 0.6 | |
| tag | String | body (contained in the updateSystemTag structure) | Tag string | 0.6 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | 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 number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001. | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null. | 0.6 |
| cause | ErrorCode | The root error. The source error that caused the current error. If there is no root error, this field is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inherent | Boolean | Internal system tag | 0.6 |
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 0.6 |
| resourceUuid | String | User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. | 0.6 |
| resourceType | String | When creating a tag, the user must specify the resource type associated with the tag. | 0.6 |
| tag | String | Tag string | 0.6 |
| type | String | Reserved field. Do not use. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
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 example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceType | String | body (contained in the params structure) | When creating a tag, the user must specify the resource type associated with the tag. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. | 0.6 | |
| tag | String | body (contained in the params structure) | Tag string | 0.6 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | 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 number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001. | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null. | 0.6 |
| cause | ErrorCode | The root error. The source error that caused the current error. If there is no root error, this field is null. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 0.6 |
| resourceUuid | String | User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. | 0.6 |
| resourceType | String | When creating a tag, the user must specify the resource type associated with the tag. | 0.6 |
| tag | String | Tag string | 0.6 |
| type | String | Reserved field. Do not use. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
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
Run the CLI tool, enter QueryUserTag and press the Tab key to view all queryable fields and cross-table queryable resource names.
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 | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventories | List | For details, see inventories | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | The detailed error information | 0.6 |
| elaboration | String | Reserved field. Defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 0.6 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, uniquely identifying this resource | 0.6 |
| resourceUuid | String | User-specified resource UUID. If specified, the system will not randomly assign a UUID to this resource | 0.6 |
| resourceType | String | When creating a tag, the user must specify the resource type associated with the tag | 0.6 |
| tag | String | Tag string | 0.6 |
| type | String | Reserved field. Do not use it | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
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
Can be used to delete system tags (SystemTag), user tags (UserTag), and resource tags (Tag).
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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID, uniquely identifying this resource | 0.6 | |
| deleteMode (optional) | String | body | Deletion mode (Permissive or Enforcing, defaults to Permissive) | 0.6 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | User tags | 0.6 |
Note:
- ZStack ZSphere supports configuring whether to automatically unload physical PCI devices allocated from device specifications when a tag is deleted and the VM is shut down. For existing VMs, you can also delete or change the configuration. SystemTags adds the autoReleaseSpecReleatedPhysicalPciDevice option.
- Option format:
autoReleaseSpecReleatedPhysicalPciDevice - For example:
autoReleaseSpecReleatedPhysicalPciDevice
- Option format:
- ZStack ZSphere supports configuring whether to automatically unload virtual PCI devices allocated from device specifications when a tag is deleted and the VM is shut down. For existing VMs, you can also delete or change the configuration. SystemTags adds the autoReleaseSpecReleatedVirtualPciDevice option.
- Option format:
autoReleaseSpecReleatedVirtualPciDevice - For example:
autoReleaseSpecReleatedVirtualPciDevice
- Option format:
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
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 above example, the systemTags and userTags fields can be omitted. They are listed to show that these two fields can be included in the body.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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | Resource name | 3.2.0 | |
| value | String | body (contained in the params structure) | Tag value | 3.2.0 | |
| description (optional) | String | body (contained in the params structure) | Detailed description of the resource | 3.2.0 | |
| color (optional) | String | body (contained in the params structure) | Tag color | 3.2.0 | |
| type (optional) | String | body (contained in the params structure) | Tag type |
|
3.2.0 |
| resourceUuid (optional) | String | body (contained in the params structure) | Optional. The resource UUID. | 3.2.0 | |
| systemTags (optional) | List | body | Optional. The system tags. | 3.2.0 | |
| userTags (optional) | List | body | Optional. The user tags. | 3.2.0 |
API Response
{}. On error, the returned JSON structure contains 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 Examples
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
Run the CLI tool, enter QueryTag and press the Tab key to view all queryable fields and cross-table queryable resource names.
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 | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 3.2.0 |
| inventories | List | For details, see inventories | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 3.2.0 |
| description | String | A brief description of the error | 3.2.0 |
| details | String | The detailed error information | 3.2.0 |
| elaboration | String | Reserved field. Defaults to null | 3.2.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 3.2.0 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, uniquely identifying this resource | 3.2.0 |
| name | String | Resource name | 3.2.0 |
| value | String | The field value. | 3.2.0 |
| description | String | Detailed description of the resource | 3.2.0 |
| color | String | The color. | 3.2.0 |
| createDate | Timestamp | Creation time | 3.2.0 |
| lastOpDate | Timestamp | Last modification time | 3.2.0 |
| type | TagPatternType | For details, see type | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 3.2.0 |
| ordinal | int | The ordinal number. | 3.2.0 |
SDK Examples
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 above example, the systemTags and userTags fields can be omitted. They are listed to show that these two fields can be included in the body.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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID, uniquely identifying this resource | 3.2.0 | |
| name (optional) | String | body (contained in the updateTag structure) | Resource name | 3.2.0 | |
| value (optional) | String | body (contained in the updateTag structure) | Tag value | 3.2.0 | |
| description (optional) | String | body (contained in the updateTag structure) | Detailed description of the resource | 3.2.0 | |
| color (optional) | String | body (contained in the updateTag structure) | Tag color | 3.2.0 | |
| systemTags (optional) | List | body | Optional. The system tags. | 3.2.0 | |
| userTags (optional) | List | body | Optional. The user tags. | 3.2.0 |
API Response
{}. On error, the returned JSON structure contains 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 Examples
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 above example, the systemTags and userTags fields can be omitted. They are listed to show that these two fields can be included in the body.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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| tagUuid | String | url | Tag UUID | 3.2.0 | |
| resourceUuids | List | body (contained in the params structure) | Resource UUID | 3.2.0 | |
| tokens (optional) | Map | body (contained in the params structure) | Keys and values stored through the tag | 3.2.0 | |
| systemTags (optional) | List | body | Optional. The system tags. | 3.2.0 | |
| userTags (optional) | List | body | Optional. The user tags. | 3.2.0 |
API Response
Note:
After a successful API call, success is returned as true. The number of successfully cloned VMs is returned by numberOfClonedVm. In actual operations, due to resource constraints, partial success and partial failure may occur. The clone failure reason for each VM is stored in the error field in 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 | Whether the operation succeeded. | 3.2.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 3.2.0 |
| results | List | For details, see results | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 3.2.0 |
| description | String | A brief description of the error | 3.2.0 |
| details | String | The detailed error information | 3.2.0 |
| elaboration | String | Reserved field. Defaults to null | 3.2.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 3.2.0 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 3.2.0 |
| description | String | A brief description of the error | 3.2.0 |
| details | String | The detailed error information | 3.2.0 |
| elaboration | String | Reserved field. Defaults to null | 3.2.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 3.2.0 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tagPatternUuid | String | The tag pattern UUID. | 3.2.0 |
| uuid | String | The resource UUID, uniquely identifying this resource | 3.2.0 |
| resourceUuid | String | The resource UUID. | 3.2.0 |
| resourceType | String | The resource type. | 3.2.0 |
| tag | String | The tag. | 3.2.0 |
| type | String | The resource type. | 3.2.0 |
| createDate | Timestamp | Creation time | 3.2.0 |
| lastOpDate | Timestamp | Last modification time | 3.2.0 |
| tagPattern | TagPatternInventory | For details, see tagPattern | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, uniquely identifying this resource | 3.2.0 |
| name | String | Resource name | 3.2.0 |
| value | String | The field value. | 3.2.0 |
| description | String | Detailed description of the resource | 3.2.0 |
| color | String | The color. | 3.2.0 |
| createDate | Timestamp | Creation time | 3.2.0 |
| lastOpDate | Timestamp | Last modification time | 3.2.0 |
| type | TagPatternType | For details, see type | 3.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 3.2.0 |
| ordinal | int | The ordinal number. | 3.2.0 |
SDK Examples
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 | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| tagUuid | String | url | Tag UUID | 3.2.0 | |
| resourceUuids | List | url | Resource UUID | 3.2.0 | |
| systemTags (optional) | List | body | Optional. The system tags. | 3.2.0 | |
| userTags (optional) | List | body | Optional. The user tags. | 3.2.0 |
API Response
{}. On error, the returned JSON structure contains 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 Examples
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()