catocli 2.0.5__py3-none-any.whl → 2.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of catocli might be problematic. Click here for more details.

Files changed (365) hide show
  1. catocli/Utils/clidriver.py +32 -4
  2. catocli/Utils/version_checker.py +1 -1
  3. catocli/__init__.py +1 -1
  4. catocli/parsers/custom/export_sites/export_sites.py +18 -1
  5. catocli/parsers/custom/import_rules_to_tf/import_rules_to_tf.py +13 -2
  6. catocli/parsers/custom/import_sites_to_tf/__init__.py +3 -1
  7. catocli/parsers/custom/import_sites_to_tf/import_sites_to_tf.py +79 -6
  8. catocli/parsers/custom_private/__init__.py +134 -0
  9. catocli/parsers/mutation_accountManagement/__init__.py +13 -0
  10. catocli/parsers/mutation_accountManagement_disableAccount/README.md +16 -0
  11. catocli/parsers/mutation_groups/README.md +7 -0
  12. catocli/parsers/mutation_groups/__init__.py +48 -0
  13. catocli/parsers/mutation_groups_createGroup/README.md +18 -0
  14. catocli/parsers/mutation_groups_deleteGroup/README.md +18 -0
  15. catocli/parsers/mutation_groups_updateGroup/README.md +18 -0
  16. catocli/parsers/mutation_site/__init__.py +104 -0
  17. catocli/parsers/mutation_site_assignSiteBwLicense/README.md +17 -0
  18. catocli/parsers/mutation_site_removeSecondaryAwsVSocket/README.md +17 -0
  19. catocli/parsers/mutation_site_removeSecondaryAzureVSocket/README.md +17 -0
  20. catocli/parsers/mutation_site_removeSiteBwLicense/README.md +17 -0
  21. catocli/parsers/mutation_site_replaceSiteBwLicense/README.md +17 -0
  22. catocli/parsers/mutation_site_updateSecondaryAwsVSocket/README.md +17 -0
  23. catocli/parsers/mutation_site_updateSecondaryAzureVSocket/README.md +17 -0
  24. catocli/parsers/mutation_site_updateSiteBwLicense/README.md +17 -0
  25. catocli/parsers/mutation_site_updateSiteGeneralDetails/README.md +1 -1
  26. catocli/parsers/mutation_sites/__init__.py +104 -0
  27. catocli/parsers/mutation_sites_assignSiteBwLicense/README.md +17 -0
  28. catocli/parsers/mutation_sites_removeSecondaryAwsVSocket/README.md +17 -0
  29. catocli/parsers/mutation_sites_removeSecondaryAzureVSocket/README.md +17 -0
  30. catocli/parsers/mutation_sites_removeSiteBwLicense/README.md +17 -0
  31. catocli/parsers/mutation_sites_replaceSiteBwLicense/README.md +17 -0
  32. catocli/parsers/mutation_sites_updateSecondaryAwsVSocket/README.md +17 -0
  33. catocli/parsers/mutation_sites_updateSecondaryAzureVSocket/README.md +17 -0
  34. catocli/parsers/mutation_sites_updateSiteBwLicense/README.md +17 -0
  35. catocli/parsers/mutation_sites_updateSiteGeneralDetails/README.md +1 -1
  36. catocli/parsers/parserApiClient.py +444 -9
  37. catocli/parsers/query_eventsFeed/README.md +1 -1
  38. catocli/parsers/query_groups/README.md +7 -0
  39. catocli/parsers/query_groups/__init__.py +54 -0
  40. catocli/parsers/query_groups_group/README.md +7 -0
  41. catocli/parsers/query_groups_groupList/README.md +18 -0
  42. catocli/parsers/query_groups_group_members/README.md +18 -0
  43. catocli/parsers/query_groups_whereUsed/README.md +17 -0
  44. catocli/parsers/query_popLocations/README.md +17 -0
  45. catocli/parsers/query_popLocations/__init__.py +16 -0
  46. catocli/parsers/query_site/__init__.py +26 -0
  47. catocli/parsers/query_site_secondaryAwsVSocket/README.md +17 -0
  48. catocli/parsers/query_site_secondaryAzureVSocket/README.md +17 -0
  49. catocli/parsers/query_socketPortMetrics/README.md +23 -0
  50. catocli/parsers/query_socketPortMetrics/__init__.py +16 -0
  51. catocli/parsers/query_socketPortMetricsTimeSeries/README.md +24 -0
  52. catocli/parsers/query_socketPortMetricsTimeSeries/__init__.py +16 -0
  53. {catocli-2.0.5.dist-info → catocli-2.1.1.dist-info}/METADATA +3 -2
  54. {catocli-2.0.5.dist-info → catocli-2.1.1.dist-info}/RECORD +253 -300
  55. {catocli-2.0.5.dist-info → catocli-2.1.1.dist-info}/WHEEL +1 -1
  56. {catocli-2.0.5.dist-info → catocli-2.1.1.dist-info}/top_level.txt +0 -2
  57. graphql_client/api/call_api.py +20 -2
  58. models/mutation.accountManagement.addAccount.json +97 -0
  59. models/mutation.accountManagement.disableAccount.json +545 -0
  60. models/mutation.accountManagement.removeAccount.json +102 -3
  61. models/mutation.accountManagement.updateAccount.json +97 -0
  62. models/mutation.admin.addAdmin.json +6 -9
  63. models/mutation.container.delete.json +2 -2
  64. models/mutation.container.fqdn.addValues.json +3 -3
  65. models/mutation.container.fqdn.createFromFile.json +3 -3
  66. models/mutation.container.fqdn.removeValues.json +3 -3
  67. models/mutation.container.fqdn.updateFromFile.json +3 -3
  68. models/mutation.container.ipAddressRange.addValues.json +3 -3
  69. models/mutation.container.ipAddressRange.createFromFile.json +3 -3
  70. models/mutation.container.ipAddressRange.removeValues.json +3 -3
  71. models/mutation.container.ipAddressRange.updateFromFile.json +3 -3
  72. models/mutation.groups.createGroup.json +3178 -0
  73. models/mutation.groups.deleteGroup.json +2758 -0
  74. models/mutation.groups.updateGroup.json +4429 -0
  75. models/mutation.hardware.updateHardwareShipping.json +30 -10
  76. models/mutation.policy.appTenantRestriction.addRule.json +33 -33
  77. models/mutation.policy.appTenantRestriction.addSection.json +4 -4
  78. models/mutation.policy.appTenantRestriction.createPolicyRevision.json +33 -33
  79. models/mutation.policy.appTenantRestriction.discardPolicyRevision.json +33 -33
  80. models/mutation.policy.appTenantRestriction.moveRule.json +27 -27
  81. models/mutation.policy.appTenantRestriction.moveSection.json +4 -4
  82. models/mutation.policy.appTenantRestriction.publishPolicyRevision.json +33 -33
  83. models/mutation.policy.appTenantRestriction.removeRule.json +27 -27
  84. models/mutation.policy.appTenantRestriction.removeSection.json +4 -4
  85. models/mutation.policy.appTenantRestriction.updatePolicy.json +33 -33
  86. models/mutation.policy.appTenantRestriction.updateRule.json +33 -33
  87. models/mutation.policy.appTenantRestriction.updateSection.json +4 -4
  88. models/mutation.policy.dynamicIpAllocation.addRule.json +12 -12
  89. models/mutation.policy.dynamicIpAllocation.addSection.json +4 -4
  90. models/mutation.policy.dynamicIpAllocation.createPolicyRevision.json +18 -18
  91. models/mutation.policy.dynamicIpAllocation.discardPolicyRevision.json +18 -18
  92. models/mutation.policy.dynamicIpAllocation.moveRule.json +12 -12
  93. models/mutation.policy.dynamicIpAllocation.moveSection.json +4 -4
  94. models/mutation.policy.dynamicIpAllocation.publishPolicyRevision.json +18 -18
  95. models/mutation.policy.dynamicIpAllocation.removeRule.json +12 -12
  96. models/mutation.policy.dynamicIpAllocation.removeSection.json +4 -4
  97. models/mutation.policy.dynamicIpAllocation.updatePolicy.json +18 -18
  98. models/mutation.policy.dynamicIpAllocation.updateRule.json +12 -12
  99. models/mutation.policy.dynamicIpAllocation.updateSection.json +4 -4
  100. models/mutation.policy.internetFirewall.addRule.json +141 -141
  101. models/mutation.policy.internetFirewall.addSection.json +4 -4
  102. models/mutation.policy.internetFirewall.createPolicyRevision.json +102 -102
  103. models/mutation.policy.internetFirewall.discardPolicyRevision.json +102 -102
  104. models/mutation.policy.internetFirewall.moveRule.json +96 -96
  105. models/mutation.policy.internetFirewall.moveSection.json +4 -4
  106. models/mutation.policy.internetFirewall.publishPolicyRevision.json +102 -102
  107. models/mutation.policy.internetFirewall.removeRule.json +96 -96
  108. models/mutation.policy.internetFirewall.removeSection.json +4 -4
  109. models/mutation.policy.internetFirewall.updatePolicy.json +102 -102
  110. models/mutation.policy.internetFirewall.updateRule.json +141 -141
  111. models/mutation.policy.internetFirewall.updateSection.json +4 -4
  112. models/mutation.policy.remotePortFwd.addRule.json +21 -21
  113. models/mutation.policy.remotePortFwd.addSection.json +4 -4
  114. models/mutation.policy.remotePortFwd.createPolicyRevision.json +24 -24
  115. models/mutation.policy.remotePortFwd.discardPolicyRevision.json +24 -24
  116. models/mutation.policy.remotePortFwd.moveRule.json +18 -18
  117. models/mutation.policy.remotePortFwd.moveSection.json +4 -4
  118. models/mutation.policy.remotePortFwd.publishPolicyRevision.json +24 -24
  119. models/mutation.policy.remotePortFwd.removeRule.json +18 -18
  120. models/mutation.policy.remotePortFwd.removeSection.json +4 -4
  121. models/mutation.policy.remotePortFwd.updatePolicy.json +24 -24
  122. models/mutation.policy.remotePortFwd.updateRule.json +21 -21
  123. models/mutation.policy.remotePortFwd.updateSection.json +4 -4
  124. models/mutation.policy.socketLan.addRule.json +97 -97
  125. models/mutation.policy.socketLan.addSection.json +4 -4
  126. models/mutation.policy.socketLan.createPolicyRevision.json +91 -91
  127. models/mutation.policy.socketLan.discardPolicyRevision.json +91 -91
  128. models/mutation.policy.socketLan.moveRule.json +85 -85
  129. models/mutation.policy.socketLan.moveSection.json +4 -4
  130. models/mutation.policy.socketLan.publishPolicyRevision.json +91 -91
  131. models/mutation.policy.socketLan.removeRule.json +85 -85
  132. models/mutation.policy.socketLan.removeSection.json +4 -4
  133. models/mutation.policy.socketLan.updatePolicy.json +91 -91
  134. models/mutation.policy.socketLan.updateRule.json +97 -97
  135. models/mutation.policy.socketLan.updateSection.json +4 -4
  136. models/mutation.policy.terminalServer.addRule.json +7 -7
  137. models/mutation.policy.terminalServer.addSection.json +4 -4
  138. models/mutation.policy.terminalServer.createPolicyRevision.json +13 -13
  139. models/mutation.policy.terminalServer.discardPolicyRevision.json +13 -13
  140. models/mutation.policy.terminalServer.moveRule.json +7 -7
  141. models/mutation.policy.terminalServer.moveSection.json +4 -4
  142. models/mutation.policy.terminalServer.publishPolicyRevision.json +13 -13
  143. models/mutation.policy.terminalServer.removeRule.json +7 -7
  144. models/mutation.policy.terminalServer.removeSection.json +4 -4
  145. models/mutation.policy.terminalServer.updatePolicy.json +13 -13
  146. models/mutation.policy.terminalServer.updateRule.json +7 -7
  147. models/mutation.policy.terminalServer.updateSection.json +4 -4
  148. models/mutation.policy.wanFirewall.addRule.json +157 -157
  149. models/mutation.policy.wanFirewall.addSection.json +4 -4
  150. models/mutation.policy.wanFirewall.createPolicyRevision.json +121 -121
  151. models/mutation.policy.wanFirewall.discardPolicyRevision.json +121 -121
  152. models/mutation.policy.wanFirewall.moveRule.json +115 -115
  153. models/mutation.policy.wanFirewall.moveSection.json +4 -4
  154. models/mutation.policy.wanFirewall.publishPolicyRevision.json +121 -121
  155. models/mutation.policy.wanFirewall.removeRule.json +115 -115
  156. models/mutation.policy.wanFirewall.removeSection.json +4 -4
  157. models/mutation.policy.wanFirewall.updatePolicy.json +121 -121
  158. models/mutation.policy.wanFirewall.updateRule.json +157 -157
  159. models/mutation.policy.wanFirewall.updateSection.json +4 -4
  160. models/mutation.policy.wanNetwork.addRule.json +103 -103
  161. models/mutation.policy.wanNetwork.addSection.json +4 -4
  162. models/mutation.policy.wanNetwork.createPolicyRevision.json +97 -97
  163. models/mutation.policy.wanNetwork.discardPolicyRevision.json +97 -97
  164. models/mutation.policy.wanNetwork.moveRule.json +91 -91
  165. models/mutation.policy.wanNetwork.moveSection.json +4 -4
  166. models/mutation.policy.wanNetwork.publishPolicyRevision.json +97 -97
  167. models/mutation.policy.wanNetwork.removeRule.json +91 -91
  168. models/mutation.policy.wanNetwork.removeSection.json +4 -4
  169. models/mutation.policy.wanNetwork.updatePolicy.json +97 -97
  170. models/mutation.policy.wanNetwork.updateRule.json +103 -103
  171. models/mutation.policy.wanNetwork.updateSection.json +4 -4
  172. models/mutation.site.addBgpPeer.json +10 -10
  173. models/mutation.site.addIpsecIkeV2SiteTunnels.json +2 -2
  174. models/mutation.site.addSocketAddOnCard.json +2 -2
  175. models/mutation.site.assignSiteBwLicense.json +12879 -0
  176. models/mutation.site.removeBgpPeer.json +10 -10
  177. models/mutation.site.removeIpsecIkeV2SiteTunnels.json +2 -2
  178. models/mutation.site.removeSecondaryAwsVSocket.json +375 -0
  179. models/mutation.site.removeSecondaryAzureVSocket.json +354 -0
  180. models/mutation.site.removeSiteBwLicense.json +12822 -0
  181. models/mutation.site.removeSocketAddOnCard.json +2 -2
  182. models/mutation.site.replaceSiteBwLicense.json +12939 -0
  183. models/mutation.site.startSiteUpgrade.json +36 -15
  184. models/mutation.site.updateBgpPeer.json +10 -10
  185. models/mutation.site.updateIpsecIkeV2SiteTunnels.json +2 -2
  186. models/mutation.site.updateSecondaryAwsVSocket.json +643 -0
  187. models/mutation.site.updateSecondaryAzureVSocket.json +565 -0
  188. models/mutation.site.updateSiteBwLicense.json +12882 -0
  189. models/mutation.site.updateSiteGeneralDetails.json +724 -1
  190. models/mutation.sites.addBgpPeer.json +10 -10
  191. models/mutation.sites.addIpsecIkeV2SiteTunnels.json +2 -2
  192. models/mutation.sites.addSocketAddOnCard.json +2 -2
  193. models/mutation.sites.assignSiteBwLicense.json +12879 -0
  194. models/mutation.sites.removeBgpPeer.json +10 -10
  195. models/mutation.sites.removeIpsecIkeV2SiteTunnels.json +2 -2
  196. models/mutation.sites.removeSecondaryAwsVSocket.json +375 -0
  197. models/mutation.sites.removeSecondaryAzureVSocket.json +354 -0
  198. models/mutation.sites.removeSiteBwLicense.json +12822 -0
  199. models/mutation.sites.removeSocketAddOnCard.json +2 -2
  200. models/mutation.sites.replaceSiteBwLicense.json +12939 -0
  201. models/mutation.sites.startSiteUpgrade.json +36 -15
  202. models/mutation.sites.updateBgpPeer.json +10 -10
  203. models/mutation.sites.updateIpsecIkeV2SiteTunnels.json +2 -2
  204. models/mutation.sites.updateSecondaryAwsVSocket.json +643 -0
  205. models/mutation.sites.updateSecondaryAzureVSocket.json +565 -0
  206. models/mutation.sites.updateSiteBwLicense.json +12882 -0
  207. models/mutation.sites.updateSiteGeneralDetails.json +724 -1
  208. models/mutation.xdr.addStoryComment.json +1 -1
  209. models/mutation.xdr.analystFeedback.json +84 -84
  210. models/mutation.xdr.deleteStoryComment.json +1 -1
  211. models/query.accountManagement.json +97 -0
  212. models/query.accountMetrics.json +45 -45
  213. models/query.accountSnapshot.json +30 -30
  214. models/query.admin.json +6 -6
  215. models/query.admins.json +13 -13
  216. models/query.appStats.json +915 -867
  217. models/query.appStatsTimeSeries.json +692 -656
  218. models/query.auditFeed.json +6 -6
  219. models/query.catalogs.json +52 -52
  220. models/query.container.json +16 -16
  221. models/query.devices.json +20 -93
  222. models/query.entityLookup.json +2 -2
  223. models/query.events.json +288 -384
  224. models/query.eventsFeed.json +73 -97
  225. models/query.eventsTimeSeries.json +219 -291
  226. models/query.groups.group.members.json +3058 -0
  227. models/query.groups.groupList.json +6474 -0
  228. models/query.groups.whereUsed.json +697 -0
  229. models/query.hardware.json +27 -7
  230. models/query.hardwareManagement.json +8 -8
  231. models/query.licensing.json +3487 -1324
  232. models/query.policy.appTenantRestriction.policy.json +32 -32
  233. models/query.policy.dynamicIpAllocation.policy.json +18 -18
  234. models/query.policy.internetFirewall.policy.json +93 -93
  235. models/query.policy.remotePortFwd.policy.json +23 -23
  236. models/query.policy.socketLan.policy.json +88 -88
  237. models/query.policy.terminalServer.policy.json +13 -13
  238. models/query.policy.wanFirewall.policy.json +111 -111
  239. models/query.policy.wanNetwork.policy.json +97 -97
  240. models/query.popLocations.json +2878 -0
  241. models/query.sandbox.json +5 -5
  242. models/query.site.bgpPeer.json +4 -4
  243. models/query.site.bgpPeerList.json +10 -10
  244. models/query.site.secondaryAwsVSocket.json +340 -0
  245. models/query.site.secondaryAzureVSocket.json +319 -0
  246. models/query.site.siteBgpStatus.json +2 -2
  247. models/query.socketPortMetrics.json +2410 -0
  248. models/query.socketPortMetricsTimeSeries.json +2361 -0
  249. models/query.xdr.stories.json +104 -104
  250. models/query.xdr.story.json +93 -93
  251. schema/catolib.py +43 -16
  252. build/lib/catocli/Utils/clidriver.py +0 -268
  253. build/lib/catocli/Utils/profile_manager.py +0 -188
  254. build/lib/catocli/Utils/version_checker.py +0 -192
  255. build/lib/catocli/__init__.py +0 -2
  256. build/lib/catocli/__main__.py +0 -12
  257. build/lib/catocli/parsers/configure/__init__.py +0 -115
  258. build/lib/catocli/parsers/configure/configure.py +0 -307
  259. build/lib/catocli/parsers/custom/__init__.py +0 -57
  260. build/lib/catocli/parsers/custom/customLib.py +0 -561
  261. build/lib/catocli/parsers/custom/export_rules/__init__.py +0 -42
  262. build/lib/catocli/parsers/custom/export_rules/export_rules.py +0 -234
  263. build/lib/catocli/parsers/custom/export_sites/__init__.py +0 -21
  264. build/lib/catocli/parsers/custom/export_sites/export_sites.py +0 -372
  265. build/lib/catocli/parsers/custom/import_rules_to_tf/__init__.py +0 -58
  266. build/lib/catocli/parsers/custom/import_rules_to_tf/import_rules_to_tf.py +0 -451
  267. build/lib/catocli/parsers/custom/import_sites_to_tf/__init__.py +0 -45
  268. build/lib/catocli/parsers/custom/import_sites_to_tf/import_sites_to_tf.py +0 -891
  269. build/lib/catocli/parsers/mutation_accountManagement/__init__.py +0 -48
  270. build/lib/catocli/parsers/mutation_admin/__init__.py +0 -48
  271. build/lib/catocli/parsers/mutation_container/__init__.py +0 -138
  272. build/lib/catocli/parsers/mutation_hardware/__init__.py +0 -22
  273. build/lib/catocli/parsers/mutation_policy/__init__.py +0 -1305
  274. build/lib/catocli/parsers/mutation_sandbox/__init__.py +0 -35
  275. build/lib/catocli/parsers/mutation_site/__init__.py +0 -373
  276. build/lib/catocli/parsers/mutation_sites/__init__.py +0 -373
  277. build/lib/catocli/parsers/mutation_xdr/__init__.py +0 -48
  278. build/lib/catocli/parsers/parserApiClient.py +0 -513
  279. build/lib/catocli/parsers/query_accountBySubdomain/__init__.py +0 -16
  280. build/lib/catocli/parsers/query_accountManagement/__init__.py +0 -16
  281. build/lib/catocli/parsers/query_accountMetrics/__init__.py +0 -16
  282. build/lib/catocli/parsers/query_accountRoles/__init__.py +0 -16
  283. build/lib/catocli/parsers/query_accountSnapshot/__init__.py +0 -16
  284. build/lib/catocli/parsers/query_admin/__init__.py +0 -16
  285. build/lib/catocli/parsers/query_admins/__init__.py +0 -16
  286. build/lib/catocli/parsers/query_appStats/__init__.py +0 -16
  287. build/lib/catocli/parsers/query_appStatsTimeSeries/__init__.py +0 -16
  288. build/lib/catocli/parsers/query_auditFeed/__init__.py +0 -16
  289. build/lib/catocli/parsers/query_catalogs/__init__.py +0 -16
  290. build/lib/catocli/parsers/query_container/__init__.py +0 -16
  291. build/lib/catocli/parsers/query_devices/__init__.py +0 -16
  292. build/lib/catocli/parsers/query_entityLookup/__init__.py +0 -16
  293. build/lib/catocli/parsers/query_events/__init__.py +0 -16
  294. build/lib/catocli/parsers/query_eventsFeed/__init__.py +0 -16
  295. build/lib/catocli/parsers/query_eventsTimeSeries/__init__.py +0 -16
  296. build/lib/catocli/parsers/query_hardware/__init__.py +0 -16
  297. build/lib/catocli/parsers/query_hardwareManagement/__init__.py +0 -16
  298. build/lib/catocli/parsers/query_licensing/__init__.py +0 -16
  299. build/lib/catocli/parsers/query_policy/__init__.py +0 -161
  300. build/lib/catocli/parsers/query_sandbox/__init__.py +0 -16
  301. build/lib/catocli/parsers/query_site/__init__.py +0 -100
  302. build/lib/catocli/parsers/query_siteLocation/__init__.py +0 -13
  303. build/lib/catocli/parsers/query_subDomains/__init__.py +0 -16
  304. build/lib/catocli/parsers/query_xdr/__init__.py +0 -35
  305. build/lib/catocli/parsers/raw/__init__.py +0 -12
  306. build/lib/graphql_client/__init__.py +0 -11
  307. build/lib/graphql_client/api/__init__.py +0 -3
  308. build/lib/graphql_client/api/call_api.py +0 -84
  309. build/lib/graphql_client/api_client.py +0 -192
  310. build/lib/graphql_client/api_client_types.py +0 -409
  311. build/lib/graphql_client/configuration.py +0 -232
  312. build/lib/graphql_client/models/__init__.py +0 -13
  313. build/lib/graphql_client/models/no_schema.py +0 -71
  314. build/lib/schema/catolib.py +0 -1141
  315. build/lib/schema/importSchema.py +0 -60
  316. build/lib/schema/remove_policyid.py +0 -89
  317. build/lib/schema/remove_policyid_mutations.py +0 -89
  318. build/lib/scripts/catolib.py +0 -62
  319. build/lib/scripts/export_if_rules_to_json.py +0 -188
  320. build/lib/scripts/export_wf_rules_to_json.py +0 -111
  321. build/lib/scripts/import_wf_rules_to_tfstate.py +0 -331
  322. build/lib/vendor/certifi/__init__.py +0 -4
  323. build/lib/vendor/certifi/__main__.py +0 -12
  324. build/lib/vendor/certifi/core.py +0 -114
  325. build/lib/vendor/certifi/py.typed +0 -0
  326. build/lib/vendor/six.py +0 -998
  327. build/lib/vendor/urllib3/__init__.py +0 -211
  328. build/lib/vendor/urllib3/_base_connection.py +0 -172
  329. build/lib/vendor/urllib3/_collections.py +0 -483
  330. build/lib/vendor/urllib3/_request_methods.py +0 -278
  331. build/lib/vendor/urllib3/_version.py +0 -16
  332. build/lib/vendor/urllib3/connection.py +0 -1033
  333. build/lib/vendor/urllib3/connectionpool.py +0 -1182
  334. build/lib/vendor/urllib3/contrib/__init__.py +0 -0
  335. build/lib/vendor/urllib3/contrib/emscripten/__init__.py +0 -18
  336. build/lib/vendor/urllib3/contrib/emscripten/connection.py +0 -254
  337. build/lib/vendor/urllib3/contrib/emscripten/fetch.py +0 -418
  338. build/lib/vendor/urllib3/contrib/emscripten/request.py +0 -22
  339. build/lib/vendor/urllib3/contrib/emscripten/response.py +0 -285
  340. build/lib/vendor/urllib3/contrib/pyopenssl.py +0 -552
  341. build/lib/vendor/urllib3/contrib/socks.py +0 -228
  342. build/lib/vendor/urllib3/exceptions.py +0 -321
  343. build/lib/vendor/urllib3/fields.py +0 -341
  344. build/lib/vendor/urllib3/filepost.py +0 -89
  345. build/lib/vendor/urllib3/http2/__init__.py +0 -53
  346. build/lib/vendor/urllib3/http2/connection.py +0 -356
  347. build/lib/vendor/urllib3/http2/probe.py +0 -87
  348. build/lib/vendor/urllib3/poolmanager.py +0 -637
  349. build/lib/vendor/urllib3/py.typed +0 -2
  350. build/lib/vendor/urllib3/response.py +0 -1265
  351. build/lib/vendor/urllib3/util/__init__.py +0 -42
  352. build/lib/vendor/urllib3/util/connection.py +0 -137
  353. build/lib/vendor/urllib3/util/proxy.py +0 -43
  354. build/lib/vendor/urllib3/util/request.py +0 -256
  355. build/lib/vendor/urllib3/util/response.py +0 -101
  356. build/lib/vendor/urllib3/util/retry.py +0 -533
  357. build/lib/vendor/urllib3/util/ssl_.py +0 -513
  358. build/lib/vendor/urllib3/util/ssl_match_hostname.py +0 -159
  359. build/lib/vendor/urllib3/util/ssltransport.py +0 -276
  360. build/lib/vendor/urllib3/util/timeout.py +0 -275
  361. build/lib/vendor/urllib3/util/url.py +0 -471
  362. build/lib/vendor/urllib3/util/util.py +0 -42
  363. build/lib/vendor/urllib3/util/wait.py +0 -124
  364. {catocli-2.0.5.dist-info → catocli-2.1.1.dist-info}/entry_points.txt +0 -0
  365. {catocli-2.0.5.dist-info → catocli-2.1.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,11 +0,0 @@
1
- # coding: utf-8
2
-
3
- from __future__ import absolute_import
4
-
5
- # # import api into package
6
- from graphql_client.api.call_api import CallApi
7
-
8
- # import ApiClient
9
- from graphql_client.api_client_types import ApiClient
10
- from graphql_client.configuration import Configuration
11
- from graphql_client.models.no_schema import NoSchema
@@ -1,3 +0,0 @@
1
- from __future__ import absolute_import
2
-
3
- from graphql_client.api.call_api import CallApi
@@ -1,84 +0,0 @@
1
- # coding: utf-8
2
-
3
- from __future__ import absolute_import
4
- import re
5
- import json
6
-
7
- # python 2 and python 3 compatibility library
8
- import sys
9
- sys.path.insert(0, 'vendor')
10
- import six
11
- from graphql_client.api_client_types import ApiClient
12
-
13
- class CallApi(object):
14
- def __init__(self, api_client=None):
15
- if api_client is None:
16
- api_client = ApiClient()
17
- self.api_client = api_client
18
-
19
- def call_api(self, body, args, **kwargs): # noqa: E501
20
- (data) = self.call_api_with_http_info(body, args, **kwargs) # noqa: E501
21
- return data
22
-
23
- def call_api_with_http_info(self, body, args, **kwargs): # noqa: E501
24
- all_params = ['body', 'sync_type'] # noqa: E501
25
- all_params.append('async_req')
26
- if args.get("v")==True:
27
- all_params.append('_return_http_data_only')
28
- all_params.append('_preload_content')
29
- all_params.append('_request_timeout')
30
-
31
- params = locals()
32
- for key, val in six.iteritems(params['kwargs']):
33
- if key not in all_params:
34
- raise TypeError(
35
- "Got an unexpected keyword argument '%s'"
36
- " to method create_asset4" % key
37
- )
38
- params[key] = val
39
- del params['kwargs']
40
-
41
- if ('body' not in params or params['body'] is None):
42
- raise ValueError("Missing the required parameter `body` when calling `create_asset4`")
43
-
44
- collection_formats = {}
45
-
46
- header_params = {}
47
-
48
- form_params = []
49
- local_var_files = {}
50
-
51
- body_params = None
52
- if 'body' in params:
53
- body_params = params['body']
54
- header_params['Accept'] = self.api_client.select_header_accept(['application/json'])
55
- header_params['Content-Type'] = self.api_client.select_header_content_type(['application/json'])
56
- # Only add x-api-key if not using custom headers
57
- using_custom_headers = hasattr(self.api_client.configuration, 'custom_headers') and self.api_client.configuration.custom_headers
58
- if not using_custom_headers and 'x-api-key' in self.api_client.configuration.api_key:
59
- header_params['x-api-key'] = self.api_client.configuration.api_key['x-api-key']
60
- header_params['User-Agent'] = "Cato-CLI-v"+self.api_client.configuration.version
61
-
62
- # Add custom headers from configuration
63
- if using_custom_headers:
64
- header_params.update(self.api_client.configuration.custom_headers)
65
-
66
- if args.get("v")==True:
67
- print("Host: ",self.api_client.configuration.host)
68
- # Create a copy of header_params with masked API key for verbose output
69
- masked_headers = header_params.copy()
70
- if 'x-api-key' in masked_headers:
71
- masked_headers['x-api-key'] = '***MASKED***'
72
- print("Request Headers:",json.dumps(masked_headers,indent=4,sort_keys=True))
73
- print("Request Data:",json.dumps(body_params,indent=4,sort_keys=True),"\n\n")
74
-
75
- return self.api_client.call_api(
76
- header_params,
77
- body=body_params,
78
- files=local_var_files,
79
- response_type="NoSchema", # noqa: E501
80
- async_req=params.get('async_req'),
81
- _return_http_data_only=params.get('_return_http_data_only'),
82
- _preload_content=params.get('_preload_content', True),
83
- _request_timeout=params.get('_request_timeout'),
84
- collection_formats=collection_formats)
@@ -1,192 +0,0 @@
1
- # coding: utf-8
2
-
3
- from __future__ import absolute_import
4
-
5
- import io
6
- import json
7
- import logging
8
- import re
9
- import ssl
10
-
11
- # python 2 and python 3 compatibility library
12
- import sys
13
- sys.path.insert(0, 'vendor')
14
- import certifi
15
- import six
16
- from six.moves.urllib.parse import urlencode
17
-
18
- try:
19
- import urllib3
20
- except ImportError:
21
- raise ImportError('GraphQL python client requires urllib3.')
22
-
23
- logger = logging.getLogger(__name__)
24
-
25
- class QUERYResponse(io.IOBase):
26
-
27
- def __init__(self, resp):
28
- self.urllib3_response = resp
29
- self.status = resp.status
30
- self.reason = resp.reason
31
- self.data = resp.data
32
-
33
- def getheaders(self):
34
- """Returns a dictionary of the response headers."""
35
- return self.urllib3_response.getheaders()
36
-
37
- def getheader(self, name, default=None):
38
- """Returns a given response header."""
39
- return self.urllib3_response.getheader(name, default)
40
-
41
- class QUERYClientObject(object):
42
-
43
- def __init__(self, configuration, pools_size=4, maxsize=None):
44
- # urllib3.PoolManager will pass all kw parameters to connectionpool
45
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
46
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
47
- # maxsize is the number of requests to host that are allowed in parallel # noqa: E501
48
- # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
49
-
50
- # cert_reqs
51
- if configuration.verify_ssl:
52
- cert_reqs = ssl.CERT_REQUIRED
53
- else:
54
- cert_reqs = ssl.CERT_NONE
55
-
56
- # ca_certs
57
- if configuration.ssl_ca_cert:
58
- ca_certs = configuration.ssl_ca_cert
59
- else:
60
- # if not set certificate file, use Mozilla's root certificates.
61
- ca_certs = certifi.where()
62
-
63
- addition_pool_args = {}
64
- if configuration.assert_hostname is not None:
65
- addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
66
-
67
- if maxsize is None:
68
- if configuration.connection_pool_maxsize is not None:
69
- maxsize = configuration.connection_pool_maxsize
70
- else:
71
- maxsize = 4
72
-
73
- # https pool manager
74
- if configuration.proxy:
75
- self.pool_manager = urllib3.ProxyManager(
76
- num_pools=pools_size,
77
- maxsize=maxsize,
78
- cert_reqs=cert_reqs,
79
- ca_certs=ca_certs,
80
- cert_file=configuration.cert_file,
81
- key_file=configuration.key_file,
82
- proxy_url=configuration.proxy,
83
- **addition_pool_args
84
- )
85
- else:
86
- self.pool_manager = urllib3.PoolManager(
87
- num_pools=pools_size,
88
- maxsize=maxsize,
89
- cert_reqs=cert_reqs,
90
- ca_certs=ca_certs,
91
- cert_file=configuration.cert_file,
92
- key_file=configuration.key_file,
93
- **addition_pool_args
94
- )
95
-
96
- def request(self, method, url, headers=None,
97
- body=None, _preload_content=True,
98
- _request_timeout=None):
99
- """Perform requests.
100
- :param headers: http request headers
101
- :param body: request json body, for `application/json`
102
- :param _preload_content: if False, the urllib3.HTTPResponse object will
103
- be returned without reading/decoding response
104
- data. Default is True.
105
- :param _request_timeout: timeout setting for this request. If one
106
- number provided, it will be total request
107
- timeout. It can also be a pair (tuple) of
108
- (connection, read) timeouts.
109
- """
110
- method = method.upper()
111
- assert method in ['POST']
112
- headers = headers or {}
113
-
114
- timeout = None
115
- if _request_timeout:
116
- if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
117
- timeout = urllib3.Timeout(total=_request_timeout)
118
- elif (isinstance(_request_timeout, tuple) and
119
- len(_request_timeout) == 2):
120
- timeout = urllib3.Timeout(
121
- connect=_request_timeout[0], read=_request_timeout[1])
122
-
123
- if 'Content-Type' not in headers:
124
- headers['Content-Type'] = 'application/json'
125
-
126
- try:
127
- if re.search('json', headers['Content-Type'], re.IGNORECASE):
128
- try:
129
- r = self.pool_manager.request( method=method, url=url,
130
- body=json.dumps(body),
131
- preload_content=_preload_content,
132
- timeout=timeout,
133
- headers=headers)
134
- except Exception as e:
135
- # remove the restriction for raw
136
- print("ERROR: ",e)
137
- exit()
138
-
139
- else:
140
- # Cannot generate the request from given parameters
141
- msg = """Cannot prepare a request message for provided
142
- arguments. Please check that your arguments match
143
- declared content type."""
144
- raise ApiException(status=0, reason=msg)
145
-
146
- except urllib3.exceptions.SSLError as e:
147
- msg = "{0}\n{1}".format(type(e).__name__, str(e))
148
- raise ApiException(status=0, reason=msg)
149
-
150
- if _preload_content:
151
- r = QUERYResponse(r)
152
-
153
- # log response body
154
- logger.debug("response body: %s", r.data)
155
-
156
- if not 200 <= r.status <= 299:
157
- raise ApiException(http_resp=r)
158
-
159
- return r
160
-
161
- def POST(self, url, headers=None, body=None, _preload_content=True, _request_timeout=None):
162
- return self.request("POST", url, headers=headers,
163
- _preload_content=_preload_content,
164
- _request_timeout=_request_timeout,
165
- body=body)
166
-
167
- class ApiException(Exception):
168
-
169
- def __init__(self, status=None, reason=None, http_resp=None):
170
- if http_resp:
171
- self.status = http_resp.status
172
- self.reason = http_resp.reason
173
- self.body = http_resp.data
174
- self.headers = http_resp.getheaders()
175
- else:
176
- self.status = status
177
- self.reason = reason
178
- self.body = None
179
- self.headers = None
180
-
181
- def __str__(self):
182
- """Custom error messages for exception"""
183
- if self.body:
184
- # error_message += "HTTP response body:\n{}".format(self.body.decode('utf8'))
185
- return self.body.decode('utf8')
186
- else:
187
- error_message = "({0})\n"\
188
- "Reason: {1}\n".format(self.status, self.reason)
189
- if self.headers:
190
- error_message += "HTTP response headers: {0}\n".format(
191
- self.headers)
192
-
@@ -1,409 +0,0 @@
1
- # coding: utf-8
2
-
3
- from __future__ import absolute_import
4
-
5
- import datetime
6
- import json
7
- import mimetypes
8
- from multiprocessing.pool import ThreadPool
9
- import os
10
- import re
11
- import tempfile
12
-
13
- from graphql_client.configuration import Configuration
14
- import graphql_client.models
15
- from graphql_client import api_client
16
-
17
- # python 2 and python 3 compatibility library
18
- import sys
19
- sys.path.insert(0, 'vendor')
20
- import six
21
-
22
- class ApiClient(object):
23
- PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
24
- NATIVE_TYPES_MAPPING = {
25
- 'int': int,
26
- 'long': int if six.PY3 else long,
27
- 'float': float,
28
- 'str': str,
29
- 'bool': bool,
30
- 'date': datetime.date,
31
- 'datetime': datetime.datetime,
32
- 'object': object,
33
- }
34
-
35
- def __init__(self, configuration=None, header_name=None, header_value=None,
36
- cookie=None):
37
- if configuration is None:
38
- configuration = Configuration()
39
- self.configuration = configuration
40
-
41
- self.pool = ThreadPool()
42
- self.rest_client = api_client.QUERYClientObject(configuration)
43
- self.default_headers = {}
44
- if header_name is not None:
45
- self.default_headers[header_name] = header_value
46
- self.cookie = cookie
47
- self.user_agent = "Cato-CLI-v"+self.configuration.version
48
-
49
- def __del__(self):
50
- self.pool.close()
51
- self.pool.join()
52
-
53
- @property
54
- def user_agent(self):
55
- """User agent for this API client"""
56
- return self.default_headers['User-Agent']
57
-
58
- @user_agent.setter
59
- def user_agent(self, value):
60
- self.default_headers['User-Agent'] = value
61
-
62
- def set_default_header(self, header_name, header_value):
63
- self.default_headers[header_name] = header_value
64
-
65
- def __call_api(
66
- self, header_params=None, body=None,
67
- files=None, response_type=None,
68
- _return_http_data_only=None, collection_formats=None,
69
- _preload_content=True, _request_timeout=None):
70
-
71
- config = self.configuration
72
-
73
- # header parameters
74
- header_params = header_params or {}
75
- header_params.update(self.default_headers)
76
- if self.cookie:
77
- header_params['Cookie'] = self.cookie
78
- if header_params:
79
- header_params = self.sanitize_for_serialization(header_params)
80
- header_params = dict(self.parameters_to_tuples(header_params,
81
- collection_formats))
82
-
83
- # body
84
- if body:
85
- body = self.sanitize_for_serialization(body)
86
-
87
- # request url
88
- url = self.configuration.host
89
-
90
- # perform request and return response
91
- response_data = self.request(
92
- url, headers=header_params, body=body,
93
- _preload_content=_preload_content,
94
- _request_timeout=_request_timeout)
95
-
96
- self.last_response = response_data
97
-
98
- return_data = response_data
99
- if _preload_content:
100
- # deserialize response data
101
- if response_type:
102
- return_data = self.deserialize(response_data, response_type)
103
- else:
104
- return_data = None
105
-
106
- # Temporarily commented out to allow custom error handling
107
- # if "errors" in return_data:
108
- # print(json.dumps(return_data))
109
- # exit(1)
110
-
111
- if _return_http_data_only:
112
- return (return_data)
113
- else:
114
- return (return_data, response_data.status,
115
- response_data.getheaders())
116
-
117
- def sanitize_for_serialization(self, obj):
118
- """Builds a JSON POST object.
119
- If obj is None, return None.
120
- If obj is str, int, long, float, bool, return directly.
121
- If obj is datetime.datetime, datetime.date
122
- convert to string in iso8601 format.
123
- If obj is list, sanitize each element in the list.
124
- If obj is dict, return the dict.
125
- :param obj: The data to serialize.
126
- :return: The serialized form of data.
127
- """
128
- if obj is None:
129
- return None
130
- elif isinstance(obj, self.PRIMITIVE_TYPES):
131
- return obj
132
- elif isinstance(obj, list):
133
- return [self.sanitize_for_serialization(sub_obj)
134
- for sub_obj in obj]
135
- elif isinstance(obj, tuple):
136
- return tuple(self.sanitize_for_serialization(sub_obj)
137
- for sub_obj in obj)
138
- elif isinstance(obj, (datetime.datetime, datetime.date)):
139
- return obj.isoformat()
140
-
141
- if isinstance(obj, dict):
142
- obj_dict = obj
143
- else:
144
- obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
145
- for attr, _ in six.iteritems(obj.swagger_types)
146
- if getattr(obj, attr) is not None}
147
-
148
- return {key: self.sanitize_for_serialization(val)
149
- for key, val in six.iteritems(obj_dict)}
150
-
151
- def deserialize(self, response, response_type):
152
- # handle file downloading
153
- # save response body into a tmp file and return the instance
154
- if response_type == "file":
155
- return self.__deserialize_file(response)
156
-
157
- # fetch data from response object
158
- try:
159
- data = json.loads(response.data)
160
- except ValueError:
161
- data = response.data
162
-
163
- return self.__deserialize(data, response_type)
164
-
165
- def __deserialize(self, data, klass):
166
- if data is None:
167
- return None
168
-
169
- if type(klass) == str:
170
- if klass.startswith('list['):
171
- sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
172
- return [self.__deserialize(sub_data, sub_kls)
173
- for sub_data in data]
174
-
175
- if klass.startswith('dict('):
176
- sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
177
- return {k: self.__deserialize(v, sub_kls)
178
- for k, v in six.iteritems(data)}
179
-
180
- # convert str to class
181
- if klass in self.NATIVE_TYPES_MAPPING:
182
- klass = self.NATIVE_TYPES_MAPPING[klass]
183
- else:
184
- klass = getattr(graphql_client.models, klass)
185
-
186
- if klass in self.PRIMITIVE_TYPES:
187
- return self.__deserialize_primitive(data, klass)
188
- elif klass == object:
189
- return self.__deserialize_object(data)
190
- elif klass == datetime.date:
191
- return self.__deserialize_date(data)
192
- elif klass == datetime.datetime:
193
- return self.__deserialize_datatime(data)
194
- else:
195
- return self.__deserialize_model(data, klass)
196
-
197
- def call_api(self, header_params=None, body=None, files=None,
198
- response_type=None, async_req=None,
199
- _return_http_data_only=None, collection_formats=None,
200
- _preload_content=True, _request_timeout=None):
201
-
202
- if not async_req:
203
- return self.__call_api( header_params, body, files,
204
- response_type, _return_http_data_only, collection_formats,
205
- _preload_content, _request_timeout)
206
- else:
207
- thread = self.pool.apply_async(self.__call_api, ( header_params,
208
- body, files, response_type,
209
- _return_http_data_only,
210
- collection_formats,
211
- _preload_content, _request_timeout))
212
- return thread
213
-
214
- def request(self, url, headers=None,
215
- body=None, _preload_content=True,
216
- _request_timeout=None):
217
-
218
- return self.rest_client.POST(url, headers=headers,
219
- _preload_content=_preload_content,
220
- _request_timeout=_request_timeout,
221
- body=body)
222
-
223
- def parameters_to_tuples(self, params, collection_formats):
224
- """Get parameters as list of tuples, formatting collections.
225
-
226
- :param params: Parameters as dict or list of two-tuples
227
- :param dict collection_formats: Parameter collection formats
228
- :return: Parameters as list of tuples, collections formatted
229
- """
230
- new_params = []
231
- if collection_formats is None:
232
- collection_formats = {}
233
- for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
234
- if k in collection_formats:
235
- collection_format = collection_formats[k]
236
- if collection_format == 'multi':
237
- new_params.extend((k, value) for value in v)
238
- else:
239
- if collection_format == 'ssv':
240
- delimiter = ' '
241
- elif collection_format == 'tsv':
242
- delimiter = '\t'
243
- elif collection_format == 'pipes':
244
- delimiter = '|'
245
- else: # csv is the default
246
- delimiter = ','
247
- new_params.append(
248
- (k, delimiter.join(str(value) for value in v)))
249
- else:
250
- new_params.append((k, v))
251
- return new_params
252
-
253
- def select_header_accept(self, accepts):
254
- """Returns `Accept` based on an array of accepts provided.
255
-
256
- :param accepts: List of headers.
257
- :return: Accept (e.g. application/json).
258
- """
259
- if not accepts:
260
- return
261
-
262
- accepts = [x.lower() for x in accepts]
263
-
264
- if 'application/json' in accepts:
265
- return 'application/json'
266
- else:
267
- return ', '.join(accepts)
268
-
269
- def select_header_content_type(self, content_types):
270
- """Returns `Content-Type` based on an array of content_types provided.
271
-
272
- :param content_types: List of content-types.
273
- :return: Content-Type (e.g. application/json).
274
- """
275
- if not content_types:
276
- return 'application/json'
277
-
278
- content_types = [x.lower() for x in content_types]
279
-
280
- if 'application/json' in content_types or '*/*' in content_types:
281
- return 'application/json'
282
- else:
283
- return content_types[0]
284
-
285
- def __deserialize_file(self, response):
286
- """Deserializes body to file
287
-
288
- Saves response body into a file in a temporary folder,
289
- using the filename from the `Content-Disposition` header if provided.
290
-
291
- :param response: RESTResponse.
292
- :return: file path.
293
- """
294
- fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
295
- os.close(fd)
296
- os.remove(path)
297
-
298
- content_disposition = response.getheader("Content-Disposition")
299
- if content_disposition:
300
- filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
301
- content_disposition).group(1)
302
- path = os.path.join(os.path.dirname(path), filename)
303
- response_data = response.data
304
- with open(path, "wb") as f:
305
- if isinstance(response_data, str):
306
- # change str to bytes so we can write it
307
- response_data = response_data.encode('utf-8')
308
- f.write(response_data)
309
- else:
310
- f.write(response_data)
311
- return path
312
-
313
- def __deserialize_primitive(self, data, klass):
314
- """Deserializes string to primitive type.
315
-
316
- :param data: str.
317
- :param klass: class literal.
318
-
319
- :return: int, long, float, str, bool.
320
- """
321
- try:
322
- return klass(data)
323
- except UnicodeEncodeError:
324
- return six.text_type(data)
325
- except TypeError:
326
- return data
327
-
328
- def __deserialize_object(self, value):
329
- """Return a original value.
330
-
331
- :return: object.
332
- """
333
- return value
334
-
335
- def __deserialize_date(self, string):
336
- """Deserializes string to date.
337
-
338
- :param string: str.
339
- :return: date.
340
- """
341
- try:
342
- from dateutil.parser import parse
343
- return parse(string).date()
344
- except ImportError:
345
- return string
346
- except ValueError:
347
- raise apiclient.ApiException(
348
- status=0,
349
- reason="Failed to parse `{0}` as date object".format(string)
350
- )
351
-
352
- def __deserialize_datatime(self, string):
353
- """Deserializes string to datetime.
354
-
355
- The string should be in iso8601 datetime format.
356
-
357
- :param string: str.
358
- :return: datetime.
359
- """
360
- try:
361
- from dateutil.parser import parse
362
- return parse(string)
363
- except ImportError:
364
- return string
365
- except ValueError:
366
- raise apiclient.ApiException(
367
- status=0,
368
- reason=(
369
- "Failed to parse `{0}` as datetime object"
370
- .format(string)
371
- )
372
- )
373
-
374
- def __hasattr(self, object, name):
375
- return name in object.__class__.__dict__
376
-
377
- def __deserialize_model(self, data, klass):
378
- """Deserializes list or dict to model.
379
-
380
- :param data: dict, list.
381
- :param klass: class literal.
382
- :return: model object.
383
- """
384
-
385
- if not klass.swagger_types and not self.__hasattr(klass, 'get_real_child_model'):
386
- return data
387
-
388
- kwargs = {}
389
- if klass.swagger_types is not None:
390
- for attr, attr_type in six.iteritems(klass.swagger_types):
391
- if (data is not None and
392
- klass.attribute_map[attr] in data and
393
- isinstance(data, (list, dict))):
394
- value = data[klass.attribute_map[attr]]
395
- kwargs[attr] = self.__deserialize(value, attr_type)
396
-
397
- instance = klass(**kwargs)
398
-
399
- if (isinstance(instance, dict) and
400
- klass.swagger_types is not None and
401
- isinstance(data, dict)):
402
- for key, value in data.items():
403
- if key not in klass.swagger_types:
404
- instance[key] = value
405
- if self.__hasattr(instance, 'get_real_child_model'):
406
- klass_name = instance.get_real_child_model(data)
407
- if klass_name:
408
- instance = self.__deserialize(data, klass_name)
409
- return instance