models.py 12 KB

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