InstanceInfo.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class InstanceInfo(object):
  6. def __init__(self):
  7. self._content = None
  8. self._ext_info = None
  9. self._gmt_end = None
  10. self._gmt_start = None
  11. self._instance_id = None
  12. self._instance_name = None
  13. self._type = None
  14. @property
  15. def content(self):
  16. return self._content
  17. @content.setter
  18. def content(self, value):
  19. self._content = value
  20. @property
  21. def ext_info(self):
  22. return self._ext_info
  23. @ext_info.setter
  24. def ext_info(self, value):
  25. self._ext_info = value
  26. @property
  27. def gmt_end(self):
  28. return self._gmt_end
  29. @gmt_end.setter
  30. def gmt_end(self, value):
  31. self._gmt_end = value
  32. @property
  33. def gmt_start(self):
  34. return self._gmt_start
  35. @gmt_start.setter
  36. def gmt_start(self, value):
  37. self._gmt_start = value
  38. @property
  39. def instance_id(self):
  40. return self._instance_id
  41. @instance_id.setter
  42. def instance_id(self, value):
  43. self._instance_id = value
  44. @property
  45. def instance_name(self):
  46. return self._instance_name
  47. @instance_name.setter
  48. def instance_name(self, value):
  49. self._instance_name = value
  50. @property
  51. def type(self):
  52. return self._type
  53. @type.setter
  54. def type(self, value):
  55. self._type = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.content:
  59. if hasattr(self.content, 'to_alipay_dict'):
  60. params['content'] = self.content.to_alipay_dict()
  61. else:
  62. params['content'] = self.content
  63. if self.ext_info:
  64. if hasattr(self.ext_info, 'to_alipay_dict'):
  65. params['ext_info'] = self.ext_info.to_alipay_dict()
  66. else:
  67. params['ext_info'] = self.ext_info
  68. if self.gmt_end:
  69. if hasattr(self.gmt_end, 'to_alipay_dict'):
  70. params['gmt_end'] = self.gmt_end.to_alipay_dict()
  71. else:
  72. params['gmt_end'] = self.gmt_end
  73. if self.gmt_start:
  74. if hasattr(self.gmt_start, 'to_alipay_dict'):
  75. params['gmt_start'] = self.gmt_start.to_alipay_dict()
  76. else:
  77. params['gmt_start'] = self.gmt_start
  78. if self.instance_id:
  79. if hasattr(self.instance_id, 'to_alipay_dict'):
  80. params['instance_id'] = self.instance_id.to_alipay_dict()
  81. else:
  82. params['instance_id'] = self.instance_id
  83. if self.instance_name:
  84. if hasattr(self.instance_name, 'to_alipay_dict'):
  85. params['instance_name'] = self.instance_name.to_alipay_dict()
  86. else:
  87. params['instance_name'] = self.instance_name
  88. if self.type:
  89. if hasattr(self.type, 'to_alipay_dict'):
  90. params['type'] = self.type.to_alipay_dict()
  91. else:
  92. params['type'] = self.type
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = InstanceInfo()
  99. if 'content' in d:
  100. o.content = d['content']
  101. if 'ext_info' in d:
  102. o.ext_info = d['ext_info']
  103. if 'gmt_end' in d:
  104. o.gmt_end = d['gmt_end']
  105. if 'gmt_start' in d:
  106. o.gmt_start = d['gmt_start']
  107. if 'instance_id' in d:
  108. o.instance_id = d['instance_id']
  109. if 'instance_name' in d:
  110. o.instance_name = d['instance_name']
  111. if 'type' in d:
  112. o.type = d['type']
  113. return o