Document navigation

Job Scheduling APIs

CreateSchedulerTrigger

API Request

URLs

POST zstack/v1/scheduler/triggers

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "trigger",
    "description": "description",
    "schedulerInterval": 3600.0,
    "repeatCount": 100.0,
    "startTime": 1.510669257141E12,
    "schedulerType": "simple"
  },
  "systemTags": [],
  "userTags": []
}

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 POST -d '{"params":{"name":"trigger","description":"description","schedulerInterval":3600.0,"repeatCount":100.0,"startTime":1.510669257141E12,"schedulerType":"simple"}}' \
http://localhost:8080/zstack/v1/scheduler/triggers

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 2.1
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.1
schedulerInterval Integer body (contained in the params structure)

Optional. The interval.

  • Set the interval when a simple scheduler job runs more than once.
  • Set the interval when a simple scheduler job repeats indefinitely.
2.1
repeatCount Integer body (contained in the params structure) Optional. The repeat count. 2.1
startTime Long body (contained in the params structure) Optional. The start time in Unix time. 2.1
schedulerType String body (contained in the params structure) The scheduler type: simple or cron. 2.1
cron String body (contained in the params structure) Optional. The cron expression. 2.1
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "20c7355021f83597a4cf7854f5788b74",
    "name": "trigger",
    "description": "this is a scheduler trigger",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventory SchedulerTriggerInventory See inventory 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 2.1
description String Optional. The detailed description of the resource. 2.1
schedulerType String The scheduler type. 2.1
schedulerInterval Integer The scheduler interval. 2.1
repeatCount Integer The repeat count. 2.1
startTime Timestamp The start time. 2.1
stopTime Timestamp The stop time. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
jobsUuid List The scheduler job UUID list. 2.1

SDK Sample

Java SDK

CreateSchedulerTriggerAction action = new CreateSchedulerTriggerAction();
action.name = "trigger";
action.description = "description";
action.schedulerInterval = 3600.0;
action.repeatCount = 100.0;
action.startTime = 1.510669257141E12;
action.schedulerType = "simple";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSchedulerTriggerAction.Result res = action.call();

Python SDK

action = CreateSchedulerTriggerAction()
action.name = "trigger"
action.description = "description"
action.schedulerInterval = 3600.0
action.repeatCount = 100.0
action.startTime = 1.510669257141E12
action.schedulerType = "simple"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteSchedulerTrigger

API Request

URLs

DELETE zstack/v1/scheduler/triggers/{uuid}?deleteMode={deleteMode}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 9101c6e1eef94f2aa7b76ce2833c3991" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/triggers/fe26ab519ac24389bae2664503258590?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
deleteMode String url Optional. The deletion mode. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

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 an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

DeleteSchedulerTriggerAction action = new DeleteSchedulerTriggerAction();
action.uuid = "3ac4a7a8d71f4147b98a59995cbcf807";
action.deleteMode = "Permissive";
action.sessionId = "c0de81361fb743c297aec4f4f35085b9";
DeleteSchedulerTriggerAction.Result res = action.call();

Python SDK

action = DeleteSchedulerTriggerAction()
action.uuid = "769b16c91f234f2c8e2fc4fe6fe8441b"
action.deleteMode = "Permissive"
action.sessionId = "a960f5dfa4304cd1bcb96ed0d16c3e67"
res = action.call()

QuerySchedulerTrigger

API Request

URLs

GET zstack/v1/scheduler/triggers
GET zstack/v1/scheduler/triggers/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth f86c2715690e402c85aec6d981d1d9b1" \
-X GET http://localhost:8080/zstack/v1/scheduler/triggers?q=name=TestSchedulerTrigger&q=name=trigger
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth bb395f07706c4e5f93fb9d767248001e" \
-X GET http://localhost:8080/zstack/v1/scheduler/triggers/245751f5233d4bc3b4a9966e8cdd0e7e

Queryable Fields

