跳转到主要内容
计算管理/虚拟机相关接口
POSTVM Related Interfaces起始版本 0.6同步需要认证

创建虚拟机开机的定时任务

创建虚拟机开机的定时任务

调试可用性

在线调试

使用当前认证信息和示例参数提交 Mock 请求。

路径参数

请求参数

路径参数

  • vmUuidString必填

    虚拟机uuid

请求体字段

  • paramsObject必填

    请求体参数结构

    • clusterUuidString

      集群UUID

    • hostUuidString

      主机UUID

    • schedulerNameString必填

      定时任务名称

    • schedulerDescriptionString

      定时任务描述

    • typeString必填

      定时任务类型,simple或者cron

    • intervalInteger

      定时任务间隔,单位秒

    • repeatCountInteger

      定时任务重复次数,仅针对simple类型的定时任务生效

    • startTimeLong

      定时任务启动时间,必须遵循unix timestamp格式,0为从立刻开始

    • cronString

      cron表达式,需遵循Java Quartz组件cron格式标准

    • resourceUuidString

      用户可指定创建Scheduler所使用的uuid

  • systemTagsList

    系统标签

  • userTagsList

    用户标签

响应状态

200 OK

该 API 成功时返回以下响应结构。

  • errorErrorCode必填

    错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error

    • codeString必填

      错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001

    • descriptionString必填

      错误的概要描述

    • detailsString必填

      错误的详细信息

    • elaborationString必填

      保留字段,默认为null

    • opaqueLinkedHashMap必填

      保留字段,默认为null

    • causeErrorCode必填

      根错误,引发当前错误的源错误,若无原错误,该字段为null

  • inventorySchedulerInventory必填

    详情参考inventory

    • uuidString必填

      资源的UUID,唯一标示该资源

    • targetResourceUuidString必填

      目标资源UUID。

    • schedulerNameString必填

      调度器名称。

    • schedulerJobString必填

      调度器任务。

    • schedulerTypeString必填

      调度器类型。

    • schedulerIntervalInteger必填

      调度器周期。

    • repeatCountInteger必填

      重试次数。

    • cronSchedulerString必填

      Cron调度器。

    • startTimeTimestamp必填

      起始时间。

    • stopTimeTimestamp必填

      停止时间。

    • createDateTimestamp必填

      创建时间

    • lastOpDateTimestamp必填

      最后一次修改时间

    • stateString必填

      当前状态。

请求地址

POST/zstack/v1/vm-instances/{vmUuid}/schedulers/starting

/zstack/v1/vm-instances/{vmUuid}/schedulers/starting

操作 ID

CreateStartVmInstanceScheduler

永久链接

请求示例

curl -X POST 'http://{host}/zstack/v1/vm-instances/{vmUuid}/schedulers/starting' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"clusterUuid":"<clusterUuid>","hostUuid":"<hostUuid>","schedulerName":"<schedulerName>","schedulerDescription":"<schedulerDescription>","type":"<type>","interval":1,"repeatCount":1,"startTime":1,"cron":"<cron>","resourceUuid":"<resourceUuid>"},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

响应示例

200
{ "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" } }

变更历史

此 API 暂无变更历史记录。

查看全部变更历史