CreateStartVmInstanceScheduler

API Request

URLs
POST zstack/v1/vm-instances/{vmUuid}/schedulers/starting
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "schedulerName": "create-vm-scheduler",
    "schedulerDescription": "for test create vm scheduler",
    "type": "simple",
    "interval": 5.0,
    "repeatCount": 10.0,
    "startTime": 0.0
  },
  "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: cf1274ab34e448cdb7f8aabd8461683e" \
-X POST -d '{"params":{"schedulerName":"create-vm-scheduler","schedulerDescription":\
"for test create vm scheduler","type":"simple","interval":5.0,"repeatCount":10.0,"startTime":0.0}}' \
http://localhost:8080/zstack/v1/vm-instances/0a8a39e89a104282b0ff78446515d7f1/schedulers/starting
Request Parameters
Name Type Location Description Optional Value Starting Version
vmUuid String url The VM instance UUID. 0.6
clusterUuid String body (contained in the params structure) Optional. The cluster UUID. 0.6
hostUuid String body (contained in the params structure) Optional. The host UUID. 0.6
schedulerName String body (contained in the params structure) The scheduler name. 1.6
schedulerDescription String body (contained in the params structure) Optional. The scheduler description. 1.6
type String body (contained in the params structure) The scheduler type, including: simple and cron.
  • simple
  • cron
1.6
interval Integer body (contained in the params structure) Optional. The scheduler interval. Unit: second. 1.6
repeatCount Integer body (contained in the params structure) Optional. The scheduler repeat count. This parameter is applied to only schedulers of the simple type. 1.6
startTime Long body (contained in the params structure) Optional. The scheduler start time, which must conform to the Unix timestamp format. If set to 0, the scheduler starts immediately. 1.6
cron String body (contained in the params structure) Optional. The Cron expression, which must conform to the Java Quartz Cron format. 1.6
resourceUuid String body (contained in the params structure) Optional. The UUID that is used to create a scheduler. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
  "inventory": {
    "uuid": "3e27a74894fb47b5a3c86c2b44409ccb",
    "targetResourceUuid": "d596e0adcb2b49a8a9efd132f0e43a73",
    "schedulerName": "Test",
    "schedulerType": "simple",
    "repeatCount": 10.0,
    "startTime": "Apr 24, 2017 7:11:02 PM",
    "createDate": "Apr 24, 2017 7:11:02 PM",
    "lastOpDate": "Apr 24, 2017 7:11:02 PM",
    "jobClassName": "CreateVolumeSnapshotJob",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 1.6
inventory SchedulerInventory See inventory. 1.6
#error
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
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
targetResourceUuid String 0.6
schedulerName String 0.6
schedulerJob String 0.6
schedulerType String 0.6
schedulerInterval Integer 0.6
repeatCount Integer 0.6
cronScheduler String 0.6
startTime Timestamp 0.6
stopTime Timestamp 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
state String 0.6

SDK Sample

Java SDK
CreateStartVmInstanceSchedulerAction action = new CreateStartVmInstanceSchedulerAction();
action.vmUuid = "7d86597d42eb4e31b2497a06361f710b";
action.schedulerName = "create-vm-scheduler";
action.schedulerDescription = "for test create vm scheduler";
action.type = "simple";
action.interval = 5.0;
action.repeatCount = 10.0;
action.startTime = 0.0;
action.sessionId = "a5e890d5bd78487f979861dee02aaafe";
CreateStartVmInstanceSchedulerAction.Result res = action.call();
Python SDK
CreateStartVmInstanceSchedulerAction action = CreateStartVmInstanceSchedulerAction()
action.vmUuid = "26799d709f7e4794b33fb07cfd269373"
action.schedulerName = "create-vm-scheduler"
action.schedulerDescription = "for test create vm scheduler"
action.type = "simple"
action.interval = 5.0
action.repeatCount = 10.0
action.startTime = 0.0
action.sessionId = "d5fcddc65c454f6f85625f954d9507e5"
CreateStartVmInstanceSchedulerAction.Result res = action.call()