tasks.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package apis
  15. import (
  16. "time"
  17. "yunion.io/x/jsonutils"
  18. )
  19. type TaskBaseListInput struct {
  20. ProjectizedResourceListInput
  21. StatusResourceBaseListInput
  22. ObjId []string `json:"obj_id" help:"object id filter"`
  23. ObjType []string `json:"obj_type" help:"object type (in singular form) filter"`
  24. ObjName []string `json:"obj_name" help:"object name filter"`
  25. TaskName []string `json:"task_name" help:"task name filter"`
  26. IsMulti *bool `json:"is_multi" negative:"is_single" help:"is multi task"`
  27. IsComplete *bool `json:"is_complete" negative:"not_complete" help:"is task completed, either fail or complete"`
  28. IsInit *bool `json:"is_init" negative:"not_init" help:"is task started?"`
  29. Stage []string `json:"stage" help:"tasks in stages"`
  30. NotStage []string `json:"not_stage" help:"tasks not in stages"`
  31. ParentId []string `json:"parent_id" help:"filter tasks by parent_task_id"`
  32. IsRoot *bool `json:"is_root" help:"filter root tasks"`
  33. ParentTaskId string `json:"parent_task_id" help:"filter by parent_task_id"`
  34. SubTask *bool `json:"sub_task" help:"show sub task states"`
  35. }
  36. type TaskListInput struct {
  37. ModelBaseListInput
  38. TaskBaseListInput
  39. Id []string `json:"id" help:"id filter"`
  40. }
  41. type ArchivedTaskListInput struct {
  42. LogBaseListInput
  43. TaskBaseListInput
  44. TaskId []string `json:"task_id" help:"filter by task_id"`
  45. }
  46. type TaskDetails struct {
  47. ModelBaseDetails
  48. ProjectizedResourceInfo
  49. // 资源创建时间
  50. CreatedAt time.Time `json:"created_at"`
  51. // 资源更新时间
  52. UpdatedAt time.Time `json:"updated_at"`
  53. // 资源被更新次数
  54. UpdateVersion int `json:"update_version"`
  55. // 开始任务时间
  56. StartAt time.Time `json:"start_at"`
  57. // 完成任务时间
  58. EndAt time.Time `json:"end_at"`
  59. DomainId string `json:"domain_id"`
  60. ProjectId string `json:"tenant_id"`
  61. Id string `json:"id"`
  62. ObjName string `json:"obj_name"`
  63. ObjId string `json:"obj_id"`
  64. TaskName string `json:"task_name"`
  65. Params jsonutils.JSONObject `json:"params"`
  66. UserCred jsonutils.JSONObject `json:"user_cred"`
  67. Stage string `json:"stage"`
  68. ParentTaskId string `json:"parent_task_id"`
  69. }
  70. type TaskCancelInput struct {
  71. }