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
@@ -0,0 +1,17 @@
1
+
2
+ ## CATO-CLI - mutation.sites.updateSiteBwLicense:
3
+ [Click here](https://api.catonetworks.com/documentation/#mutation-updateSiteBwLicense) for documentation on this operation.
4
+
5
+ ### Usage for mutation.sites.updateSiteBwLicense:
6
+
7
+ `catocli mutation sites updateSiteBwLicense -h`
8
+
9
+ `catocli mutation sites updateSiteBwLicense <json>`
10
+
11
+ `catocli mutation sites updateSiteBwLicense "$(cat < updateSiteBwLicense.json)"`
12
+
13
+ `catocli mutation sites updateSiteBwLicense '{"updateSiteBwLicenseInput": {"bw": {"bw": "Int"}, "licenseId": {"licenseId": "ID"}, "siteRefInput": {"by": {"by": "enum(ObjectRefBy)"}, "input": {"input": "String"}}}}'`
14
+
15
+ #### Operation Arguments for mutation.sites.updateSiteBwLicense ####
16
+ `accountId` [ID] - (required) N/A
17
+ `updateSiteBwLicenseInput` [UpdateSiteBwLicenseInput] - (required) N/A
@@ -10,7 +10,7 @@
10
10
 
11
11
  `catocli mutation sites updateSiteGeneralDetails "$(cat < updateSiteGeneralDetails.json)"`
12
12
 
13
- `catocli mutation sites updateSiteGeneralDetails '{"siteId": "ID", "updateSiteGeneralDetailsInput": {"description": {"description": "String"}, "name": {"name": "String"}, "siteType": {"siteType": "enum(SiteType)"}, "updateSiteLocationInput": {"address": {"address": "String"}, "cityName": {"cityName": "String"}, "countryCode": {"countryCode": "String"}, "stateCode": {"stateCode": "String"}, "timezone": {"timezone": "String"}}}}'`
13
+ `catocli mutation sites updateSiteGeneralDetails '{"siteId": "ID", "updateSiteGeneralDetailsInput": {"description": {"description": "String"}, "name": {"name": "String"}, "siteType": {"siteType": "enum(SiteType)"}, "updateSiteLocationInput": {"address": {"address": "String"}, "cityName": {"cityName": "String"}, "countryCode": {"countryCode": "String"}, "stateCode": {"stateCode": "String"}, "timezone": {"timezone": "String"}}, "updateSitePreferredPopLocationInput": {"preferredOnly": {"preferredOnly": "Boolean"}, "primary": {"by": {"by": "enum(ObjectRefBy)"}, "input": {"input": "String"}}, "secondary": {"by": {"by": "enum(ObjectRefBy)"}, "input": {"input": "String"}}}}}'`
14
14
 
15
15
  #### Operation Arguments for mutation.sites.updateSiteGeneralDetails ####
16
16
  `accountId` [ID] - (required) N/A
@@ -7,6 +7,7 @@ from graphql_client.api_client import ApiException
7
7
  import logging
8
8
  import pprint
9
9
  import uuid
10
+ import string
10
11
  from urllib3.filepost import encode_multipart_formdata
11
12
 
12
13
  def createRequest(args, configuration):
@@ -24,7 +25,12 @@ def createRequest(args, configuration):
24
25
  elif not params["t"] and params["json"] is None:
25
26
  # Default to empty object if no json provided and not using -t flag
26
27
  variablesObj = {}
27
- if "accountId" in operation["args"]:
28
+ # Special handling for eventsFeed and auditFeed which use accountIDs array
29
+ if operationName in ["query.eventsFeed", "query.auditFeed"]:
30
+ # Only add accountIDs if not already provided in JSON
31
+ if "accountIDs" not in variablesObj:
32
+ variablesObj["accountIDs"] = [configuration.accountID]
33
+ elif "accountId" in operation["args"]:
28
34
  variablesObj["accountId"] = configuration.accountID
29
35
  else:
30
36
  variablesObj["accountID"] = configuration.accountID
@@ -236,16 +242,17 @@ def validateArgs(variablesObj,operation):
236
242
 
237
243
  def loadJSON(file):
238
244
  CONFIG = {}
239
- module_dir_ary = os.path.dirname(__file__).split("/")
240
- del module_dir_ary[-1]
241
- del module_dir_ary[-1]
242
- module_dir = "/".join(module_dir_ary)
245
+ module_dir = os.path.dirname(__file__)
246
+ # Navigate up two directory levels (from parsers/ to catocli/ to root)
247
+ module_dir = os.path.dirname(module_dir) # Go up from parsers/
248
+ module_dir = os.path.dirname(module_dir) # Go up from catocli/
243
249
  try:
244
- with open(module_dir+'/'+file, 'r') as data:
250
+ file_path = os.path.join(module_dir, file)
251
+ with open(file_path, 'r') as data:
245
252
  CONFIG = json.load(data)
246
253
  return CONFIG
247
254
  except:
248
- logging.warning("File \""+module_dir+'/'+file+"\" not found.")
255
+ logging.warning(f"File \"{os.path.join(module_dir, file)}\" not found.")
249
256
  exit()
250
257
 
251
258
  def renderCamelCase(pathStr):
@@ -291,7 +298,8 @@ def renderArgsAndFields(responseArgStr, variablesObj, curOperation, definition,
291
298
  responseArgStr += " {\n"
292
299
  for subfieldIndex in field['type']['definition']['fields']:
293
300
  subfield = field['type']['definition']['fields'][subfieldIndex]
294
- subfield_name = subfield['alias'] if 'alias' in subfield else subfield['name']
301
+ # Use the alias if it exists, otherwise use the field name
302
+ subfield_name = subfield['alias'] if 'alias' in subfield else subfield['name']
295
303
  responseArgStr += indent + " " + subfield_name
296
304
  if subfield.get("args") and len(list(subfield["args"].keys()))>0:
297
305
  argsPresent = False
@@ -338,7 +346,14 @@ def renderArgsAndFields(responseArgStr, variablesObj, curOperation, definition,
338
346
  responseArgStr += " {\n"
339
347
  for subfieldName in field['type']['definition'].get('inputFields'):
340
348
  subfield = field['type']['definition']['inputFields'][subfieldName]
341
- subfield_name = subfield['alias'] if 'alias' in subfield else subfield['name']
349
+ # Updated aliasing logic for inputFields
350
+ if (subfield.get('type') and subfield['type'].get('name') and
351
+ curOperation.get('fieldTypes', {}).get(subfield['type']['name']) and
352
+ subfield.get('type', {}).get('kind') and
353
+ 'SCALAR' not in str(subfield['type']['kind'])):
354
+ subfield_name = f"{subfield['name']}{field['type']['definition']['name']}: {subfield['name']}"
355
+ else:
356
+ subfield_name = subfield['name'] # Always use the raw field name, not incorrect aliases
342
357
  responseArgStr += indent + " " + subfield_name
343
358
  if subfield.get('type') and subfield['type'].get('definition') and (subfield['type']['definition'].get('fields') or subfield['type']['definition'].get('inputFields')):
344
359
  responseArgStr += " {\n"
@@ -429,6 +444,339 @@ def createRawBinaryRequest(args, configuration):
429
444
  print(f"ERROR: Failed to send multipart request: {error_str}")
430
445
  return None
431
446
 
447
+ def get_private_help(command_name, command_config):
448
+ """Generate comprehensive help text for a private command"""
449
+ usage = f"catocli private {command_name}"
450
+
451
+ # Create comprehensive JSON example with all arguments (excluding accountId)
452
+ if 'arguments' in command_config:
453
+ json_example = {}
454
+ for arg in command_config['arguments']:
455
+ arg_name = arg.get('name')
456
+ # Skip accountId since it's handled by standard -accountID CLI argument
457
+ if arg_name and arg_name.lower() != 'accountid':
458
+ if 'example' in arg:
459
+ # Use explicit example if provided
460
+ json_example[arg_name] = arg['example']
461
+ elif 'default' in arg:
462
+ # Use default value if available
463
+ json_example[arg_name] = arg['default']
464
+ else:
465
+ # Generate placeholder based on type
466
+ arg_type = arg.get('type', 'string')
467
+ if arg_type == 'string':
468
+ json_example[arg_name] = f"<{arg_name}>"
469
+ elif arg_type == 'object':
470
+ if 'struct' in arg:
471
+ # Use struct definition
472
+ json_example[arg_name] = arg['struct']
473
+ else:
474
+ json_example[arg_name] = {}
475
+ else:
476
+ json_example[arg_name] = f"<{arg_name}>"
477
+
478
+ if json_example:
479
+ # Format JSON nicely for readability in help
480
+ json_str = json.dumps(json_example, indent=2)
481
+ usage += f" '{json_str}'"
482
+
483
+ # Add common options
484
+ usage += " [-t] [-v] [-p]"
485
+
486
+ # Add command-specific arguments with descriptions (excluding accountId)
487
+ if 'arguments' in command_config:
488
+ filtered_args = [arg for arg in command_config['arguments'] if arg.get('name', '').lower() != 'accountid']
489
+ if filtered_args:
490
+ usage += "\n\nArguments:"
491
+ for arg in filtered_args:
492
+ arg_name = arg.get('name')
493
+ arg_type = arg.get('type', 'string')
494
+ arg_default = arg.get('default')
495
+ arg_example = arg.get('example')
496
+
497
+ if arg_name:
498
+ usage += f"\n --{arg_name}: {arg_type}"
499
+ if arg_default is not None:
500
+ usage += f" (default: {arg_default})"
501
+ if arg_example is not None and arg_example != arg_default:
502
+ usage += f" (example: {json.dumps(arg_example) if isinstance(arg_example, (dict, list)) else arg_example})"
503
+
504
+ # Add standard accountID information
505
+ usage += "\n\nStandard Arguments:"
506
+ usage += "\n -accountID: Account ID (taken from profile, can be overridden)"
507
+
508
+ # Add payload file info if available
509
+ if 'payloadFilePath' in command_config:
510
+ usage += f"\n\nPayload template: {command_config['payloadFilePath']}"
511
+
512
+ # Add batch processing info if configured
513
+ if 'batchSize' in command_config:
514
+ usage += f"\nBatch size: {command_config['batchSize']}"
515
+ if 'paginationParam' in command_config:
516
+ usage += f" (pagination: {command_config['paginationParam']})"
517
+
518
+ return usage
519
+
520
+
521
+ def load_payload_template(command_config):
522
+ """Load and return the GraphQL payload template for a private command"""
523
+ try:
524
+ payload_path = command_config.get('payloadFilePath')
525
+ if not payload_path:
526
+ raise ValueError(f"Missing payloadFilePath in command configuration")
527
+
528
+ # Construct the full path relative to the settings directory
529
+ settings_dir = os.path.expanduser("~/.cato")
530
+ full_payload_path = os.path.join(settings_dir, payload_path)
531
+
532
+ # Load the payload file using the standard JSON loading mechanism
533
+ try:
534
+ with open(full_payload_path, 'r') as f:
535
+ return json.load(f)
536
+ except FileNotFoundError:
537
+ raise ValueError(f"Payload file not found: {full_payload_path}")
538
+ except json.JSONDecodeError as e:
539
+ raise ValueError(f"Invalid JSON in payload file {full_payload_path}: {e}")
540
+ except Exception as e:
541
+ raise ValueError(f"Failed to load payload template: {e}")
542
+
543
+
544
+ def set_nested_value(obj, path, value):
545
+ """Set a value at a nested path in an object using jQuery-style JSON path syntax
546
+
547
+ Supports:
548
+ - Simple dot notation: 'a.b.c'
549
+ - Array access: 'a.b[0].c' or 'a.b[0]'
550
+ - Mixed paths: 'variables.filters[0].search'
551
+ - Deep nesting: 'data.results[0].items[1].properties.name'
552
+ """
553
+ import re
554
+
555
+ # Parse the path into components handling both dot notation and array indices
556
+ # Split by dots first, then handle array indices
557
+ path_parts = []
558
+ for part in path.split('.'):
559
+ # Check if this part contains array notation like 'items[0]'
560
+ array_matches = re.findall(r'([^\[]+)(?:\[(\d+)\])?', part)
561
+ for match in array_matches:
562
+ key, index = match
563
+ if key: # Add the key part
564
+ path_parts.append(key)
565
+ if index: # Add the array index part
566
+ path_parts.append(int(index))
567
+
568
+ current = obj
569
+
570
+ # Navigate to the parent of the target location
571
+ for i, part in enumerate(path_parts[:-1]):
572
+ next_part = path_parts[i + 1]
573
+
574
+ if isinstance(part, int):
575
+ # Current part is an array index
576
+ if not isinstance(current, list):
577
+ raise ValueError(f"Expected array at path component {i}, got {type(current).__name__}")
578
+
579
+ # Extend array if necessary
580
+ while len(current) <= part:
581
+ current.append(None)
582
+
583
+ # Initialize the array element if it doesn't exist
584
+ if current[part] is None:
585
+ if isinstance(next_part, int):
586
+ current[part] = [] # Next part is array index, so create array
587
+ else:
588
+ current[part] = {} # Next part is object key, so create object
589
+
590
+ current = current[part]
591
+
592
+ else:
593
+ # Current part is an object key
594
+ if not isinstance(current, dict):
595
+ raise ValueError(f"Expected object at path component {i}, got {type(current).__name__}")
596
+
597
+ # Create the key if it doesn't exist
598
+ if part not in current:
599
+ if isinstance(next_part, int):
600
+ current[part] = [] # Next part is array index, so create array
601
+ else:
602
+ current[part] = {} # Next part is object key, so create object
603
+
604
+ current = current[part]
605
+
606
+ # Set the final value
607
+ final_part = path_parts[-1]
608
+ if isinstance(final_part, int):
609
+ # Final part is an array index
610
+ if not isinstance(current, list):
611
+ raise ValueError(f"Expected array at final path component, got {type(current).__name__}")
612
+
613
+ # Extend array if necessary
614
+ while len(current) <= final_part:
615
+ current.append(None)
616
+
617
+ current[final_part] = value
618
+ else:
619
+ # Final part is an object key
620
+ if not isinstance(current, dict):
621
+ raise ValueError(f"Expected object at final path component, got {type(current).__name__}")
622
+
623
+ current[final_part] = value
624
+
625
+
626
+ def apply_template_variables(template, variables, private_config):
627
+ """Apply variables to the template using path-based insertion and template replacement"""
628
+ if not template or not isinstance(template, dict):
629
+ return template
630
+
631
+ # Make a deep copy to avoid modifying the original
632
+ import copy
633
+ result = copy.deepcopy(template)
634
+
635
+ # First, handle path-based variable insertion from private_config
636
+ if private_config and 'arguments' in private_config:
637
+ for arg in private_config['arguments']:
638
+ arg_name = arg.get('name')
639
+ arg_paths = arg.get('path', [])
640
+
641
+ if arg_name and arg_name in variables and arg_paths:
642
+ # Insert the variable value at each specified path
643
+ for path in arg_paths:
644
+ try:
645
+ set_nested_value(result, path, variables[arg_name])
646
+ except Exception as e:
647
+ # If path insertion fails, continue to template replacement
648
+ pass
649
+
650
+ # Second, handle traditional template variable replacement as fallback
651
+ def traverse_and_replace(obj, path=""):
652
+ if isinstance(obj, dict):
653
+ for key, value in list(obj.items()):
654
+ new_path = f"{path}.{key}" if path else key
655
+
656
+ # Check if this is a template variable (string that starts with '{{')
657
+ if isinstance(value, str) and value.startswith('{{') and value.endswith('}}'):
658
+ # Extract variable name
659
+ var_name = value[2:-2].strip()
660
+
661
+ # Replace with actual value if available
662
+ if var_name in variables:
663
+ obj[key] = variables[var_name]
664
+
665
+ # Recursively process nested objects
666
+ else:
667
+ traverse_and_replace(value, new_path)
668
+
669
+ elif isinstance(obj, list):
670
+ for i, item in enumerate(obj):
671
+ traverse_and_replace(item, f"{path}[{i}]")
672
+
673
+ traverse_and_replace(result)
674
+ return result
675
+
676
+
677
+ def createPrivateRequest(args, configuration):
678
+ """Handle private command execution using GraphQL payload templates"""
679
+ params = vars(args)
680
+
681
+ # Get the private command configuration
682
+ private_command = params.get('private_command')
683
+ private_config = params.get('private_config')
684
+
685
+ if not private_command or not private_config:
686
+ print("ERROR: Missing private command configuration")
687
+ return None
688
+
689
+ # Load private settings and apply ONLY for private commands
690
+ try:
691
+ settings_file = os.path.expanduser("~/.cato/settings.json")
692
+ with open(settings_file, 'r') as f:
693
+ private_settings = json.load(f)
694
+ except (FileNotFoundError, json.JSONDecodeError):
695
+ private_settings = {}
696
+
697
+ # Override endpoint if specified in private settings
698
+ if 'baseUrl' in private_settings:
699
+ configuration.host = private_settings['baseUrl']
700
+
701
+ # Add custom headers from private settings
702
+ if 'headers' in private_settings and isinstance(private_settings['headers'], dict):
703
+ if not hasattr(configuration, 'custom_headers'):
704
+ configuration.custom_headers = {}
705
+ for key, value in private_settings['headers'].items():
706
+ configuration.custom_headers[key] = value
707
+
708
+ # Parse input JSON variables
709
+ try:
710
+ variables = json.loads(params.get('json', '{}'))
711
+ except ValueError as e:
712
+ print(f"ERROR: Invalid JSON input: {e}")
713
+ return None
714
+
715
+ # Apply default values from settings configuration first
716
+ for arg in private_config.get('arguments', []):
717
+ arg_name = arg.get('name')
718
+ if arg_name and 'default' in arg:
719
+ variables[arg_name] = arg['default']
720
+
721
+ # Apply profile account ID as fallback (lower priority than settings defaults)
722
+ # Only apply if accountId is not already set by settings defaults
723
+ if configuration and hasattr(configuration, 'accountID'):
724
+ if 'accountID' not in variables and 'accountId' not in variables:
725
+ # Use both naming conventions to support different payload templates
726
+ variables['accountID'] = configuration.accountID
727
+ variables['accountId'] = configuration.accountID
728
+ # If accountId/accountID exists but not the other variation, add both
729
+ elif 'accountID' in variables and 'accountId' not in variables:
730
+ variables['accountId'] = variables['accountID']
731
+ elif 'accountId' in variables and 'accountID' not in variables:
732
+ variables['accountID'] = variables['accountId']
733
+
734
+ # Apply CLI argument values (highest priority - overrides everything)
735
+ for arg in private_config.get('arguments', []):
736
+ arg_name = arg.get('name')
737
+ if arg_name:
738
+ # Handle special case for accountId - CLI uses -accountID but config uses accountId
739
+ if arg_name.lower() == 'accountid':
740
+ if hasattr(args, 'accountID') and getattr(args, 'accountID') is not None:
741
+ arg_value = getattr(args, 'accountID')
742
+ variables['accountID'] = arg_value
743
+ variables['accountId'] = arg_value
744
+ elif hasattr(args, 'accountId') and getattr(args, 'accountId') is not None:
745
+ arg_value = getattr(args, 'accountId')
746
+ variables['accountID'] = arg_value
747
+ variables['accountId'] = arg_value
748
+ # Handle other arguments normally
749
+ else:
750
+ if hasattr(args, arg_name):
751
+ arg_value = getattr(args, arg_name)
752
+ if arg_value is not None:
753
+ variables[arg_name] = arg_value
754
+
755
+ # Load the payload template
756
+ try:
757
+ payload_template = load_payload_template(private_config)
758
+ except ValueError as e:
759
+ print(f"ERROR: {e}")
760
+ return None
761
+
762
+ # Apply variables to the template using path-based insertion
763
+ body = apply_template_variables(payload_template, variables, private_config)
764
+
765
+ # Test mode - just print the request
766
+ if params.get('t'):
767
+ if params.get('p'):
768
+ print(json.dumps(body, indent=2, sort_keys=True))
769
+ else:
770
+ print(json.dumps(body))
771
+ return None
772
+
773
+ # Execute the GraphQL request using custom method (no User-Agent header)
774
+ try:
775
+ return sendPrivateGraphQLRequest(configuration, body, params)
776
+ except Exception as e:
777
+ return e
778
+
779
+
432
780
  def sendMultipartRequest(configuration, form_fields, files, params):
433
781
  """Send a multipart/form-data request directly using urllib3"""
434
782
  import urllib3
@@ -511,3 +859,90 @@ def sendMultipartRequest(configuration, form_fields, files, params):
511
859
  error_str = f"Exception of type {type(e).__name__}"
512
860
  print(f"ERROR: Network/request error: {error_str}")
513
861
  return None
862
+
863
+
864
+ def sendPrivateGraphQLRequest(configuration, body, params):
865
+ """Send a GraphQL request for private commands without User-Agent header"""
866
+ import urllib3
867
+
868
+ # Create pool manager
869
+ pool_manager = urllib3.PoolManager(
870
+ cert_reqs='CERT_NONE' if not getattr(configuration, 'verify_ssl', False) else 'CERT_REQUIRED'
871
+ )
872
+
873
+ # Prepare headers WITHOUT User-Agent
874
+ headers = {
875
+ 'Content-Type': 'application/json'
876
+ }
877
+
878
+ # Add API key if not using headers file or custom headers
879
+ using_custom_headers = hasattr(configuration, 'custom_headers') and configuration.custom_headers
880
+ if not using_custom_headers and hasattr(configuration, 'api_key') and configuration.api_key and 'x-api-key' in configuration.api_key:
881
+ headers['x-api-key'] = configuration.api_key['x-api-key']
882
+
883
+ # Add custom headers
884
+ if using_custom_headers:
885
+ headers.update(configuration.custom_headers)
886
+
887
+ # Encode headers to handle Unicode characters properly
888
+ encoded_headers = {}
889
+ for key, value in headers.items():
890
+ # Ensure header values are properly encoded as strings
891
+ if isinstance(value, str):
892
+ # Replace problematic Unicode characters that can't be encoded in latin-1
893
+ value = value.encode('utf-8', errors='replace').decode('latin-1', errors='replace')
894
+ encoded_headers[key] = value
895
+ headers = encoded_headers
896
+
897
+ # Verbose output
898
+ if params.get("v") == True:
899
+ print(f"Host: {getattr(configuration, 'host', 'unknown')}")
900
+ masked_headers = headers.copy()
901
+ if 'x-api-key' in masked_headers:
902
+ masked_headers['x-api-key'] = '***MASKED***'
903
+ # Also mask Cookie for privacy
904
+ if 'Cookie' in masked_headers:
905
+ masked_headers['Cookie'] = '***MASKED***'
906
+ print(f"Request Headers: {json.dumps(masked_headers, indent=4, sort_keys=True)}")
907
+ print(f"Request Data: {json.dumps(body, indent=4, sort_keys=True)}\n")
908
+
909
+ # Prepare request body
910
+ body_data = json.dumps(body).encode('utf-8')
911
+
912
+ try:
913
+ # Make the request
914
+ resp = pool_manager.request(
915
+ 'POST',
916
+ getattr(configuration, 'host', 'https://api.catonetworks.com/api/v1/graphql'),
917
+ body=body_data,
918
+ headers=headers
919
+ )
920
+
921
+ # Parse response
922
+ if resp.status < 200 or resp.status >= 300:
923
+ reason = resp.reason if resp.reason is not None else "Unknown Error"
924
+ error_msg = f"HTTP {resp.status}: {reason}"
925
+ if resp.data:
926
+ try:
927
+ error_msg += f"\n{resp.data.decode('utf-8')}"
928
+ except Exception:
929
+ error_msg += f"\n{resp.data}"
930
+ print(f"ERROR: {error_msg}")
931
+ return None
932
+
933
+ try:
934
+ response_data = json.loads(resp.data.decode('utf-8'))
935
+ except json.JSONDecodeError:
936
+ response_data = resp.data.decode('utf-8')
937
+
938
+ # Return in the same format as the regular API client
939
+ return [response_data]
940
+
941
+ except Exception as e:
942
+ # Safely handle exception string conversion
943
+ try:
944
+ error_str = str(e)
945
+ except Exception:
946
+ error_str = f"Exception of type {type(e).__name__}"
947
+ print(f"ERROR: Network/request error: {error_str}")
948
+ return None
@@ -15,5 +15,5 @@
15
15
  #### Operation Arguments for query.eventsFeed ####
16
16
  `accountIDs` [ID[]] - (optional) List of Unique Account Identifiers.
17
17
  `eventFeedFieldFilterInput` [EventFeedFieldFilterInput[]] - (optional) N/A
18
- `fieldNames` [EventFieldName[]] - (optional) N/A Default Value: ['access_method', 'account_id', 'action', 'actions_taken', 'ad_name', 'alert_id', 'always_on_configuration', 'analyst_verdict', 'api_name', 'api_type', 'app_activity', 'app_activity_category', 'app_activity_type', 'app_stack', 'application', 'application_id', 'application_name', 'application_risk', 'auth_method', 'authentication_type', 'bgp_cato_asn', 'bgp_cato_ip', 'bgp_error_code', 'bgp_peer_asn', 'bgp_peer_ip', 'bgp_route_cidr', 'bgp_suberror_code', 'bypass_duration_sec', 'bypass_method', 'bypass_reason', 'categories', 'cato_app', 'classification', 'client_cert_expires', 'client_cert_name', 'client_class', 'client_version', 'collaborator_name', 'collaborators', 'confidence_level', 'configured_host_name', 'congestion_algorithm', 'connect_on_boot', 'connection_origin', 'connector_name', 'connector_status', 'connector_type', 'container_name', 'correlation_id', 'criticality', 'custom_categories', 'custom_category', 'custom_category_id', 'custom_category_name', 'dest_country', 'dest_country_code', 'dest_group_id', 'dest_group_name', 'dest_ip', 'dest_is_site_or_vpn', 'dest_pid', 'dest_port', 'dest_process_cmdline', 'dest_process_parent_path', 'dest_process_parent_pid', 'dest_process_path', 'dest_site', 'dest_site_id', 'dest_site_name', 'detection_name', 'detection_stage', 'device_categories', 'device_certificate', 'device_id', 'device_manufacturer', 'device_model', 'device_name', 'device_os_type', 'device_posture_profile', 'device_posture_profiles', 'device_type', 'directory_host_name', 'directory_ip', 'directory_sync_result', 'directory_sync_type', 'disinfect_result', 'dlp_fail_mode', 'dlp_profiles', 'dlp_scan_types', 'dns_protection_category', 'dns_query', 'domain_name', 'egress_pop_name', 'egress_site_name', 'email_subject', 'endpoint_id', 'epp_engine_type', 'epp_profile', 'event_count', 'event_id', 'event_message', 'event_sub_type', 'event_type', 'failure_reason', 'file_hash', 'file_name', 'file_operation', 'file_size', 'file_type', 'final_object_status', 'flows_cardinality', 'full_path_url', 'guest_user', 'host_ip', 'host_mac', 'http_request_method', 'incident_aggregation', 'incident_id', 'indication', 'indicator', 'initial_object_status', 'internalId', 'ip_protocol', 'is_admin', 'is_admin_activity', 'is_compliant', 'is_managed', 'is_sanctioned_app', 'is_sinkhole', 'ISP_name', 'key_name', 'labels', 'link_health_is_congested', 'link_health_jitter', 'link_health_latency', 'link_health_pkt_loss', 'link_type', 'logged_in_user', 'login_type', 'matched_data_types', 'mitre_attack_subtechniques', 'mitre_attack_tactics', 'mitre_attack_techniques', 'network_access', 'network_rule', 'notification_api_error', 'notification_description', 'object_id', 'object_name', 'object_type', 'office_mode', 'os_type', 'os_version', 'out_of_band_access', 'owner', 'pac_file', 'parent_connector_name', 'pop_name', 'precedence', 'processes_count', 'producer', 'prompt_action', 'public_ip', 'qos_priority', 'qos_reported_time', 'quarantine_folder_path', 'quarantine_uuid', 'raw_data', 'recommended_actions', 'reference_url', 'referer_url', 'registration_code', 'risk_level', 'rule', 'rule_id', 'rule_name', 'severity', 'sharing_scope', 'sign_in_event_types', 'signature_id', 'socket_interface', 'socket_interface_id', 'socket_new_version', 'socket_old_version', 'socket_reset', 'socket_role', 'socket_serial', 'socket_version', 'split_tunnel_configuration', 'src_country', 'src_country_code', 'src_ip', 'src_is_site_or_vpn', 'src_isp_ip', 'src_or_dest_site_id', 'src_pid', 'src_port', 'src_process_cmdline', 'src_process_parent_path', 'src_process_parent_pid', 'src_process_path', 'src_site', 'src_site_id', 'src_site_name', 'static_host', 'status', 'story_id', 'subnet_name', 'targets_cardinality', 'tcp_acceleration', 'tenant_id', 'tenant_name', 'tenant_restriction_rule_name', 'threat_confidence', 'threat_name', 'threat_reference', 'threat_score', 'threat_type', 'threat_verdict', 'time', 'time_str', 'title', 'tls_certificate_error', 'tls_error_description', 'tls_error_type', 'tls_inspection', 'tls_rule_name', 'tls_version', 'traffic_direction', 'translated_client_ip', 'translated_server_ip', 'trigger', 'trust_type', 'trusted_networks', 'tunnel_ip_protocol', 'tunnel_protocol', 'upgrade_end_time', 'upgrade_initiated_by', 'upgrade_start_time', 'url', 'user_agent', 'user_awareness_method', 'user_id', 'user_name', 'user_reference_id', 'user_risk_level', 'vendor', 'vendor_collaborator_id', 'vendor_device_id', 'vendor_device_name', 'vendor_event_id', 'vendor_user_id', 'visible_device_id', 'vpn_lan_access', 'vpn_user_email', 'windows_domain_name', 'xff']
18
+ `fieldNames` [EventFieldName[]] - (optional) N/A Default Value: ['access_method', 'account_id', 'action', 'actions_taken', 'ad_name', 'alert_id', 'always_on_configuration', 'analyst_verdict', 'api_name', 'api_type', 'app_activity', 'app_activity_category', 'app_activity_type', 'app_stack', 'application_id', 'application_name', 'application_risk', 'auth_method', 'authentication_type', 'bgp_cato_asn', 'bgp_cato_ip', 'bgp_error_code', 'bgp_peer_asn', 'bgp_peer_ip', 'bgp_route_cidr', 'bgp_suberror_code', 'bypass_duration_sec', 'bypass_method', 'bypass_reason', 'categories', 'cato_app', 'classification', 'client_cert_expires', 'client_cert_name', 'client_class', 'client_version', 'collaborator_name', 'collaborators', 'confidence_level', 'configured_host_name', 'congestion_algorithm', 'connect_on_boot', 'connection_origin', 'connector_name', 'connector_status', 'connector_type', 'container_name', 'correlation_id', 'criticality', 'custom_category_id', 'custom_category_name', 'dest_country', 'dest_country_code', 'dest_group_id', 'dest_group_name', 'dest_ip', 'dest_is_site_or_vpn', 'dest_pid', 'dest_port', 'dest_process_cmdline', 'dest_process_parent_path', 'dest_process_parent_pid', 'dest_process_path', 'dest_site_id', 'dest_site_name', 'detection_name', 'detection_stage', 'device_categories', 'device_certificate', 'device_id', 'device_manufacturer', 'device_model', 'device_name', 'device_os_type', 'device_posture_profile', 'device_type', 'directory_host_name', 'directory_ip', 'directory_sync_result', 'directory_sync_type', 'disinfect_result', 'dlp_fail_mode', 'dlp_profiles', 'dlp_scan_types', 'dns_protection_category', 'dns_query', 'domain_name', 'egress_pop_name', 'egress_site_name', 'email_subject', 'endpoint_id', 'engine_type', 'epp_engine_type', 'epp_profile', 'event_count', 'event_id', 'event_message', 'event_sub_type', 'event_type', 'failure_reason', 'file_hash', 'file_name', 'file_operation', 'file_size', 'file_type', 'final_object_status', 'flows_cardinality', 'full_path_url', 'guest_user', 'host_ip', 'host_mac', 'http_request_method', 'incident_aggregation', 'incident_id', 'indication', 'indicator', 'initial_object_status', 'internalId', 'ip_protocol', 'is_admin', 'is_admin_activity', 'is_compliant', 'is_managed', 'is_sanctioned_app', 'is_sinkhole', 'ISP_name', 'key_name', 'labels', 'link_health_is_congested', 'link_health_jitter', 'link_health_latency', 'link_health_pkt_loss', 'link_type', 'logged_in_user', 'login_type', 'matched_data_types', 'mitre_attack_subtechniques', 'mitre_attack_tactics', 'mitre_attack_techniques', 'network_access', 'network_rule', 'notification_api_error', 'notification_description', 'object_id', 'object_name', 'object_type', 'office_mode', 'os_type', 'os_version', 'out_of_band_access', 'owner', 'pac_file', 'parent_connector_name', 'pop_name', 'precedence', 'processes_count', 'producer', 'projects', 'prompt_action', 'provider_name', 'public_ip', 'qos_priority', 'qos_reported_time', 'quarantine_folder_path', 'quarantine_uuid', 'raw_data', 'recommended_actions', 'reference_url', 'referer_url', 'region_name', 'registration_code', 'resource_id', 'risk_level', 'rule_id', 'rule_name', 'severity', 'sharing_scope', 'sign_in_event_types', 'signature_id', 'socket_interface', 'socket_interface_id', 'socket_new_version', 'socket_old_version', 'socket_reset', 'socket_role', 'socket_serial', 'socket_version', 'split_tunnel_configuration', 'src_country', 'src_country_code', 'src_ip', 'src_is_site_or_vpn', 'src_isp_ip', 'src_pid', 'src_port', 'src_process_cmdline', 'src_process_parent_path', 'src_process_parent_pid', 'src_process_path', 'src_site_id', 'src_site_name', 'static_host', 'status', 'story_id', 'subnet_name', 'subscription_name', 'targets_cardinality', 'tcp_acceleration', 'tenant_id', 'tenant_name', 'tenant_restriction_rule_name', 'threat_confidence', 'threat_name', 'threat_reference', 'threat_score', 'threat_type', 'threat_verdict', 'time', 'time_str', 'title', 'tls_certificate_error', 'tls_error_description', 'tls_error_type', 'tls_inspection', 'tls_rule_name', 'tls_version', 'traffic_direction', 'translated_client_ip', 'translated_server_ip', 'trigger', 'trust_type', 'trusted_networks', 'tunnel_ip_protocol', 'tunnel_protocol', 'upgrade_end_time', 'upgrade_initiated_by', 'upgrade_start_time', 'url', 'user_agent', 'user_awareness_method', 'user_id', 'user_name', 'user_reference_id', 'user_risk_level', 'vendor', 'vendor_collaborator_id', 'vendor_device_id', 'vendor_device_name', 'vendor_event_id', 'vendor_user_id', 'visible_device_id', 'vpn_lan_access', 'vpn_user_email', 'windows_domain_name', 'xff']
19
19
  `marker` [String] - (optional) Marker to use to get results from
@@ -0,0 +1,7 @@
1
+
2
+ ## CATO-CLI - query.groups:
3
+ [Click here](https://api.catonetworks.com/documentation/#query-groups) for documentation on this operation.
4
+
5
+ ### Usage for query.groups:
6
+
7
+ `catocli query groups -h`
@@ -0,0 +1,54 @@
1
+
2
+ from ..parserApiClient import createRequest, get_help
3
+
4
+ def query_groups_parse(query_subparsers):
5
+ query_groups_parser = query_subparsers.add_parser('groups',
6
+ help='groups() query operation',
7
+ usage=get_help("query_groups"))
8
+
9
+ query_groups_subparsers = query_groups_parser.add_subparsers()
10
+
11
+ query_groups_group_parser = query_groups_subparsers.add_parser('group',
12
+ help='group() groups operation',
13
+ usage=get_help("query_groups_group"))
14
+
15
+ query_groups_group_subparsers = query_groups_group_parser.add_subparsers()
16
+
17
+ query_groups_group_members_parser = query_groups_group_subparsers.add_parser('members',
18
+ help='members() group operation',
19
+ usage=get_help("query_groups_group_members"))
20
+
21
+ query_groups_group_members_parser.add_argument('json', nargs='?', default='{}', help='Variables in JSON format (defaults to empty object if not provided).')
22
+ query_groups_group_members_parser.add_argument('-accountID', help='Override the CATO_ACCOUNT_ID environment variable with this value.')
23
+ query_groups_group_members_parser.add_argument('-t', const=True, default=False, nargs='?', help='Print GraphQL query without sending API call')
24
+ query_groups_group_members_parser.add_argument('-v', const=True, default=False, nargs='?', help='Verbose output')
25
+ query_groups_group_members_parser.add_argument('-p', const=True, default=False, nargs='?', help='Pretty print')
26
+ query_groups_group_members_parser.add_argument('-H', '--header', action='append', dest='headers', help='Add custom headers in "Key: Value" format. Can be used multiple times.')
27
+ query_groups_group_members_parser.add_argument('--headers-file', dest='headers_file', help='Load headers from a file. Each line should contain a header in "Key: Value" format.')
28
+ query_groups_group_members_parser.set_defaults(func=createRequest,operation_name='query.groups.group.members')
29
+
30
+ query_groups_groupList_parser = query_groups_subparsers.add_parser('groupList',
31
+ help='groupList() groups operation',
32
+ usage=get_help("query_groups_groupList"))
33
+
34
+ query_groups_groupList_parser.add_argument('json', nargs='?', default='{}', help='Variables in JSON format (defaults to empty object if not provided).')
35
+ query_groups_groupList_parser.add_argument('-accountID', help='Override the CATO_ACCOUNT_ID environment variable with this value.')
36
+ query_groups_groupList_parser.add_argument('-t', const=True, default=False, nargs='?', help='Print GraphQL query without sending API call')
37
+ query_groups_groupList_parser.add_argument('-v', const=True, default=False, nargs='?', help='Verbose output')
38
+ query_groups_groupList_parser.add_argument('-p', const=True, default=False, nargs='?', help='Pretty print')
39
+ query_groups_groupList_parser.add_argument('-H', '--header', action='append', dest='headers', help='Add custom headers in "Key: Value" format. Can be used multiple times.')
40
+ query_groups_groupList_parser.add_argument('--headers-file', dest='headers_file', help='Load headers from a file. Each line should contain a header in "Key: Value" format.')
41
+ query_groups_groupList_parser.set_defaults(func=createRequest,operation_name='query.groups.groupList')
42
+
43
+ query_groups_whereUsed_parser = query_groups_subparsers.add_parser('whereUsed',
44
+ help='whereUsed() groups operation',
45
+ usage=get_help("query_groups_whereUsed"))
46
+
47
+ query_groups_whereUsed_parser.add_argument('json', nargs='?', default='{}', help='Variables in JSON format (defaults to empty object if not provided).')
48
+ query_groups_whereUsed_parser.add_argument('-accountID', help='Override the CATO_ACCOUNT_ID environment variable with this value.')
49
+ query_groups_whereUsed_parser.add_argument('-t', const=True, default=False, nargs='?', help='Print GraphQL query without sending API call')
50
+ query_groups_whereUsed_parser.add_argument('-v', const=True, default=False, nargs='?', help='Verbose output')
51
+ query_groups_whereUsed_parser.add_argument('-p', const=True, default=False, nargs='?', help='Pretty print')
52
+ query_groups_whereUsed_parser.add_argument('-H', '--header', action='append', dest='headers', help='Add custom headers in "Key: Value" format. Can be used multiple times.')
53
+ query_groups_whereUsed_parser.add_argument('--headers-file', dest='headers_file', help='Load headers from a file. Each line should contain a header in "Key: Value" format.')
54
+ query_groups_whereUsed_parser.set_defaults(func=createRequest,operation_name='query.groups.whereUsed')
@@ -0,0 +1,7 @@
1
+
2
+ ## CATO-CLI - query.groups.group:
3
+ [Click here](https://api.catonetworks.com/documentation/#query-group) for documentation on this operation.
4
+
5
+ ### Usage for query.groups.group:
6
+
7
+ `catocli query groups group -h`
@@ -0,0 +1,18 @@
1
+
2
+ ## CATO-CLI - query.groups.groupList:
3
+ [Click here](https://api.catonetworks.com/documentation/#query-groupList) for documentation on this operation.
4
+
5
+ ### Usage for query.groups.groupList:
6
+
7
+ `catocli query groups groupList -h`
8
+
9
+ `catocli query groups groupList <json>`
10
+
11
+ `catocli query groups groupList "$(cat < groupList.json)"`
12
+
13
+ `catocli query groups groupList '{"groupListInput": {"groupListFilterInput": {"audit": {"updatedBy": {"by": {"by": "enum(ObjectRefBy)"}, "input": {"input": "String"}}, "updatedTime": {"between": {"between": ["DateTime"]}, "eq": {"eq": "DateTime"}, "gt": {"gt": "DateTime"}, "gte": {"gte": "DateTime"}, "in": {"in": ["DateTime"]}, "lt": {"lt": "DateTime"}, "lte": {"lte": "DateTime"}, "neq": {"neq": "DateTime"}, "nin": {"nin": ["DateTime"]}}}, "freeText": {"search": {"search": "String"}}, "id": {"eq": {"eq": "ID"}, "in": {"in": ["ID"]}, "neq": {"neq": "ID"}, "nin": {"nin": ["ID"]}}, "member": {"ref": {"by": {"by": "enum(ObjectRefBy)"}, "input": {"input": "String"}, "type": {"type": "enum(GroupMemberRefType)"}}}, "name": {"eq": {"eq": "String"}, "in": {"in": ["String"]}, "neq": {"neq": "String"}, "nin": {"nin": ["String"]}, "regex": {"regex": "String"}}}, "groupListSortInput": {"audit": {"updatedBy": {"direction": {"direction": "enum(SortOrder)"}, "priority": {"priority": "Int"}}, "updatedTime": {"direction": {"direction": "enum(SortOrder)"}, "priority": {"priority": "Int"}}}, "name": {"direction": {"direction": "enum(SortOrder)"}, "priority": {"priority": "Int"}}}, "pagingInput": {"from": {"from": "Int"}, "limit": {"limit": "Int"}}}, "groupMembersListInput": {"groupMembersListFilterInput": {"name": {"eq": {"eq": "String"}, "in": {"in": ["String"]}, "neq": {"neq": "String"}, "nin": {"nin": ["String"]}, "regex": {"regex": "String"}}, "type": {"eq": {"eq": "enum(GroupMemberRefType)"}, "in": {"in": "enum(GroupMemberRefType)"}, "neq": {"neq": "enum(GroupMemberRefType)"}, "nin": {"nin": "enum(GroupMemberRefType)"}}}, "groupMembersListSortInput": {"name": {"direction": {"direction": "enum(SortOrder)"}, "priority": {"priority": "Int"}}, "type": {"direction": {"direction": "enum(SortOrder)"}, "priority": {"priority": "Int"}}}, "pagingInput": {"from": {"from": "Int"}, "limit": {"limit": "Int"}}}}'`
14
+
15
+ #### Operation Arguments for query.groups.groupList ####
16
+ `accountId` [ID] - (required) N/A
17
+ `groupListInput` [GroupListInput] - (optional) N/A
18
+ `groupMembersListInput` [GroupMembersListInput] - (required) N/A