Run zstack CLI, enter QuerySchedulerTrigger, and press Tab to view all queryable fields and resources that support cross-table queries.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "8bc53f2626f14f5a974300909e4229f3",
      "name": "test",
      "description": "a test trigger",
      "startTime": "Jul 17, 2017 10:18:54 AM",
      "stopTime": "Jul 17, 2017 10:18:54 AM",
      "createDate": "Jul 17, 2017 10:18:54 AM",
      "lastOpDate": "Jul 17, 2017 10:18:54 AM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventories List See inventories 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String Optional. The detailed description of the resource. 0.6
schedulerType String The scheduler type. 0.6
schedulerInterval Integer The scheduler interval. 0.6
repeatCount Integer The repeat count. 0.6
startTime Timestamp The start time. 0.6
stopTime Timestamp The stop time. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
jobsUuid List The scheduler job UUID list. 0.6

SDK Sample

Java SDK

QuerySchedulerTriggerAction action = new QuerySchedulerTriggerAction();
action.conditions = asList("name=TestSchedulerTrigger","name=trigger");
action.sessionId = "fd4f6b37415e467b847e862e2d003639";
QuerySchedulerTriggerAction.Result res = action.call();

Python SDK

action = QuerySchedulerTriggerAction()
action.conditions = ["name=TestSchedulerTrigger","name=trigger"]
action.sessionId = "d1353798888548bd87fb76a0b431ad3f"
res = action.call()

UpdateSchedulerTrigger

API Request

URLs

PUT zstack/v1/scheduler/triggers/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateSchedulerTrigger": {
    "name": "Test2",
    "description": "new test",
    "schedulerInterval": 3600.0,
    "repeatCount": 100.0,
    "startTime": 1.510669257141E12
  },
  "systemTags": [],
  "userTags": []
}

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 '{"updateSchedulerTrigger":{"name":"Test2","description":"new test","schedulerInterval":3600.0,"repeatCount":100.0,"startTime":1.510669257141E12}}' \
http://localhost:8080/zstack/v1/scheduler/triggers/029825497836308c8ab6146e57015c20/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
name String body (contained in the updateSchedulerTrigger structure) Optional. The resource name. 2.1
description String body (contained in the updateSchedulerTrigger structure) Optional. The detailed description of the resource. 2.1
schedulerInterval Integer body (contained in the updateSchedulerTrigger structure) Optional. The scheduler interval. 2.3
repeatCount Integer body (contained in the updateSchedulerTrigger structure) Optional. The repeat count. 2.3
startTime Long body (contained in the updateSchedulerTrigger structure) Optional. The start time in Unix time. 2.3
cron String body (contained in the updateSchedulerTrigger structure) Optional. The cron expression. 2.3
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

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 an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

UpdateSchedulerTriggerAction action = new UpdateSchedulerTriggerAction();
action.uuid = "2b18c3e0f3f1428e97dbd90badd54211";
action.name = "Test2";
action.description = "new test";
action.schedulerInterval = 3600.0;
action.repeatCount = 100.0;
action.startTime = 1.510669257141E12;
action.sessionId = "f0a41bd750b64bf09ed7122c1b9f4949";
UpdateSchedulerTriggerAction.Result res = action.call();

Python SDK

action = UpdateSchedulerTriggerAction()
action.uuid = "3e077605d62e4075be62cb1218c7762f"
action.name = "Test2"
action.description = "new test"
action.schedulerInterval = 3600.0;
action.repeatCount = 100.0;
action.startTime = 1.510669257141E12;
action.sessionId = "f9133e066bbe4190a8ba5b2acb038669"
res = action.call()

AddSchedulerJobToSchedulerTrigger

API Request

URLs

