boot_job.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.sequence = 0
  40. self.command = ''
  41. self.path = ''
  42. self.content = ''
  43. @staticmethod
  44. def get_filter_keywords():
  45. return {
  46. 'id': FilterFieldType.INT.value,
  47. 'boot_job_id': FilterFieldType.INT.value,
  48. 'sequence': FilterFieldType.INT.value,
  49. 'command': FilterFieldType.STR.value,
  50. 'path': FilterFieldType.STR.value,
  51. 'content': FilterFieldType.STR.value,
  52. }
  53. @staticmethod
  54. def get_allow_update_keywords():
  55. return ['boot_job_id', 'sequence']
  56. @staticmethod
  57. def get_allow_content_search_keywords():
  58. return ['command', 'path', 'content']