models.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. # -*- coding: utf-8 -*-
  2. # This file is auto-generated, don't edit it. Thanks.
  3. from Tea.model import TeaModel
  4. from alibabacloud_credentials.client import Client as CredentialClient
  5. class InterceptorContextRequest(TeaModel):
  6. def __init__(self, headers=None, query=None, body=None, stream=None, host_map=None, pathname=None,
  7. product_id=None, action=None, version=None, protocol=None, method=None, auth_type=None, body_type=None,
  8. req_body_type=None, style=None, credential=None, signature_version=None, signature_algorithm=None,
  9. user_agent=None):
  10. self.headers = headers # type: dict[str, str]
  11. self.query = query # type: dict[str, str]
  12. self.body = body # type: any
  13. self.stream = stream # type: READABLE
  14. self.host_map = host_map # type: dict[str, str]
  15. self.pathname = pathname # type: str
  16. self.product_id = product_id # type: str
  17. self.action = action # type: str
  18. self.version = version # type: str
  19. self.protocol = protocol # type: str
  20. self.method = method # type: str
  21. self.auth_type = auth_type # type: str
  22. self.body_type = body_type # type: str
  23. self.req_body_type = req_body_type # type: str
  24. self.style = style # type: str
  25. self.credential = credential # type: CredentialClient
  26. self.signature_version = signature_version # type: str
  27. self.signature_algorithm = signature_algorithm # type: str
  28. self.user_agent = user_agent # type: str
  29. def validate(self):
  30. self.validate_required(self.pathname, 'pathname')
  31. self.validate_required(self.product_id, 'product_id')
  32. self.validate_required(self.action, 'action')
  33. self.validate_required(self.version, 'version')
  34. self.validate_required(self.protocol, 'protocol')
  35. self.validate_required(self.method, 'method')
  36. self.validate_required(self.auth_type, 'auth_type')
  37. self.validate_required(self.body_type, 'body_type')
  38. self.validate_required(self.req_body_type, 'req_body_type')
  39. self.validate_required(self.credential, 'credential')
  40. self.validate_required(self.user_agent, 'user_agent')
  41. def to_map(self):
  42. _map = super(InterceptorContextRequest, self).to_map()
  43. if _map is not None:
  44. return _map
  45. result = dict()
  46. if self.headers is not None:
  47. result['headers'] = self.headers
  48. if self.query is not None:
  49. result['query'] = self.query
  50. if self.body is not None:
  51. result['body'] = self.body
  52. if self.stream is not None:
  53. result['stream'] = self.stream
  54. if self.host_map is not None:
  55. result['hostMap'] = self.host_map
  56. if self.pathname is not None:
  57. result['pathname'] = self.pathname
  58. if self.product_id is not None:
  59. result['productId'] = self.product_id
  60. if self.action is not None:
  61. result['action'] = self.action
  62. if self.version is not None:
  63. result['version'] = self.version
  64. if self.protocol is not None:
  65. result['protocol'] = self.protocol
  66. if self.method is not None:
  67. result['method'] = self.method
  68. if self.auth_type is not None:
  69. result['authType'] = self.auth_type
  70. if self.body_type is not None:
  71. result['bodyType'] = self.body_type
  72. if self.req_body_type is not None:
  73. result['reqBodyType'] = self.req_body_type
  74. if self.style is not None:
  75. result['style'] = self.style
  76. if self.credential is not None:
  77. result['credential'] = self.credential
  78. if self.signature_version is not None:
  79. result['signatureVersion'] = self.signature_version
  80. if self.signature_algorithm is not None:
  81. result['signatureAlgorithm'] = self.signature_algorithm
  82. if self.user_agent is not None:
  83. result['userAgent'] = self.user_agent
  84. return result
  85. def from_map(self, m=None):
  86. m = m or dict()
  87. if m.get('headers') is not None:
  88. self.headers = m.get('headers')
  89. if m.get('query') is not None:
  90. self.query = m.get('query')
  91. if m.get('body') is not None:
  92. self.body = m.get('body')
  93. if m.get('stream') is not None:
  94. self.stream = m.get('stream')
  95. if m.get('hostMap') is not None:
  96. self.host_map = m.get('hostMap')
  97. if m.get('pathname') is not None:
  98. self.pathname = m.get('pathname')
  99. if m.get('productId') is not None:
  100. self.product_id = m.get('productId')
  101. if m.get('action') is not None:
  102. self.action = m.get('action')
  103. if m.get('version') is not None:
  104. self.version = m.get('version')
  105. if m.get('protocol') is not None:
  106. self.protocol = m.get('protocol')
  107. if m.get('method') is not None:
  108. self.method = m.get('method')
  109. if m.get('authType') is not None:
  110. self.auth_type = m.get('authType')
  111. if m.get('bodyType') is not None:
  112. self.body_type = m.get('bodyType')
  113. if m.get('reqBodyType') is not None:
  114. self.req_body_type = m.get('reqBodyType')
  115. if m.get('style') is not None:
  116. self.style = m.get('style')
  117. if m.get('credential') is not None:
  118. self.credential = m.get('credential')
  119. if m.get('signatureVersion') is not None:
  120. self.signature_version = m.get('signatureVersion')
  121. if m.get('signatureAlgorithm') is not None:
  122. self.signature_algorithm = m.get('signatureAlgorithm')
  123. if m.get('userAgent') is not None:
  124. self.user_agent = m.get('userAgent')
  125. return self
  126. class InterceptorContextConfiguration(TeaModel):
  127. def __init__(self, region_id=None, endpoint=None, endpoint_rule=None, endpoint_map=None, endpoint_type=None,
  128. network=None, suffix=None):
  129. self.region_id = region_id # type: str
  130. self.endpoint = endpoint # type: str
  131. self.endpoint_rule = endpoint_rule # type: str
  132. self.endpoint_map = endpoint_map # type: dict[str, str]
  133. self.endpoint_type = endpoint_type # type: str
  134. self.network = network # type: str
  135. self.suffix = suffix # type: str
  136. def validate(self):
  137. self.validate_required(self.region_id, 'region_id')
  138. def to_map(self):
  139. _map = super(InterceptorContextConfiguration, self).to_map()
  140. if _map is not None:
  141. return _map
  142. result = dict()
  143. if self.region_id is not None:
  144. result['regionId'] = self.region_id
  145. if self.endpoint is not None:
  146. result['endpoint'] = self.endpoint
  147. if self.endpoint_rule is not None:
  148. result['endpointRule'] = self.endpoint_rule
  149. if self.endpoint_map is not None:
  150. result['endpointMap'] = self.endpoint_map
  151. if self.endpoint_type is not None:
  152. result['endpointType'] = self.endpoint_type
  153. if self.network is not None:
  154. result['network'] = self.network
  155. if self.suffix is not None:
  156. result['suffix'] = self.suffix
  157. return result
  158. def from_map(self, m=None):
  159. m = m or dict()
  160. if m.get('regionId') is not None:
  161. self.region_id = m.get('regionId')
  162. if m.get('endpoint') is not None:
  163. self.endpoint = m.get('endpoint')
  164. if m.get('endpointRule') is not None:
  165. self.endpoint_rule = m.get('endpointRule')
  166. if m.get('endpointMap') is not None:
  167. self.endpoint_map = m.get('endpointMap')
  168. if m.get('endpointType') is not None:
  169. self.endpoint_type = m.get('endpointType')
  170. if m.get('network') is not None:
  171. self.network = m.get('network')
  172. if m.get('suffix') is not None:
  173. self.suffix = m.get('suffix')
  174. return self
  175. class InterceptorContextResponse(TeaModel):
  176. def __init__(self, status_code=None, headers=None, body=None, deserialized_body=None):
  177. self.status_code = status_code # type: int
  178. self.headers = headers # type: dict[str, str]
  179. self.body = body # type: READABLE
  180. self.deserialized_body = deserialized_body # type: any
  181. def validate(self):
  182. pass
  183. def to_map(self):
  184. _map = super(InterceptorContextResponse, self).to_map()
  185. if _map is not None:
  186. return _map
  187. result = dict()
  188. if self.status_code is not None:
  189. result['statusCode'] = self.status_code
  190. if self.headers is not None:
  191. result['headers'] = self.headers
  192. if self.body is not None:
  193. result['body'] = self.body
  194. if self.deserialized_body is not None:
  195. result['deserializedBody'] = self.deserialized_body
  196. return result
  197. def from_map(self, m=None):
  198. m = m or dict()
  199. if m.get('statusCode') is not None:
  200. self.status_code = m.get('statusCode')
  201. if m.get('headers') is not None:
  202. self.headers = m.get('headers')
  203. if m.get('body') is not None:
  204. self.body = m.get('body')
  205. if m.get('deserializedBody') is not None:
  206. self.deserialized_body = m.get('deserializedBody')
  207. return self
  208. class InterceptorContext(TeaModel):
  209. def __init__(self, request=None, configuration=None, response=None):
  210. self.request = request # type: InterceptorContextRequest
  211. self.configuration = configuration # type: InterceptorContextConfiguration
  212. self.response = response # type: InterceptorContextResponse
  213. def validate(self):
  214. self.validate_required(self.request, 'request')
  215. if self.request:
  216. self.request.validate()
  217. self.validate_required(self.configuration, 'configuration')
  218. if self.configuration:
  219. self.configuration.validate()
  220. self.validate_required(self.response, 'response')
  221. if self.response:
  222. self.response.validate()
  223. def to_map(self):
  224. _map = super(InterceptorContext, self).to_map()
  225. if _map is not None:
  226. return _map
  227. result = dict()
  228. if self.request is not None:
  229. result['request'] = self.request.to_map()
  230. if self.configuration is not None:
  231. result['configuration'] = self.configuration.to_map()
  232. if self.response is not None:
  233. result['response'] = self.response.to_map()
  234. return result
  235. def from_map(self, m=None):
  236. m = m or dict()
  237. if m.get('request') is not None:
  238. temp_model = InterceptorContextRequest()
  239. self.request = temp_model.from_map(m['request'])
  240. if m.get('configuration') is not None:
  241. temp_model = InterceptorContextConfiguration()
  242. self.configuration = temp_model.from_map(m['configuration'])
  243. if m.get('response') is not None:
  244. temp_model = InterceptorContextResponse()
  245. self.response = temp_model.from_map(m['response'])
  246. return self
  247. class AttributeMap(TeaModel):
  248. def __init__(self, attributes=None, key=None):
  249. self.attributes = attributes # type: dict[str, any]
  250. self.key = key # type: dict[str, str]
  251. def validate(self):
  252. self.validate_required(self.attributes, 'attributes')
  253. self.validate_required(self.key, 'key')
  254. def to_map(self):
  255. _map = super(AttributeMap, self).to_map()
  256. if _map is not None:
  257. return _map
  258. result = dict()
  259. if self.attributes is not None:
  260. result['attributes'] = self.attributes
  261. if self.key is not None:
  262. result['key'] = self.key
  263. return result
  264. def from_map(self, m=None):
  265. m = m or dict()
  266. if m.get('attributes') is not None:
  267. self.attributes = m.get('attributes')
  268. if m.get('key') is not None:
  269. self.key = m.get('key')
  270. return self