POST zstack/v1/scheduler/jobs/{schedulerJobUuid}/scheduler/triggers/{schedulerTriggerUuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST http://localhost:8080/zstack/v1/scheduler/jobs/0bae2d859dfa3863bc3e02f20bbce8a5/scheduler/triggers/3653b5151ed032178264edaaf9e8c3d1

Request Parameters

Name Type Location Description Optional Value Starting Version
schedulerJobUuid String url The scheduled job UUID. 2.1
schedulerTriggerUuid String url The UUID of the scheduler trigger. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1
triggerNow boolean body (contained in the params structure) Optional. The flag that specifies whether to trigger the scheduler immediately. 3.2.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "ceb4e1ee7e204505917387f0582f1710",
    "schedulerJobUuid": "7352a98748f548ed974492ac8cc5172a",
    "schedulerTriggerUuid": "21960244adbc427098bb37c31709ffbe"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventory SchedulerJobSchedulerTriggerInventory See inventory 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 2.1
schedulerJobUuid String The scheduler job UUID. 2.1
schedulerTriggerUuid String The scheduler trigger UUID. 2.1
jobGroup String The scheduler job group. 2.1
triggerGroup String The scheduler trigger group. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1

SDK Sample

Java SDK

AddSchedulerJobToSchedulerTriggerAction action = new AddSchedulerJobToSchedulerTriggerAction();
action.schedulerJobUuid = "0bae2d859dfa3863bc3e02f20bbce8a5";
action.schedulerTriggerUuid = "3653b5151ed032178264edaaf9e8c3d1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSchedulerJobToSchedulerTriggerAction.Result res = action.call();

Python SDK

action = AddSchedulerJobToSchedulerTriggerAction()
action.schedulerJobUuid = "0bae2d859dfa3863bc3e02f20bbce8a5"
action.schedulerTriggerUuid = "3653b5151ed032178264edaaf9e8c3d1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

RemoveSchedulerJobFromSchedulerTrigger

API Request

URLs

DELETE zstack/v1/scheduler/jobs/{schedulerJobUuid}/scheduler/triggers/{schedulerTriggerUuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 32b614664dfc4c77a4ced15b7b434f2b" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobs/62af314ef99046f8929934e0e9b41892/scheduler/triggers/fe1c048505c54cb3b27981fc2e967770?

Request Parameters

Name Type Location Description Optional Value Starting Version
schedulerJobUuid String url The scheduled job UUID. 2.1
schedulerTriggerUuid String url The UUID of the scheduler trigger. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

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 an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

RemoveSchedulerJobFromSchedulerTriggerAction action = new RemoveSchedulerJobFromSchedulerTriggerAction();
action.schedulerJobUuid = "9fe2e6e2059c4034b41e8a9422eff40f";
action.schedulerTriggerUuid = "3e8934f791f04ebcaeb4523a10ae020a";
action.sessionId = "2754c780ce3746b88045b11124c7cd71";
RemoveSchedulerJobFromSchedulerTriggerAction.Result res = action.call();

Python SDK

action = RemoveSchedulerJobFromSchedulerTriggerAction()
action.schedulerJobUuid = "18041254de834d398897ae66197db7c1"
action.schedulerTriggerUuid = "a7f89b17034a4714ba3ecda2435aa5a0"
action.sessionId = "7944081646ef439a9e5847380491e998"
res = action.call()

CreateSchedulerJob

API Request

URLs

POST zstack/v1/scheduler/jobs

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "job",
    "description": "description",
    "targetResourceUuid": "cb4c7a39a84b39bc94dd78bf50f682c9",
    "type": "startVm"
  },
  "systemTags": [],
  "userTags": []
}

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 POST -d '{"params":{"name":"job","description":"description","targetResourceUuid":"cb4c7a39a84b39bc94dd78bf50f682c9","type":"startVm"}}' \
http://localhost:8080/zstack/v1/scheduler/jobs

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 2.1
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.1
targetResourceUuid String body (contained in the params structure) The target resource UUID. 2.1
type String body (contained in the params structure) The resource type.
  • startVm
  • stopVm
  • rebootVm
  • volumeSnapshot
  • runAutoScalingGroup
  • addIAM2ProjectLoginExpired
  • cancleIAM2ProjectLoginExpired
4.3.0
parameters Map body (contained in the params structure) Optional. The scheduler job parameters. 2.1
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

parameters values depend on type, as listed in the following table.

type parameter parameters values
startVm
stopVm
rebootVm
volumeSnapshot snapshotMaxNumber
volumeBackup
  • volumeReadBandwidth
  • volumeWriteBandwidth
  • networkReadBandwidth
  • networkWriteBandwidth
  • fullBackupTriggerUuid
  • retentionType*
  • retentionValue*
  • backupStorageUuids*
  • remoteBackupStorageUuid
