Files
xen-orchestra/@xen-orchestra/xapi/task.mjs
T

14 lines
369 B
JavaScript
Raw Normal View History

2023-07-10 15:56:50 +02:00
import ignoreErrors from 'promise-toolbox/ignoreErrors'
2022-03-23 09:48:07 +01:00
2023-07-10 15:56:50 +02:00
export default class Task {
2021-02-23 08:58:10 +01:00
create(name = 'untitled task', description) {
2021-03-28 23:29:17 +02:00
return this.createTask(`[XO] ${name}`, description)
2021-02-23 08:58:10 +01:00
}
destroy(ref) {
// pending task cannot be destroyed
ignoreErrors.call(this.call('task.set_status', ref, 'cancelled'))
return this.call('task.destroy', ref)
}
}