SetVmDns

API Request

URLs
PUT zstack/v1/vm-instances/{vmInstanceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "setVmDns": {
    "vmNicUuid": "ff06b3f6ce3939d78731832c5ac97000",
    "dnsList": [
      "223.5.5.5"
    ],
    "ipVersion": 4
  },
  "systemTags": [],
  "userTags": []
}
Note: In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmDns":{"vmNicUuid":"ff06b3f6ce3939d78731832c5ac97000","dnsList":["223.5.5.5"],"ipVersion":4}}' \
http://localhost:8080/zstack/v1/vm-instances/ff01ec80fd11327cba7519b66119d900/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
vmInstanceUuid String url Virtual Machine UUID 4.10.10
vmNicUuid (Optional) String body(included in the setVmDns structure) Virtual Machine NIC UUID 4.10.10
dnsList List body(included in the setVmDns structure) DNS List 4.10.10
ipVersion (Optional) Integer body(included in the setVmDns structure) IP Protocol Number
  • 4
  • 6
4.10.10
systemTags (Optional) List body System Tag 4.10.10
userTags (Optional) List body User Tag 4.10.10

API Response

Response Example
{
  "inventories": [
    {
      "vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
      "dns": "223.5.5.5",
      "ipVersion": 4,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 4.10.10
inventories List For details, see inventories 4.10.10
error ErrorCode Error code. If not null, the operation failed. When the operation is successful, this field is null. For details, see error 4.10.10
#inventories
Name Type Description Starting Version
vmInstanceUuid String Virtual Machine UUID 4.10.10
vmNicUuid String Virtual Machine NIC UUID 4.10.10
dns String DNS Address 4.10.10
ipVersion Integer IP Protocol Number 4.10.10
createDate Timestamp Create time 4.10.10
lastOpDate Timestamp Last modification time 4.10.10
#error
Name Type Description Starting Version
code String Error code number, globally unique identifier of the error, for example SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field, default is null 0.6
opaque LinkedHashMap Reserved field, default is null 0.6
cause ErrorCode Root cause: the source error that triggered the current error. If there is no original error, this field is null 0.6

SDK Examples

Java SDK
SetVmDnsAction action = new SetVmDnsAction();
action.vmInstanceUuid = "ff01ec80fd11327cba7519b66119d900";
action.vmNicUuid = "ff06b3f6ce3939d78731832c5ac97000";
action.dnsList = asList("223.5.5.5");
action.ipVersion = 4;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmDnsAction.Result res = action.call();
Python SDK
SetVmDnsAction action = SetVmDnsAction()
action.vmInstanceUuid = "ff01ec80fd11327cba7519b66119d900"
action.vmNicUuid = "ff06b3f6ce3939d78731832c5ac97000"
action.dnsList = [223.5.5.5]
action.ipVersion = 4
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVmDnsAction.Result res = action.call()
API Reference | ZStack ZSphere · ZVF | ZStack Resource Center