vmBackup (set targetResourceUuid to rootVolumeUuid)
  • volumeReadBandwidth
  • volumeReadBandwidth
  • volumeWriteBandwidth
  • networkReadBandwidth
  • networkWriteBandwidth
  • fullBackupTriggerUuid
  • retentionType*
  • retentionValue*
  • backupStorageUuids*
databaseBackup
  • retentionType*
  • retentionValue*
  • backupStorageUuids*
  • remoteBackupStorageUuid

API Response

Sample Response:

{
  "inventory": {
    "uuid": "0cd85a37bb88346c8c2d122913d812df",
    "targetResourceUuid": "c458e0fb141932d0a87af999b0d0ab81",
    "name": "SchedulerJob",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventory SchedulerInventory See inventory 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 2.1
targetResourceUuid String The target resource UUID. 2.1
name String The resource name. 2.1
description String Optional. The detailed description of the resource. 2.1
state String The state. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
triggersUuid List The scheduler trigger UUID list. 2.1

SDK Sample

Java SDK

CreateSchedulerJobAction action = new CreateSchedulerJobAction();
action.name = "job";
action.description = "description";
action.targetResourceUuid = "cb4c7a39a84b39bc94dd78bf50f682c9";
action.type = "startVm";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSchedulerJobAction.Result res = action.call();

Python SDK

action = CreateSchedulerJobAction()
action.name = "job"
action.description = "description"
action.targetResourceUuid = "cb4c7a39a84b39bc94dd78bf50f682c9"
action.type = "startVm"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteSchedulerJob

API Request

URLs

DELETE zstack/v1/scheduler/jobs/{uuid}?deleteMode={deleteMode}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c9b798cf05f44047b9f79f4f66e0e960" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobs/1ae34aa114424c45ab5af9f9be7af8c1?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
deleteMode String url Optional. The deletion mode. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

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 an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

DeleteSchedulerJobAction action = new DeleteSchedulerJobAction();
action.uuid = "8730c7093939498c9bea46f84435cced";
action.deleteMode = "Permissive";
action.sessionId = "be23055450334fb9add5e0e9031cf238";
DeleteSchedulerJobAction.Result res = action.call();

Python SDK

action = DeleteSchedulerJobAction()
action.uuid = "8a723f909a94473fab6cfb41fb34077f"
action.deleteMode = "Permissive"
action.sessionId = "4e0af23135a7446b90fe40c911f5e946"
res = action.call()

QuerySchedulerJob

API Request

URLs

GET zstack/v1/scheduler/jobs
GET zstack/v1/scheduler/jobs/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b0d89c0878b3492b9f258fcadc81e5f2" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobs?q=name=TestScheduler&q=state=Enabled
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c50c86041f044014bfdc88f2806d989b" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobs/eb52cb8434bc4929b34097d630043695

Queryable Fields

Run zstack CLI, enter QuerySchedulerJob, and press Tab to view all queryable fields and resources that support cross-table queries.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "346e89a1e0f64ce092fc4541f695151f",
      "targetResourceUuid": "b08f45dbea734a9b9507bb773af28428",
      "name": "test",
      "createDate": "Jul 17, 2017 10:18:54 AM",
      "lastOpDate": "Jul 17, 2017 10:18:54 AM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventories List See inventories 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 2.1
targetResourceUuid String The target resource UUID. 2.1
name String The resource name. 2.1
description String Optional. The detailed description of the resource. 2.1
state String The state. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
triggersUuid List The scheduler trigger UUID list. 2.1

SDK Sample

Java SDK

QuerySchedulerJobAction action = new QuerySchedulerJobAction();
action.conditions = asList("name=TestScheduler","state=Enabled");
action.sessionId = "0864c676a4fc4e408dc6d89548e1387f";
QuerySchedulerJobAction.Result res = action.call();

Python SDK

action = QuerySchedulerJobAction()
action.conditions = ["name=TestScheduler","state=Enabled"]
action.sessionId = "a25af40af81541c5b7160af8a135b040"
res = action.call()

UpdateSchedulerJob

API Request

URLs

PUT zstack/v1/scheduler/jobs/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateSchedulerJob": {
    "name": "Test2",
    "description": "new test"
  },
  "systemTags": [],
  "userTags": []
}

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 '{"updateSchedulerJob":{"name":"Test2","description":"new test"}}' \
http://localhost:8080/zstack/v1/scheduler/jobs/676b5d17ee953aa892c6439a06e49bf6/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
name String body (contained in the updateSchedulerJob structure) Optional. The resource name. 2.1
description String body (contained in the updateSchedulerJob structure) Optional. The detailed description of the resource. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "11f1249eaae74b50b909839492ee0991",
    "targetResourceUuid": "eee374cb49904855ad1c46a1c92846af",
    "name": "Test",
    "description": "create volume snapshot job",
    "createDate": "Jul 17, 2017 10:18:53 AM",
    "lastOpDate": "Jul 17, 2017 10:18:53 AM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventory SchedulerJobInventory See inventory 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 2.1
