boot_job.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from models import FilterFieldType
  4. from models import ORM
  5. __author__ = 'James Iter'
  6. __date__ = '2017/6/19'
  7. __contact__ = 'james.iter.cn@gmail.com'
  8. __copyright__ = '(c) 2017 by James Iter.'
  9. class BootJob(ORM):
  10. _table_name = 'boot_job'
  11. _primary_key = 'id'
  12. def __init__(self):
  13. super(BootJob, self).__init__()
  14. self.id = 0
  15. self.name = None
  16. self.use_for = None
  17. self.remark = ''
  18. @staticmethod
  19. def get_filter_keywords():
  20. return {
  21. 'id': FilterFieldType.INT.value,
  22. 'name': FilterFieldType.STR.value,
  23. 'remark': FilterFieldType.STR.value
  24. }
  25. @staticmethod
  26. def get_allow_update_keywords():
  27. return ['use_for']
  28. @staticmethod
  29. def get_allow_content_search_keywords():
  30. return ['name', 'remark']
  31. class OperateRule(ORM):
  32. _table_name = 'operate_rule'
  33. _primary_key = 'id'
  34. def __init__(self):
  35. super(OperateRule, self).__init__()
  36. self.id = 0
  37. self.boot_job_id = None
  38. self.kind = ''
  39. self.command = ''
  40. self.path = ''
  41. self.content = ''
  42. @staticmethod
  43. def get_filter_keywords():
  44. return {
  45. 'id': FilterFieldType.INT.value,
  46. 'boot_job_id': FilterFieldType.INT.value,
  47. 'command': FilterFieldType.STR.value,
  48. 'path': FilterFieldType.STR.value,
  49. 'content': FilterFieldType.STR.value,
  50. }
  51. @staticmethod
  52. def get_allow_update_keywords():
  53. return ['boot_job_id']
  54. @staticmethod
  55. def get_allow_content_search_keywords():
  56. return ['command', 'path', 'content']