UpdateVmInstanceMetadata
Update Virtual Machine Instance Metadata
API Request
URLs
PUT zstack/v1/vm-instances/metadata/actions
Headers
Authorization: OAuth the-session-uuid
Body
Note: In the preceding example, the
{
"updateVmInstanceMetadata": {
"vmUuids": [
"9880f2cf55223a069f43c01ac1c05c33"
]
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"updateVmInstanceMetadata":{"vmUuids":["9880f2cf55223a069f43c01ac1c05c33"]}}' http://localhost:8080/zstack/v1/vm-instances/metadata/actions
Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vmUuids | List | body (included in the updateVmInstanceMetadata structure) |
List of virtual machine UUIDs whose metadata needs to be updated | 5.0.0 | |
| systemTags (Optional) | List | body | System tags | 5.0.0 | |
| userTags (Optional) | List | body | User tags | 5.0.0 |
API Response
When the API succeeds, it returns an empty JSON structure{}. If an error occurs, 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
Java SDK
UpdateVmInstanceMetadataAction action = new UpdateVmInstanceMetadataAction();
action.vmUuids = asList("9880f2cf55223a069f43c01ac1c05c33");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVmInstanceMetadataAction.Result res = action.call();
Python SDK
action = UpdateVmInstanceMetadataAction()
action.vmUuids = [9880f2cf55223a069f43c01ac1c05c33]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