targetResourceUuid String The target resource UUID. 2.1
name String The resource name. 2.1
description String Optional. The detailed description of the resource. 2.1
state String The state. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
triggersUuid List The scheduler trigger UUID list. 2.1

SDK Sample

Java SDK

UpdateSchedulerJobAction action = new UpdateSchedulerJobAction();
action.uuid = "4283a6a09fac4871ab8cd4f94384d32e";
action.name = "Test2";
action.description = "new test";
action.sessionId = "c15d0314892e493281494181e19eae02";
UpdateSchedulerJobAction.Result res = action.call();

Python SDK

action = UpdateSchedulerJobAction()
action.uuid = "f0696f10eb5b408b8f6fddb1094f7b2b"
action.name = "Test2"
action.description = "new test"
action.sessionId = "47041d647e834f5698e613a5e4a99a08"
res = action.call()

GetNoTriggerSchedulerJobs

API Request

URLs

GET zstack/v1/scheduler/jobs/candidates

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobs/candidates

Request Parameters

Name Type Location Description Optional Value Starting Version
systemTags List query Optional. The system tags. 0.6
userTags List query Optional. The user tags. 0.6

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "34c6734f8d9141198bc07b083eecaa1d",
      "name": "job",
      "description": "this is a scheduler job",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 0.6
inventories List See inventories 0.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

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 0.6
targetResourceUuid String The target resource UUID. 0.6
name String The resource name. 0.6
description String Optional. The detailed description of the resource. 0.6
state String The state. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
triggersUuid List The scheduler trigger UUID list. 0.6

SDK Sample

Java SDK

GetNoTriggerSchedulerJobsAction action = new GetNoTriggerSchedulerJobsAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetNoTriggerSchedulerJobsAction.Result res = action.call();

Python SDK

action = GetNoTriggerSchedulerJobsAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ChangeSchedulerState

API Request

URLs

PUT zstack/v1/schedulers/{uuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeSchedulerState": {
    "stateEvent": "disable"
  },
  "systemTags": [],
  "userTags": []
}

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 '{"changeSchedulerState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/schedulers/53cd804df69d3565b4efcd460c0ddd52

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
stateEvent String body (contained in the changeSchedulerState structure) The scheduler job state to set.
  • enable
  • disable
2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "07a35fc1199d31c9bca5db5334f947c9",
    "targetResourceUuid": "5d07512a1bf036e7be1e8938ff7938b3",
    "name": "Test",
    "description": "Create volume snapshot scheduler job",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 2.1
inventory SchedulerInventory See inventory 2.1

#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. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 2.1
targetResourceUuid String The target resource UUID. 2.1
name String The resource name. 2.1
description String Optional. The detailed description of the resource. 2.1
state String The state. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
triggersUuid List The scheduler trigger UUID list. 2.1

SDK Sample

Java SDK

ChangeSchedulerStateAction action = new ChangeSchedulerStateAction();
action.uuid = "53cd804df69d3565b4efcd460c0ddd52";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeSchedulerStateAction.Result res = action.call();

Python SDK

action = ChangeSchedulerStateAction()
action.uuid = "53cd804df69d3565b4efcd460c0ddd52"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()