Document navigation

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 example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
Curl Example
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
Parameter List
Name Type Location Description Allowed Values Starting Version
vmUuid String url Virtual Machine UUID 0.6
clusterUuid (Optional) String body(contained in the params structure) Cluster UUID 0.6
hostUuid (Optional) String body(contained in the params structure) Host UUID 0.6
schedulerName String body(contained in the params structure) Scheduler name 1.6
schedulerDescription (Optional) String body(contained in the params structure) Scheduler description 1.6
type String body(contained in the params structure) Scheduler type, simple or cron simplecron 1.6
interval (Optional) Integer body(contained in the params structure) Scheduler interval in seconds 1.6
repeatCount (Optional) Integer body(contained in the params structure) Repeat count for the scheduler, only applies to simple type scheduler 1.6
startTime (Optional) Long body(contained in the params structure) Scheduler start time, must follow unix timestamp format, 0 means start immediately 1.6
cron (Optional) String body(contained in the params structure) Cron expression, must follow Java Quartz cron format standard 1.6
resourceUuid (Optional) String body(contained in the params structure) User can specify the UUID used for creating the Scheduler 0.6
systemTags (Optional) List body System Tag 0.6
userTags (Optional) List body User Tag 0.6

API Response

Response Example
{
  "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 Error code. If not null, the operation failed. This field is null when the operation is successful. For details, see error 1.6
inventory SchedulerInventory For details, see inventory 1.6
#error
Name Type Description Starting Version
code String Error code number, a globally unique identifier for 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, defaults to null 0.6
opaque LinkedHashMap Reserved field, defaults to null 0.6
cause ErrorCode Root cause. The source error that caused the current error. If there is no original error, this field is null 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, uniquely identifying the resource 0.6
targetResourceUuid String The target resource UUID. 0.6
schedulerName String The scheduler name. 0.6
schedulerJob String The scheduler job. 0.6
schedulerType String The scheduler type. 0.6
schedulerInterval Integer The scheduler interval. 0.6
repeatCount Integer The number of repeat. 0.6
cronScheduler String The cron scheduler. 0.6
startTime Timestamp The start time. 0.6
stopTime Timestamp The stop time. 0.6
createDate Timestamp Create date 0.6
lastOpDate Timestamp Last update date 0.6
state String The resource state. 0.6

SDK Examples

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()
API Reference | ZStack ZSphere · ZVF | ZStack Resource Center