ChangeVmPassword
API Request
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"changeVmPassword": {
"password": "password",
"account": "root"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeVmPassword":{"password":"password","account":"root"}}' \
http://localhost:8080/zstack/v1/vm-instances/6401e6a584b43fcfaebe401fd07f6f92/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| password | String | body (contained in the changeVmPassword structure) | The password. | 0.6 | |
| account | String | body (contained in the changeVmPassword structure) | The account. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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 Sample
Java
SDK
ChangeVmPasswordAction action = new ChangeVmPasswordAction();
action.uuid = "68bbdbf738884c3486f0fc0faf42c42c";
action.password = "password";
action.account = "root";
action.sessionId = "815834f2143b45c0a16fab615616795a";
ChangeVmPasswordAction.Result res = action.call();Python
SDK
ChangeVmPasswordAction action = ChangeVmPasswordAction()
action.uuid = "39f2732b2c214fe29fb2fa82f748a4f6"
action.password = "password"
action.account = "root"
action.sessionId = "fee2d467d9af4dc5b541a56a736cb457"
ChangeVmPasswordAction.Result res = action.call()