zscaler-sdk-python 2.0.0__py3-none-any.whl → 2.0.0b2__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.
Files changed (434) hide show
  1. zscaler_sdk_python-2.0.0b2.dist-info/METADATA +928 -0
  2. zscaler_sdk_python-2.0.0b2.dist-info/RECORD +99 -0
  3. {zscaler_sdk_python-2.0.0.dist-info → zscaler_sdk_python-2.0.0b2.dist-info}/WHEEL +2 -1
  4. zscaler_sdk_python-2.0.0b2.dist-info/top_level.txt +1 -0
  5. zssdk/__init__.py +55 -0
  6. zscaler/zwa/zwa_service.py → zssdk/__version__.py +1 -25
  7. zssdk/session.py +267 -0
  8. zssdk/session.pyi +59 -0
  9. zssdk/zscore/__init__.py +98 -0
  10. zssdk/zscore/args.py +57 -0
  11. zssdk/zscore/auth.py +98 -0
  12. zssdk/zscore/case.py +118 -0
  13. zssdk/zscore/client.py +544 -0
  14. zssdk/zscore/config.py +180 -0
  15. zssdk/zscore/configloader.py +84 -0
  16. zssdk/zscore/configprovider.py +153 -0
  17. zssdk/zscore/credentials.py +266 -0
  18. zssdk/zscore/csv_utils.py +212 -0
  19. zssdk/zscore/data/_errors.json +14 -0
  20. zssdk/zscore/data/_retry.json +85 -0
  21. zssdk/zscore/data/endpoints.json +38 -0
  22. zssdk/zscore/data/exception.json +46 -0
  23. zssdk/zscore/data/zcc/v1/paginators-1.json +102 -0
  24. zssdk/zscore/data/zcc/v1/service-1.json +5815 -0
  25. zssdk/zscore/data/zdx/v1/paginators-1.json +60 -0
  26. zssdk/zscore/data/zdx/v1/service-1.json +3981 -0
  27. zssdk/zscore/data/zia/v1/errors-1.json +40 -0
  28. zssdk/zscore/data/zia/v1/paginators-1.json +396 -0
  29. zssdk/zscore/data/zia/v1/service-1.json +30535 -0
  30. zssdk/zscore/data/zid/v1/paginators-1.json +46 -0
  31. zssdk/zscore/data/zid/v1/service-1.json +1677 -0
  32. zssdk/zscore/data/zpa/v1/paginators-1.json +326 -0
  33. zssdk/zscore/data/zpa/v1/service-1.json +17746 -0
  34. zssdk/zscore/data/ztw/v1/errors-1.json +40 -0
  35. zssdk/zscore/data/ztw/v1/paginators-1.json +137 -0
  36. zssdk/zscore/data/ztw/v1/service-1.json +7737 -0
  37. zssdk/zscore/endpoint.py +110 -0
  38. zssdk/zscore/errorfactory.py +210 -0
  39. zssdk/zscore/errorutils.py +297 -0
  40. zssdk/zscore/exceptions.py +589 -0
  41. zssdk/zscore/handlers.py +58 -0
  42. zssdk/zscore/hooks.py +302 -0
  43. zssdk/zscore/httpsession.py +225 -0
  44. zssdk/zscore/loaders.py +136 -0
  45. zssdk/zscore/logger.py +737 -0
  46. zssdk/zscore/model.py +205 -0
  47. zssdk/zscore/paginate.py +351 -0
  48. zssdk/zscore/parsers.py +440 -0
  49. zssdk/zscore/regions.py +52 -0
  50. zscaler/zpa/models/auth_domain.py → zssdk/zscore/request.py +15 -17
  51. zssdk/zscore/response.py +99 -0
  52. zssdk/zscore/retry.py +371 -0
  53. zssdk/zscore/serialize.py +499 -0
  54. zssdk/zscore/session.py +389 -0
  55. zssdk/zscore/session.pyi +33 -0
  56. zssdk/zscore/stub.py +225 -0
  57. zssdk/zscore/tokenprovider.py +146 -0
  58. zssdk/zscore/useragent.py +81 -0
  59. zssdk/zscore/utils.py +124 -0
  60. zssdk/zscore/validate.py +132 -0
  61. zssdk/zscore/zcc_client.pyi +875 -0
  62. zssdk/zscore/zdx_client.pyi +188 -0
  63. zssdk/zscore/zia_client.pyi +5980 -0
  64. zssdk/zscore/zid_client.pyi +458 -0
  65. zssdk/zscore/zpa_client.pyi +3478 -0
  66. zssdk/zscore/ztw_client.pyi +584 -0
  67. zssdk/zsresource/__init__.py +74 -0
  68. zssdk/zsresource/action.py +118 -0
  69. zssdk/zsresource/base.py +196 -0
  70. zssdk/zsresource/base.pyi +12 -0
  71. zssdk/zsresource/collection.py +475 -0
  72. zssdk/zsresource/collection.pyi +29 -0
  73. zssdk/zsresource/data/zcc/v1/resources-1.json +7052 -0
  74. zssdk/zsresource/data/zdx/v1/resources-1.json +3600 -0
  75. zssdk/zsresource/data/zia/v1/resources-1.json +46276 -0
  76. zssdk/zsresource/data/zid/v1/resources-1.json +1678 -0
  77. zssdk/zsresource/data/zpa/v1/resources-1.json +26043 -0
  78. zssdk/zsresource/data/ztw/v1/resources-1.json +10816 -0
  79. zssdk/zsresource/dictionary.py +127 -0
  80. zssdk/zsresource/dictionary.pyi +16 -0
  81. zssdk/zsresource/exception_factory.py +160 -0
  82. zssdk/zsresource/exceptions.py +236 -0
  83. zssdk/zsresource/exceptions.pyi +42 -0
  84. zssdk/zsresource/factory.py +1112 -0
  85. zssdk/zsresource/params.py +66 -0
  86. zssdk/zsresource/response.py +173 -0
  87. zssdk/zsresource/service.py +84 -0
  88. zssdk/zsresource/service.pyi +14 -0
  89. zssdk/zsresource/subresource.py +469 -0
  90. zscaler/__init__.py → zssdk/zsresource/utils.py +8 -15
  91. zssdk/zsresource/validation.py +91 -0
  92. zssdk/zsresource/zcc_resources.pyi +2683 -0
  93. zssdk/zsresource/zdx_resources.pyi +933 -0
  94. zssdk/zsresource/zia_resources.pyi +12486 -0
  95. zssdk/zsresource/zid_resources.pyi +633 -0
  96. zssdk/zsresource/zpa_resources.pyi +6947 -0
  97. zssdk/zsresource/ztw_resources.pyi +2330 -0
  98. zscaler/api_client.py +0 -70
  99. zscaler/cache/cache.py +0 -105
  100. zscaler/cache/no_op_cache.py +0 -60
  101. zscaler/cache/zscaler_cache.py +0 -171
  102. zscaler/config/__init__.py +0 -0
  103. zscaler/config/config_setter.py +0 -195
  104. zscaler/config/config_validator.py +0 -173
  105. zscaler/constants.py +0 -46
  106. zscaler/error_messages.py +0 -46
  107. zscaler/errors/__init__.py +0 -0
  108. zscaler/errors/error.py +0 -10
  109. zscaler/errors/http_error.py +0 -20
  110. zscaler/errors/zscaler_api_error.py +0 -28
  111. zscaler/exceptions/__init__.py +0 -1
  112. zscaler/exceptions/exceptions.py +0 -101
  113. zscaler/helpers.py +0 -154
  114. zscaler/logger.py +0 -124
  115. zscaler/oneapi_client.py +0 -445
  116. zscaler/oneapi_collection.py +0 -16
  117. zscaler/oneapi_http_client.py +0 -419
  118. zscaler/oneapi_oauth_client.py +0 -239
  119. zscaler/oneapi_object.py +0 -77
  120. zscaler/oneapi_response.py +0 -286
  121. zscaler/ratelimiter/__init__.py +0 -0
  122. zscaler/ratelimiter/ratelimiter.py +0 -60
  123. zscaler/request_executor.py +0 -579
  124. zscaler/user_agent.py +0 -21
  125. zscaler/utils.py +0 -845
  126. zscaler/zcc/__init__.py +0 -0
  127. zscaler/zcc/admin_user.py +0 -266
  128. zscaler/zcc/company.py +0 -71
  129. zscaler/zcc/devices.py +0 -479
  130. zscaler/zcc/entitlements.py +0 -195
  131. zscaler/zcc/fail_open_policy.py +0 -116
  132. zscaler/zcc/forwarding_profile.py +0 -145
  133. zscaler/zcc/legacy.py +0 -353
  134. zscaler/zcc/manage_pass.py +0 -65
  135. zscaler/zcc/models/admin_roles.py +0 -163
  136. zscaler/zcc/models/admin_user.py +0 -69
  137. zscaler/zcc/models/devices.py +0 -215
  138. zscaler/zcc/models/failopenpolicy.py +0 -104
  139. zscaler/zcc/models/forwardingprofile.py +0 -343
  140. zscaler/zcc/models/manage_pass.py +0 -96
  141. zscaler/zcc/models/secrets_otp.py +0 -74
  142. zscaler/zcc/models/secrets_passwords.py +0 -60
  143. zscaler/zcc/models/trustednetworks.py +0 -97
  144. zscaler/zcc/models/webappservice.py +0 -85
  145. zscaler/zcc/models/webpolicy.py +0 -176
  146. zscaler/zcc/models/webprivacy.py +0 -84
  147. zscaler/zcc/models/zdxgroupentitlements.py +0 -72
  148. zscaler/zcc/models/zpagroupentitlements.py +0 -73
  149. zscaler/zcc/secrets.py +0 -111
  150. zscaler/zcc/trusted_networks.py +0 -198
  151. zscaler/zcc/web_app_service.py +0 -81
  152. zscaler/zcc/web_policy.py +0 -186
  153. zscaler/zcc/web_privacy.py +0 -120
  154. zscaler/zcc/zcc_service.py +0 -131
  155. zscaler/zdx/__init__.py +0 -0
  156. zscaler/zdx/admin.py +0 -162
  157. zscaler/zdx/alerts.py +0 -323
  158. zscaler/zdx/apps.py +0 -467
  159. zscaler/zdx/devices.py +0 -841
  160. zscaler/zdx/inventory.py +0 -175
  161. zscaler/zdx/legacy.py +0 -382
  162. zscaler/zdx/models/activeapplications.py +0 -61
  163. zscaler/zdx/models/administration.py +0 -48
  164. zscaler/zdx/models/alerts.py +0 -132
  165. zscaler/zdx/models/application_users.py +0 -92
  166. zscaler/zdx/models/applications.py +0 -165
  167. zscaler/zdx/models/call_quality_metrics.py +0 -58
  168. zscaler/zdx/models/common.py +0 -167
  169. zscaler/zdx/models/devices.py +0 -437
  170. zscaler/zdx/models/software_inventory.py +0 -121
  171. zscaler/zdx/models/troubleshooting.py +0 -370
  172. zscaler/zdx/models/users.py +0 -98
  173. zscaler/zdx/troubleshooting.py +0 -681
  174. zscaler/zdx/users.py +0 -167
  175. zscaler/zdx/zdx_service.py +0 -86
  176. zscaler/zia/__init__.py +0 -0
  177. zscaler/zia/activate.py +0 -106
  178. zscaler/zia/admin_roles.py +0 -244
  179. zscaler/zia/admin_users.py +0 -422
  180. zscaler/zia/advanced_settings.py +0 -210
  181. zscaler/zia/apptotal.py +0 -221
  182. zscaler/zia/atp_policy.py +0 -401
  183. zscaler/zia/audit_logs.py +0 -160
  184. zscaler/zia/authentication_settings.py +0 -309
  185. zscaler/zia/cloud_applications.py +0 -182
  186. zscaler/zia/cloud_apps.py +0 -526
  187. zscaler/zia/cloud_browser_isolation.py +0 -87
  188. zscaler/zia/cloud_firewall.py +0 -2255
  189. zscaler/zia/cloud_firewall_dns.py +0 -382
  190. zscaler/zia/cloud_firewall_ips.py +0 -375
  191. zscaler/zia/cloud_firewall_rules.py +0 -346
  192. zscaler/zia/cloud_nss.py +0 -688
  193. zscaler/zia/cloudappcontrol.py +0 -774
  194. zscaler/zia/device_management.py +0 -201
  195. zscaler/zia/dlp_dictionary.py +0 -524
  196. zscaler/zia/dlp_engine.py +0 -404
  197. zscaler/zia/dlp_resources.py +0 -635
  198. zscaler/zia/dlp_templates.py +0 -301
  199. zscaler/zia/dlp_web_rules.py +0 -439
  200. zscaler/zia/end_user_notification.py +0 -164
  201. zscaler/zia/file_type_control_rule.py +0 -361
  202. zscaler/zia/forwarding_control.py +0 -473
  203. zscaler/zia/gre_tunnel.py +0 -731
  204. zscaler/zia/intermediate_certificates.py +0 -684
  205. zscaler/zia/iot_report.py +0 -205
  206. zscaler/zia/ipv6_config.py +0 -190
  207. zscaler/zia/legacy.py +0 -796
  208. zscaler/zia/locations.py +0 -1054
  209. zscaler/zia/malware_protection_policy.py +0 -506
  210. zscaler/zia/models/__init__.py +0 -0
  211. zscaler/zia/models/activation.py +0 -46
  212. zscaler/zia/models/admin_roles.py +0 -93
  213. zscaler/zia/models/admin_users.py +0 -327
  214. zscaler/zia/models/advanced_settings.py +0 -320
  215. zscaler/zia/models/advanced_threat_settings.py +0 -217
  216. zscaler/zia/models/apptotal.py +0 -257
  217. zscaler/zia/models/authentication_settings.py +0 -91
  218. zscaler/zia/models/cloud_app_policy.py +0 -52
  219. zscaler/zia/models/cloud_browser_isolation.py +0 -51
  220. zscaler/zia/models/cloud_firewall_app_services.py +0 -48
  221. zscaler/zia/models/cloud_firewall_destination_groups.py +0 -64
  222. zscaler/zia/models/cloud_firewall_dns_rules.py +0 -251
  223. zscaler/zia/models/cloud_firewall_ips_rules.py +0 -212
  224. zscaler/zia/models/cloud_firewall_nw_application_groups.py +0 -54
  225. zscaler/zia/models/cloud_firewall_nw_applications.py +0 -51
  226. zscaler/zia/models/cloud_firewall_nw_service.py +0 -89
  227. zscaler/zia/models/cloud_firewall_nw_service_groups.py +0 -52
  228. zscaler/zia/models/cloud_firewall_rules.py +0 -237
  229. zscaler/zia/models/cloud_firewall_source_groups.py +0 -59
  230. zscaler/zia/models/cloud_firewall_time_windows.py +0 -55
  231. zscaler/zia/models/cloud_nss.py +0 -611
  232. zscaler/zia/models/cloudappcontrol.py +0 -256
  233. zscaler/zia/models/common.py +0 -175
  234. zscaler/zia/models/device_groups.py +0 -57
  235. zscaler/zia/models/devices.py +0 -65
  236. zscaler/zia/models/dlp_dictionary.py +0 -244
  237. zscaler/zia/models/dlp_engine.py +0 -90
  238. zscaler/zia/models/dlp_resources.py +0 -189
  239. zscaler/zia/models/dlp_templates.py +0 -66
  240. zscaler/zia/models/dlp_web_rules.py +0 -232
  241. zscaler/zia/models/endusernotification.py +0 -155
  242. zscaler/zia/models/filetyperules.py +0 -178
  243. zscaler/zia/models/forwarding_control_policy.py +0 -243
  244. zscaler/zia/models/gre_recommended_list.py +0 -73
  245. zscaler/zia/models/gre_tunnel_info.py +0 -69
  246. zscaler/zia/models/gre_tunnels.py +0 -135
  247. zscaler/zia/models/gre_vips.py +0 -166
  248. zscaler/zia/models/intermediate_certificates.py +0 -157
  249. zscaler/zia/models/iotreport.py +0 -105
  250. zscaler/zia/models/ipv6_config.py +0 -106
  251. zscaler/zia/models/location_group.py +0 -81
  252. zscaler/zia/models/location_management.py +0 -306
  253. zscaler/zia/models/malware_protection_settings.py +0 -101
  254. zscaler/zia/models/organization_information.py +0 -452
  255. zscaler/zia/models/pac_files.py +0 -98
  256. zscaler/zia/models/proxy_gatways.py +0 -72
  257. zscaler/zia/models/remoteassistance.py +0 -58
  258. zscaler/zia/models/rule_labels.py +0 -69
  259. zscaler/zia/models/sandboxrules.py +0 -162
  260. zscaler/zia/models/security_policy_settings.py +0 -49
  261. zscaler/zia/models/shadow_it_report.py +0 -298
  262. zscaler/zia/models/ssl_inspection_rules.py +0 -493
  263. zscaler/zia/models/subclouds.py +0 -286
  264. zscaler/zia/models/system_audit.py +0 -284
  265. zscaler/zia/models/traffic_extranet.py +0 -165
  266. zscaler/zia/models/traffic_static_ip.py +0 -88
  267. zscaler/zia/models/traffic_vpn_credentials.py +0 -88
  268. zscaler/zia/models/url_filter_cloud_app_settings.py +0 -114
  269. zscaler/zia/models/url_filtering_rules.py +0 -199
  270. zscaler/zia/models/urlcategory.py +0 -181
  271. zscaler/zia/models/user_management.py +0 -181
  272. zscaler/zia/models/workload_groups.py +0 -63
  273. zscaler/zia/models/zpa_gateway.py +0 -89
  274. zscaler/zia/organization_information.py +0 -172
  275. zscaler/zia/pac_files.py +0 -507
  276. zscaler/zia/policy_export.py +0 -92
  277. zscaler/zia/remote_assistance.py +0 -144
  278. zscaler/zia/rule_labels.py +0 -236
  279. zscaler/zia/sandbox.py +0 -346
  280. zscaler/zia/sandbox_rules.py +0 -333
  281. zscaler/zia/security_policy_settings.py +0 -260
  282. zscaler/zia/ssl_inspection_rules.py +0 -355
  283. zscaler/zia/sub_clouds.py +0 -173
  284. zscaler/zia/system_audit.py +0 -84
  285. zscaler/zia/traffic_extranet.py +0 -243
  286. zscaler/zia/traffic_static_ip.py +0 -350
  287. zscaler/zia/traffic_vpn_credentials.py +0 -368
  288. zscaler/zia/url_categories.py +0 -714
  289. zscaler/zia/url_filtering.py +0 -547
  290. zscaler/zia/user_management.py +0 -1010
  291. zscaler/zia/workload_groups.py +0 -91
  292. zscaler/zia/zia_service.py +0 -479
  293. zscaler/zia/zpa_gateway.py +0 -351
  294. zscaler/zpa/__init__.py +0 -0
  295. zscaler/zpa/app_connector_groups.py +0 -364
  296. zscaler/zpa/app_connector_schedule.py +0 -223
  297. zscaler/zpa/app_connectors.py +0 -281
  298. zscaler/zpa/app_protection.py +0 -1112
  299. zscaler/zpa/app_segment_by_type.py +0 -160
  300. zscaler/zpa/app_segments_inspection.py +0 -490
  301. zscaler/zpa/app_segments_pra.py +0 -468
  302. zscaler/zpa/application_segment.py +0 -627
  303. zscaler/zpa/authdomains.py +0 -72
  304. zscaler/zpa/cbi_banner.py +0 -256
  305. zscaler/zpa/cbi_certificate.py +0 -249
  306. zscaler/zpa/cbi_profile.py +0 -383
  307. zscaler/zpa/cbi_region.py +0 -69
  308. zscaler/zpa/cbi_zpa_profile.py +0 -121
  309. zscaler/zpa/certificates.py +0 -352
  310. zscaler/zpa/cloud_connector_groups.py +0 -128
  311. zscaler/zpa/customer_version_profile.py +0 -91
  312. zscaler/zpa/emergency_access.py +0 -350
  313. zscaler/zpa/enrollment_certificates.py +0 -141
  314. zscaler/zpa/idp.py +0 -142
  315. zscaler/zpa/legacy.py +0 -624
  316. zscaler/zpa/lss.py +0 -577
  317. zscaler/zpa/machine_groups.py +0 -137
  318. zscaler/zpa/microtenants.py +0 -402
  319. zscaler/zpa/models/app_connector_groups.py +0 -273
  320. zscaler/zpa/models/app_connector_schedule.py +0 -55
  321. zscaler/zpa/models/app_connectors.py +0 -176
  322. zscaler/zpa/models/app_protection.py +0 -317
  323. zscaler/zpa/models/app_protection_predefined_controls.py +0 -182
  324. zscaler/zpa/models/application_segment.py +0 -587
  325. zscaler/zpa/models/application_segment_inspection.py +0 -173
  326. zscaler/zpa/models/application_segment_pra.py +0 -211
  327. zscaler/zpa/models/application_servers.py +0 -62
  328. zscaler/zpa/models/cbi_banner.py +0 -60
  329. zscaler/zpa/models/cbi_certificate.py +0 -48
  330. zscaler/zpa/models/cbi_profile.py +0 -216
  331. zscaler/zpa/models/cbi_region.py +0 -45
  332. zscaler/zpa/models/cbi_zpa_profile.py +0 -119
  333. zscaler/zpa/models/certificates.py +0 -93
  334. zscaler/zpa/models/cloud_connector_groups.py +0 -62
  335. zscaler/zpa/models/common.py +0 -363
  336. zscaler/zpa/models/customer_version_profile.py +0 -104
  337. zscaler/zpa/models/emergency_access.py +0 -58
  338. zscaler/zpa/models/enrollment_certificates.py +0 -110
  339. zscaler/zpa/models/idp.py +0 -223
  340. zscaler/zpa/models/lss.py +0 -165
  341. zscaler/zpa/models/machine_groups.py +0 -69
  342. zscaler/zpa/models/microtenants.py +0 -235
  343. zscaler/zpa/models/policyset_controller_v1.py +0 -287
  344. zscaler/zpa/models/policyset_controller_v2.py +0 -246
  345. zscaler/zpa/models/posture_profiles.py +0 -106
  346. zscaler/zpa/models/pra_approval.py +0 -134
  347. zscaler/zpa/models/pra_console.py +0 -156
  348. zscaler/zpa/models/pra_cred_pool_controller.py +0 -76
  349. zscaler/zpa/models/pra_credential.py +0 -67
  350. zscaler/zpa/models/pra_portal.py +0 -102
  351. zscaler/zpa/models/provisioning_keys.py +0 -77
  352. zscaler/zpa/models/saml_attributes.py +0 -64
  353. zscaler/zpa/models/scim_attributes.py +0 -79
  354. zscaler/zpa/models/scim_groups.py +0 -58
  355. zscaler/zpa/models/segment_group.py +0 -75
  356. zscaler/zpa/models/server_group.py +0 -94
  357. zscaler/zpa/models/service_edge_groups.py +0 -148
  358. zscaler/zpa/models/service_edge_schedule.py +0 -55
  359. zscaler/zpa/models/service_edges.py +0 -160
  360. zscaler/zpa/models/trusted_network.py +0 -66
  361. zscaler/zpa/policies.py +0 -3308
  362. zscaler/zpa/posture_profiles.py +0 -142
  363. zscaler/zpa/pra_approval.py +0 -391
  364. zscaler/zpa/pra_console.py +0 -437
  365. zscaler/zpa/pra_credential.py +0 -384
  366. zscaler/zpa/pra_credential_pool.py +0 -354
  367. zscaler/zpa/pra_portal.py +0 -289
  368. zscaler/zpa/provisioning.py +0 -385
  369. zscaler/zpa/saml_attributes.py +0 -179
  370. zscaler/zpa/scim_attributes.py +0 -189
  371. zscaler/zpa/scim_groups.py +0 -150
  372. zscaler/zpa/segment_groups.py +0 -364
  373. zscaler/zpa/server_groups.py +0 -344
  374. zscaler/zpa/servers.py +0 -287
  375. zscaler/zpa/service_edge_group.py +0 -355
  376. zscaler/zpa/service_edge_schedule.py +0 -223
  377. zscaler/zpa/service_edges.py +0 -265
  378. zscaler/zpa/trusted_networks.py +0 -146
  379. zscaler/zpa/zpa_service.py +0 -378
  380. zscaler/ztw/__init__.py +0 -0
  381. zscaler/ztw/account_details.py +0 -276
  382. zscaler/ztw/activation.py +0 -115
  383. zscaler/ztw/admin_roles.py +0 -326
  384. zscaler/ztw/admin_users.py +0 -400
  385. zscaler/ztw/api_keys.py +0 -131
  386. zscaler/ztw/ec_groups.py +0 -319
  387. zscaler/ztw/forwarding_gateways.py +0 -235
  388. zscaler/ztw/forwarding_rules.py +0 -368
  389. zscaler/ztw/ip_destination_groups.py +0 -319
  390. zscaler/ztw/ip_groups.py +0 -259
  391. zscaler/ztw/ip_source_groups.py +0 -259
  392. zscaler/ztw/legacy.py +0 -461
  393. zscaler/ztw/location_management.py +0 -242
  394. zscaler/ztw/location_template.py +0 -385
  395. zscaler/ztw/models/activation.py +0 -57
  396. zscaler/ztw/models/admin_roles.py +0 -97
  397. zscaler/ztw/models/admin_users.py +0 -150
  398. zscaler/ztw/models/api_keys.py +0 -91
  399. zscaler/ztw/models/common.py +0 -88
  400. zscaler/ztw/models/ec_group_vm.py +0 -121
  401. zscaler/ztw/models/ecgroup.py +0 -457
  402. zscaler/ztw/models/forwarding_gateways.py +0 -111
  403. zscaler/ztw/models/forwarding_rules.py +0 -347
  404. zscaler/ztw/models/ip_destination_groups.py +0 -72
  405. zscaler/ztw/models/ip_groups.py +0 -58
  406. zscaler/ztw/models/ip_source_groups.py +0 -58
  407. zscaler/ztw/models/location_management.py +0 -255
  408. zscaler/ztw/models/location_templates.py +0 -173
  409. zscaler/ztw/models/nw_service.py +0 -95
  410. zscaler/ztw/models/nw_service_groups.py +0 -56
  411. zscaler/ztw/models/provisioning_url.py +0 -224
  412. zscaler/ztw/models/traffic_vpn_credentials.py +0 -90
  413. zscaler/ztw/models/zpa_resources.py +0 -61
  414. zscaler/ztw/nw_service.py +0 -299
  415. zscaler/ztw/nw_service_groups.py +0 -99
  416. zscaler/ztw/provisioning_url.py +0 -126
  417. zscaler/ztw/ztw_service.py +0 -180
  418. zscaler/zwa/__init__.py +0 -0
  419. zscaler/zwa/audit_logs.py +0 -132
  420. zscaler/zwa/dlp_incidents.py +0 -656
  421. zscaler/zwa/legacy.py +0 -268
  422. zscaler/zwa/models/audit_logs.py +0 -135
  423. zscaler/zwa/models/change_history.py +0 -61
  424. zscaler/zwa/models/common.py +0 -712
  425. zscaler/zwa/models/generated_tickets.py +0 -152
  426. zscaler/zwa/models/incident_details.py +0 -203
  427. zscaler/zwa/models/incident_evidence.py +0 -57
  428. zscaler/zwa/models/incident_group_search.py +0 -59
  429. zscaler/zwa/models/incident_search.py +0 -93
  430. zscaler/zwa/models/incident_trigger.py +0 -45
  431. zscaler_sdk_python-2.0.0.dist-info/METADATA +0 -1107
  432. zscaler_sdk_python-2.0.0.dist-info/RECORD +0 -341
  433. {zscaler_sdk_python-2.0.0.dist-info → zscaler_sdk_python-2.0.0b2.dist-info/licenses}/LICENSE.md +0 -0
  434. /zscaler/cache/__init__.py → /zssdk/py.typed +0 -0
@@ -0,0 +1,928 @@
1
+ Metadata-Version: 2.4
2
+ Name: zscaler-sdk-python
3
+ Version: 2.0.0b2
4
+ Summary: Zscaler SDK for Python
5
+ Author-email: "Zscaler Inc." <devrel@zscaler.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/zscaler/zscaler-sdk-python
8
+ Project-URL: Repository, https://github.com/zscaler/zscaler-sdk-python
9
+ Project-URL: Documentation, http://automation.zsapidocs.net/docs/
10
+ Project-URL: Bug Tracker, https://github.com/zscaler/zscaler-sdk-python/issues
11
+ Keywords: zscaler,sdk,zpa,zia,zdx,zcc,ztw,zid,zidentity
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Security
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE.md
23
+ Requires-Dist: cryptography>=46.0.0
24
+ Requires-Dist: httpx<2.0.0,>=0.28.0
25
+ Requires-Dist: jmespath>=1.0.0
26
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
27
+ Requires-Dist: PyJWT<3.0.0,>=2.8.0
28
+ Requires-Dist: truststore>=0.9.0
29
+ Provides-Extra: examples
30
+ Requires-Dist: prettytable>=3.0.0; extra == "examples"
31
+ Provides-Extra: dev
32
+ Requires-Dist: black==25.12.0; extra == "dev"
33
+ Requires-Dist: faker>=30.0.0; extra == "dev"
34
+ Requires-Dist: flake8>=7.0.0; extra == "dev"
35
+ Requires-Dist: isort==7.0.0; extra == "dev"
36
+ Requires-Dist: pylint==4.0.4; extra == "dev"
37
+ Requires-Dist: pytest==9.0.1; extra == "dev"
38
+ Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
39
+ Requires-Dist: pytest-httpserver>=1.0.0; extra == "dev"
40
+ Requires-Dist: build>=1.0.0; extra == "dev"
41
+ Requires-Dist: twine>=5.0.0; extra == "dev"
42
+ Requires-Dist: anyio==4.12.0; extra == "dev"
43
+ Requires-Dist: autopep8==2.3.2; extra == "dev"
44
+ Requires-Dist: tomlkit==0.13.3; extra == "dev"
45
+ Requires-Dist: uv==0.9.21; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # Official Zscaler OneAPI SDK for Python
49
+
50
+ [![PyPI Version](https://img.shields.io/pypi/v/zscaler-sdk-python.svg)](https://pypi.org/project/zscaler-sdk-python)
51
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/zscaler-sdk-python.svg)](https://pypi.org/project/zscaler-sdk-python)
52
+ [![License](https://img.shields.io/badge/license-ISC-blue.svg)](LICENSE.md)
53
+ [![PyPI - Downloads](https://img.shields.io/pypi/dw/zscaler-sdk-python)](https://pypistats.org/packages/zscaler-sdk-python)
54
+ [![Documentation Status](https://img.shields.io/badge/docs-online-success)](http://automation.zsapidocs.net/docs/)
55
+ [![Zscaler Community](https://img.shields.io/badge/zscaler-community-blue)](https://community.zscaler.com/)
56
+
57
+ ---
58
+
59
+ ## Table of Contents
60
+
61
+ - [Overview](#overview)
62
+ - [Why This SDK](#why-this-sdk)
63
+ - [Prerequisites](#prerequisites)
64
+ - [Installation](#installation)
65
+ - [Building the SDK](#building-the-sdk)
66
+ - [Getting Started](#getting-started)
67
+ - [Authentication](#authentication)
68
+ - [Basic Usage](#basic-usage)
69
+ - [Configuration](#configuration)
70
+ - [Configuration File](#configuration-file)
71
+ - [Environment Variables](#environment-variables)
72
+ - [Constructor Parameters](#constructor-parameters)
73
+ - [Configuration Precedence](#configuration-precedence)
74
+ - [API Layers](#api-layers)
75
+ - [Resource Layer (Recommended)](#resource-layer-recommended)
76
+ - [Service Client Layer](#service-client-layer)
77
+ - [Supported Products](#supported-products)
78
+ - [ZPA: customer_id Requirement](#zpa-customer_id-requirement)
79
+ - [ZIA and ZTW Context Manager](#zia-and-ztw-context-manager)
80
+ - [Collections and Pagination](#collections-and-pagination)
81
+ - [Error Handling](#error-handling)
82
+ - [Rate Limiting and Retry Mechanism](#rate-limiting-and-retry-mechanism)
83
+ - [Logging](#logging)
84
+ - [Auto-completion and IntelliSense](#auto-completion-and-intellisense)
85
+ - [Examples](#examples)
86
+ - [Migrating from zscaler-sdk-python](#migrating-from-zscaler-sdk-python)
87
+ - [Contributing](#contributing)
88
+ - [Need Help?](#need-help)
89
+
90
+ ---
91
+
92
+ ## Overview
93
+
94
+ The Zscaler OneAPI SDK for Python (`zscaler-sdk-python`) provides a convenient and consistent interface for interacting with Zscaler product APIs through the [OneAPI](https://help.zscaler.com/oneapi/understanding-oneapi) framework.
95
+
96
+ This SDK is designed exclusively for OneAPI. It uses OAuth2 authentication via [Zscaler Identity (Zidentity)](https://help.zscaler.com/zidentity/what-zidentity) and provides a high-level `Session` object that manages credentials, configuration, and API calls.
97
+
98
+ This SDK can be used in your server-side code to interact with the Zscaler API platform across multiple products such as:
99
+
100
+ - [ZPA API](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/zpa)
101
+ - [ZIA API](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/zia)
102
+ - [ZDX API](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/zdx)
103
+ - [ZCC API](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/zcc)
104
+ - [ZIdentity](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/zid)
105
+ - [ZTW API](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/zcloudconnector)
106
+
107
+ > **Note:** This SDK (`zscaler-sdk-python`) is the next-generation replacement for the previous [`zscaler-sdk-python`](https://github.com/zscaler/zscaler-sdk-python) package. See [Why This SDK](#why-this-sdk) and [Migrating from zscaler-sdk-python](#migrating-from-zscaler-sdk-python) below.
108
+
109
+ ### Key Features
110
+
111
+ - **True resource objects with dot notation** — Work with resources as Python objects (`user.name`, `cred.fqdn`), not raw dictionaries (`user["name"]`). Attribute access, assignment, and IDE auto-completion work out of the box.
112
+ - **Active Record pattern** — Create, read, update, and delete resources with natural method calls: `cred.create()`, `cred.load()`, `cred.update()`, `cred.delete()`. No need to call separate service methods and pass IDs around.
113
+ - **Non-standard operations as first-class methods** — Operations beyond CRUDL (e.g., `activate()`, `bulk_delete_assistant()`, `export_application()`, `validate_wild_card_domain_name()`) are dynamically generated from API metadata and exposed as snake_case methods on the same resource instances — no drop-down to a low-level client required.
114
+ - **Iterator-based collections with chaining** — Paginate effortlessly with `.all()`, apply server-side filters with `.filter()`, cap results with `.limit()`, tune performance with `.page_size()`, and apply client-side JMESPath queries with `.search()` — all chainable in a single expression.
115
+ - **Python exceptions, not error tuples** — Errors raise typed exceptions (`BadRequestException`, `NotFoundException`) with full context. Use standard `try`/`except` instead of unpacking `(result, response, error)` tuples on every call.
116
+ - **Automatic `snake_case` / `camelCase` conversion** — Write idiomatic Python everywhere. The SDK transparently converts to API `camelCase` on the wire and back.
117
+ - **One session, all products** — A single `Session` with unified OAuth2 authentication gives you `session.zia`, `session.zpa`, `session.zcc`, `session.zid`, `session.zdx`, and `session.ztw`. No per-product client setup or separate credentials.
118
+ - **IDE auto-completion and type checking** — Ships with PEP 484 `.pyi` type stubs. VS Code, PyCharm, and other editors provide auto-complete, parameter hints, and docstrings for every resource and method.
119
+ - **Transparent retry and rate-limit handling** — Built-in exponential backoff with `Retry-After` header support. Rate limits and transient errors are handled automatically — no retry logic needed in your code.
120
+ - **Metadata-driven architecture** — API operations, shapes, pagination, and error mappings are defined in JSON metadata generated from TypeSpec. New endpoints are added via JSON, not Python code.
121
+ - **Context managers for ZIA/ZTW activation** — `with session.zia as zia:` automatically activates staged configuration changes on exit. No manual activation calls required.
122
+
123
+ ### SDK Design and Data Model
124
+
125
+ This SDK uses a resource-oriented design with the following characteristics:
126
+
127
+ - **Resource objects** — Resources (e.g., `VpnCredential`, `UserProfile`) are Python objects with attribute access (dot notation), e.g., `cred.fqdn`, `user.login_name`.
128
+ - **Snake_case** — Property names use `snake_case` in Python while the SDK maps to/from API `camelCase` automatically.
129
+ - **Native types** — Data is represented as native Python types; responses are JSON-serializable.
130
+
131
+ ---
132
+
133
+ ## Why This SDK
134
+
135
+ If you are currently using [`zscaler-sdk-python`](https://github.com/zscaler/zscaler-sdk-python), here is why you should switch to `zscaler-sdk-python`:
136
+
137
+ | Capability | `zscaler-sdk-python` v1 | `zscaler-sdk-python` v2 |
138
+ |---|---|---|
139
+ | **Data access** | Raw `dict` — `user["name"]` | Resource objects — `user.name` |
140
+ | **CRUD pattern** | Service methods returning `(result, resp, error)` tuples | Active Record — `resource.create()`, `.load()`, `.update()`, `.delete()` |
141
+ | **Error handling** | Go-style tuples: `result, resp, err = ...` | Python exceptions: `try` / `except NotFoundException` |
142
+ | **Pagination** | Manual loop with `resp.has_next()` / `resp.next()` | Iterator-based: `for item in resources.all().limit(100)` |
143
+ | **Filtering** | Manual query params dict | Chainable `.filter()` + `.search()` (JMESPath) |
144
+ | **Case conversion** | Caller manages `camelCase` ↔ `snake_case` | Automatic — write `snake_case`, API receives `camelCase` |
145
+ | **IDE support** | No type stubs | PEP 484 `.pyi` stubs — auto-completion, param hints, docstrings |
146
+
147
+ ### Side-by-side comparison
148
+
149
+ **Previous SDK — dict access, error tuples, manual pagination:**
150
+
151
+ ```python
152
+ from zscaler import ZscalerClient
153
+
154
+ config = {"clientId": "...", "clientSecret": "...", "vanityDomain": "..."}
155
+
156
+ with ZscalerClient(config) as client:
157
+ # List users — must unpack tuple on every call
158
+ users, resp, err = client.zia.user_management.list_users()
159
+ if err:
160
+ print(f"Error: {err}")
161
+ else:
162
+ for user in users:
163
+ print(user["name"]) # dict access
164
+
165
+ # Manual pagination
166
+ while resp.has_next():
167
+ more_users, resp, err = resp.next()
168
+ if err:
169
+ break
170
+ for user in more_users:
171
+ print(user["name"])
172
+ ```
173
+
174
+ **This SDK — resource objects, exceptions, iterator collections:**
175
+
176
+ ```python
177
+ from zssdk import Session
178
+
179
+ session = Session(vanity_domain="...", client_id="...", client_secret="...")
180
+
181
+ # Iterate all users — pagination is automatic
182
+ for user in session.zia.admin_users.all():
183
+ print(user.name) # attribute access
184
+
185
+ # Chain filters, limits, and search in one expression
186
+ for user in session.zia.admin_users.filter(search="SDWAN").limit(10):
187
+ print(user.name)
188
+
189
+ # Errors are exceptions, not return values
190
+ from zssdk.zsresource.exceptions import NotFoundException
191
+ try:
192
+ role = session.zia.AdminRole(id=99999)
193
+ role.load()
194
+ except NotFoundException:
195
+ print("Role not found")
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Prerequisites
201
+
202
+ - **Python 3.10+**
203
+ - An administrator account for the Zscaler products you wish to manage
204
+ - [API credentials](https://help.zscaler.com/zidentity/about-api-clients) created in the Zscaler Identity Admin UI (Client ID and Client Secret)
205
+
206
+ ---
207
+
208
+ ## Installation
209
+
210
+ Install the SDK from PyPI:
211
+
212
+ ```sh
213
+ pip install zscaler-sdk-python
214
+ ```
215
+
216
+ Or install from source (e.g., for development):
217
+
218
+ ```sh
219
+ pip install -e /path/to/oneapi-sdk/python
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Building the SDK
225
+
226
+ In most cases, you won't need to build the SDK from source. If you want to build it yourself:
227
+
228
+ 1. Clone the repository
229
+ 2. Navigate to the `python` directory
230
+ 3. Run `python -m build` (requires the `build` package: `pip install build`)
231
+ 4. Install the built package: `pip install dist/zssdk_python-*.whl` or `pip install dist/zssdk_python-*.tar.gz`
232
+
233
+ ---
234
+
235
+ ## Getting Started
236
+
237
+ ### Authentication
238
+
239
+ The SDK uses OAuth2 via [Zscaler Identity (Zidentity)](https://help.zscaler.com/zidentity/what-zidentity). You must have an API Client created in the [ZIdentity platform](https://help.zscaler.com/zidentity/about-api-clients).
240
+
241
+ #### OneAPI (API Client Scope)
242
+
243
+ OneAPI resources are automatically created within the ZIdentity Admin UI based on the RBAC roles applicable to APIs within the various products. For example, in ZIA, navigate to **Administration → Role Management** and select **Add API Role**. Once this role has been saved, return to the ZIdentity Admin UI and from the **Integration** menu select **API Resources**. Click the **View** icon to the right of Zscaler APIs and under the ZIA dropdown you will see the newly created role. In the event a newly created role is not seen in the ZIdentity Admin UI, a **Sync Now** button is provided in the API Resources menu which initiates an on-demand sync of newly created roles.
244
+
245
+ **Required parameters:**
246
+
247
+ - **vanity_domain** — Your organization's vanity domain (e.g., `acme`). Use only the vanity part; full domains like `acme.zslogin.net` are not allowed. Refers to the domain used by your organization: `https://<vanity_domain>.zslogin.net/oauth2/v1/token`.
248
+ - **client_id** — Your Zidentity API Client ID
249
+ - **client_secret** — Your API Client secret
250
+ - **cloud** — (Optional) Omit for production. Use only when authenticating to a non-production environment such as `alpha` or `beta` (test-based tenants).
251
+
252
+ > **Caution:** Do not hard-code credentials. Use environment variables or the configuration file instead.
253
+
254
+ ### Basic Usage
255
+
256
+ Create a `Session` and access services as attributes. The SDK dynamically provides service resources when you access them.
257
+
258
+ ```python
259
+ import os
260
+ from zssdk import Session
261
+
262
+ # Create a session using environment variables (omit cloud for production)
263
+ session = Session(
264
+ cloud=os.getenv("ZSCALER_CLOUD"), # Optional: only for alpha/beta
265
+ vanity_domain=os.getenv("ZSCALER_VANITY_DOMAIN"),
266
+ client_id=os.getenv("ZSCALER_CLIENT_ID"),
267
+ client_secret=os.getenv("ZSCALER_CLIENT_SECRET"),
268
+ )
269
+
270
+ # Access ZIA and list VPN credentials
271
+ zia = session.zia
272
+ for cred in zia.vpn_credentials.all().limit(10):
273
+ print(cred.fqdn, cred.id)
274
+
275
+ # Access ZID and list user profiles
276
+ zid = session.zid
277
+ for user in zid.user_profiles.all().limit(5):
278
+ print(user.login_name, user.display_name)
279
+ ```
280
+
281
+ **Using the default session:** You can call `setup_default_session(**kwargs)` once to configure a shared session, then use `get_default_session()` anywhere. The `zssdk.client()` helper returns a low-level client from the default session.
282
+
283
+ ---
284
+
285
+ ## Configuration
286
+
287
+ ### Configuration File
288
+
289
+ Create a configuration file at `~/.zscaler/config`. The file uses INI format with named profiles (you can also use `config.ini` and pass `config_file="/path/to/config.ini"` to `Session`):
290
+
291
+ ```ini
292
+ [default]
293
+ vanity_domain = your_vanity_domain
294
+ client_id = your_client_id
295
+ client_secret = your_client_secret
296
+
297
+ [beta]
298
+ cloud = beta
299
+ vanity_domain = your_vanity_domain
300
+ client_id = your_beta_client_id
301
+ client_secret = your_beta_client_secret
302
+ ```
303
+
304
+ > **Note:** Profile names (e.g., `[default]`, `[beta]`) are arbitrary labels you choose. The `cloud` key within a profile is what selects the non-production Zscaler environment. Omit `cloud` entirely for production.
305
+
306
+ Use a profile by name:
307
+
308
+ ```python
309
+ session = Session(profile_name="beta")
310
+ ```
311
+
312
+ For multi-product setups with different clouds, define separate profiles and pass `profile_name` when creating the session for each product.
313
+
314
+ ### Environment Variables
315
+
316
+ **Credential and cloud settings** (prefix `ZSCALER_`):
317
+
318
+ | Variable | Description |
319
+ |--------------------------|----------------------------------------------------------|
320
+ | `ZSCALER_CLOUD` | Non-production environment only (e.g., `alpha`, `beta`); omit for production |
321
+ | `ZSCALER_VANITY_DOMAIN` | Your organization's vanity domain |
322
+ | `ZSCALER_CLIENT_ID` | OAuth2 Client ID |
323
+ | `ZSCALER_CLIENT_SECRET` | OAuth2 Client Secret |
324
+ | `ZSCALER_PRIVATE_KEY` | Private key string (for JWT Bearer auth) |
325
+ | `ZSCALER_CERT_FILE_PATH` | Path to private key file (for certificate-based auth) |
326
+ | `ZSCALER_PROFILE` | Default profile name (default: `default`) |
327
+
328
+ **SDK-level settings** (prefix `ZSSDK_`), defined in `zssdk.zscore.configprovider`:
329
+
330
+ | Variable | Description |
331
+ |--------------------------|----------------------------------------------------------|
332
+ | `ZSSDK_API_VERSION` | API version (default: `v1`) |
333
+ | `ZSSDK_USE_FIPS_ENDPOINT`| Use FIPS endpoints (`true` / `false`) |
334
+ | `ZSSDK_LOG_ENABLED` | Enable SDK logging (`true` / `false`) |
335
+ | `ZSSDK_LOG_VERBOSE` | Verbose logging (`true` / `false`) |
336
+ | `ZSSDK_LOG_TO_FILE` | Log to file (`true` / `false`) |
337
+ | `ZSSDK_LOG_FILE_PATH` | Log file path (default: `zssdk.log`) |
338
+ | `ZSSDK_LOG_FORMAT` | Log format: `basic`, `json`, or `custom` (see [Logging](#logging)) |
339
+
340
+ ### Constructor Parameters
341
+
342
+ You can pass credentials and settings directly to `Session`:
343
+
344
+ ```python
345
+ session = Session(
346
+ vanity_domain="acme",
347
+ client_id="your_client_id",
348
+ client_secret="your_client_secret",
349
+ profile_name="beta", # Use config file profile
350
+ config_file="/path/to/config", # Custom config path
351
+ )
352
+ ```
353
+
354
+ For JWT Bearer (client assertion) authentication:
355
+
356
+ ```python
357
+ session = Session(
358
+ vanity_domain="acme",
359
+ client_id="your_client_id",
360
+ cert_file_path="/path/to/private_key.pem", # Or private_key="<key string>"
361
+ )
362
+ ```
363
+
364
+ ### Configuration Precedence
365
+
366
+ Configuration is resolved in the following order (highest to lowest):
367
+
368
+ 1. Constructor arguments
369
+ 2. Instance variables set via `session.set_config_variable()`
370
+ 3. Environment variables
371
+ 4. Configuration file (profile)
372
+ 5. Default values
373
+
374
+ ### User-Agent and Custom Headers
375
+
376
+ The SDK sends a `User-Agent` header with each request in the format: `oneapi-sdk/<version> python/<py_version> <os>/<os_version>`. You can append custom text via the `Config` object:
377
+
378
+ ```python
379
+ from zssdk.zscore.config import Config
380
+
381
+ config = Config(user_agent_extra="my-app/1.0")
382
+ session = Session(config=config, profile_name="beta")
383
+ # User-Agent will be: oneapi-sdk/<version> python/<version> <os>/<release> my-app/1.0
384
+ ```
385
+
386
+ ---
387
+
388
+ ## API Layers
389
+
390
+ The SDK exposes two ways to interact with Zscaler APIs.
391
+
392
+ ### Resource Layer (Recommended)
393
+
394
+ The resource layer provides a Pythonic, object-oriented interface. Access services as session attributes and work with resources as objects.
395
+
396
+ **Creating and managing a resource:**
397
+
398
+ ```python
399
+ import zssdk
400
+
401
+ session = zssdk.Session(profile_name="default")
402
+ zia = session.zia
403
+
404
+ # Create a new VPN credential
405
+ cred = zia.VpnCredential()
406
+ cred.type = "UFQDN"
407
+ cred.fqdn = "office@example.zslogin.net"
408
+ cred.pre_shared_key = "somekey"
409
+ cred.create()
410
+ print(f"Created credential with ID: {cred.id}")
411
+
412
+ # Load an existing resource by ID
413
+ loaded = zia.VpnCredential(id=cred.id)
414
+ loaded.load()
415
+
416
+ # Update
417
+ loaded.pre_shared_key = "newkey"
418
+ loaded.update()
419
+
420
+ # Delete
421
+ cred.delete()
422
+ ```
423
+
424
+ **Working with collections:**
425
+
426
+ ```python
427
+ # List all (iterates over paginated results)
428
+ for item in zia.vpn_credentials.all():
429
+ print(item.fqdn)
430
+
431
+ # Apply server-side filters
432
+ for item in zia.vpn_credentials.all().filter(type="UFQDN"):
433
+ print(item.fqdn)
434
+
435
+ # Limit results
436
+ for item in zia.vpn_credentials.all().limit(20):
437
+ print(item.fqdn)
438
+
439
+ # Control page size for performance tuning
440
+ for item in zia.vpn_credentials.all().page_size(50).limit(100):
441
+ print(item.fqdn)
442
+
443
+ # Client-side filtering with JMESPath (see Collections and Pagination for more examples)
444
+ for item in zia.vpn_credentials.all().search("[?type=='UFQDN']"):
445
+ print(item.fqdn)
446
+
447
+ # Iterate by page
448
+ for page in zia.vpn_credentials.all().pages():
449
+ for item in page:
450
+ print(item.fqdn)
451
+ ```
452
+
453
+ **ZID (Zscaler Identity) example:**
454
+
455
+ ```python
456
+ zid = session.zid
457
+
458
+ # Create user profile
459
+ user = zid.UserProfile()
460
+ user.login_name = "john.doe@example.com"
461
+ user.display_name = "John Doe"
462
+ user.primary_email = "john.doe@example.com"
463
+ user.status = True
464
+ user.create()
465
+
466
+ # List groups
467
+ for group in zid.groups.all().limit(10):
468
+ print(group.name)
469
+ ```
470
+
471
+ ### Service Client Layer
472
+
473
+ For lower-level access, you can obtain a raw service client via `session.client("zia")`. This returns a low-level client whose methods map directly to API operations. For typical usage, prefer the resource layer above. Use `session.get_available_services()` to list available service names (`zia`, `zid`, `zcc`, `zpa`, `zdx`, `ztw`) and `session.get_available_resources()` for resource-style service names.
474
+
475
+ ---
476
+
477
+ ## Supported Products
478
+
479
+ | Product | Service Name | Description |
480
+ |----------------------------|--------------|--------------------------------------------------|
481
+ | Zscaler Internet Access | `zia` | ZIA administration and policy management |
482
+ | Zscaler Identity | `zid` | User, group, and API client management |
483
+ | Zscaler Client Connector | `zcc` | Client Connector administration |
484
+ | Zscaler Private Access | `zpa` | ZPA configuration and policies |
485
+ | Zscaler Digital Experience | `zdx` | ZDX monitoring and analytics |
486
+ | Zscaler Cloud & Branch Connector | `ztw` | Cloud & Branch Connector management |
487
+
488
+ ---
489
+
490
+ ## ZPA: customer_id Requirement
491
+
492
+ When interacting with **Zscaler Private Access (ZPA)** endpoints, you must provide `customer_id` in addition to the standard authentication parameters. The `customer_id` is the ZPA tenant ID, found under **Configuration & Control → Public API → API Keys** in the ZPA Admin Portal.
493
+
494
+ For ZPA resources, pass `customer_id` as a parameter to each operation. Every ZPA API call includes `customer_id` in the request path (e.g., `/customers/{customerId}/...`), so you must supply it when creating, updating, or querying ZPA resources.
495
+
496
+ `microtenant_id` is optional and only required when using ZPA with Microtenant; pass `0` for the default microtenant.
497
+
498
+ ---
499
+
500
+ ## ZIA and ZTW Context Manager
501
+
502
+ The SDK provides a context manager pattern for **ZIA** and **ZTW** that automatically activates configuration changes when exiting the block.
503
+
504
+ ### How It Works
505
+
506
+ When you use the `with` statement with `session.zia` or `session.ztw`:
507
+
508
+ 1. **Entry** — The service resource is returned; you make configuration changes within the block.
509
+ 2. **Exit** — When exiting the context (successfully or via exception), the SDK runs a finalize workflow that activates staged changes.
510
+
511
+ ### Activation Process
512
+
513
+ - **ZIA** — The finalize workflow calls the activation status endpoint. If the status is `PENDING`, it deauthenticates the session, which triggers activation of all staged configuration changes.
514
+ - **ZTW** — The finalize workflow fetches the status; if `PENDING`, it explicitly calls the Activate endpoint.
515
+
516
+ ### Example
517
+
518
+ ```python
519
+ import zssdk
520
+
521
+ session = zssdk.Session(profile_name="default")
522
+
523
+ # ZIA: context manager activates changes on exit
524
+ with session.zia as zia:
525
+ role = zia.AdminRole()
526
+ role.name = "New API Role"
527
+ role.description = "Role created via API"
528
+ role.create()
529
+ # All staged ZIA changes are activated here
530
+
531
+ # ZTW: context manager activates changes on exit
532
+ with session.ztw as ztw:
533
+ group = ztw.IpDestinationGroup()
534
+ group.name = "New IP Group"
535
+ group.description = "IP group via API"
536
+ group.create()
537
+ # All staged ZTW changes are activated here
538
+ ```
539
+
540
+ ### Benefits
541
+
542
+ - **Automatic activation** — No need to call activation endpoints manually.
543
+ - **Deterministic behavior** — Exiting the context always triggers the activation workflow.
544
+ - **Error handling** — Even if an exception occurs, the context manager runs the finalize logic on normal exit (exceptions are not suppressed).
545
+
546
+ ---
547
+
548
+ ## Collections and Pagination
549
+
550
+ Collections support the following methods:
551
+
552
+ | Method | Description |
553
+ |-----------------|-------------------------------------------------------------------|
554
+ | `.all()` | Returns an iterable over all resources (handles pagination) |
555
+ | `.filter(**kwargs)` | Applies server-side filters (snake_case or camelCase) |
556
+ | `.limit(n)` | Stops after yielding `n` resources |
557
+ | `.page_size(n)` | Sets the number of resources fetched per API request |
558
+ | `.search(expr)` | Client-side JMESPath filtering on each page |
559
+ | `.pages()` | Yields pages (lists) of resources instead of individual items |
560
+
561
+ Example with combined options:
562
+
563
+ ```python
564
+ # Server-side filter, custom page size, limit total results
565
+ for cred in (
566
+ zia.vpn_credentials.all()
567
+ .filter(type="UFQDN")
568
+ .page_size(25)
569
+ .limit(100)
570
+ ):
571
+ print(cred.fqdn)
572
+ ```
573
+
574
+ ### Client-side filtering with JMESPath
575
+
576
+ The `.search(expr)` method applies a [JMESPath](https://jmespath.org/) expression on each page of results. Use it when you need filtering that the API does not support server-side. The expression is applied to the items array, so you write it relative to each item.
577
+
578
+ ```python
579
+ # Exact match on a field
580
+ for user in zia.admin_users.search("[?name == 'SDWAN-SilverPeak']"):
581
+ print(user.name)
582
+
583
+ # Multiple values with OR
584
+ for user in zia.admin_users.search("[?name == 'SDWAN-SilverPeak' || name == 'SDWAN-VeloCloud']"):
585
+ print(user.name)
586
+
587
+ # Substring match using contains()
588
+ for user in zia.admin_users.search("[?contains(name, 'SilverPeak')]"):
589
+ print(user.name)
590
+
591
+ # Chain with server-side filter (filter first to reduce data, then search)
592
+ for user in zia.admin_users.filter(search="SDWAN").search("[?contains(name, 'SilverPeak')]"):
593
+ print(user.name)
594
+
595
+ # Chain with limit and page_size
596
+ for user in zia.admin_users.search("[?name == 'SDWAN-SilverPeak']").limit(10).page_size(50):
597
+ print(user.name)
598
+ ```
599
+
600
+ ---
601
+
602
+ ## Error Handling
603
+
604
+ The SDK raises structured exceptions:
605
+
606
+ | Exception | Base | When it occurs |
607
+ |----------------------|---------------|----------------------------------------------------|
608
+ | `OneApiError` | — | Base SDK error |
609
+ | `ZsResourceError` | `OneApiError` | Resource-level errors; includes `resource_name`, `action_name` |
610
+ | `BadRequestException`| `ZsResourceError` | API returns 400 Bad Request |
611
+ | `NotFoundException` | `ZsResourceError` | API returns 404 Not Found |
612
+
613
+ Additional resource-specific exceptions (e.g., `ConflictException`) may be defined in `zssdk.zsresource.exceptions`.
614
+
615
+ **Example:**
616
+
617
+ ```python
618
+ from zssdk.zscore import OneApiError
619
+ from zssdk.zsresource import ZsResourceError
620
+ from zssdk.zsresource.exceptions import BadRequestException
621
+
622
+ try:
623
+ cred = zia.VpnCredential()
624
+ cred.fqdn = "invalid"
625
+ cred.create()
626
+ except BadRequestException as e:
627
+ print(f"Bad request: {e}")
628
+ except ZsResourceError as e:
629
+ print(f"Resource error: {e.resource_name} / {e.action_name}: {e}")
630
+ except OneApiError as e:
631
+ print(f"SDK error: {e}")
632
+ ```
633
+
634
+ ---
635
+
636
+ ## Rate Limiting and Retry Mechanism
637
+
638
+ Each Zscaler product has its own rate limiting criteria. Product-specific limits and quotas are documented in the [Zscaler Automation Hub Rate Limiting Guide](https://automate.zscaler.com/docs/docs/api-reference-and-guides/api-reference/guides/rate-limiting).
639
+
640
+ ### Built-in Retry Mechanism
641
+
642
+ The SDK includes a built-in retry mechanism (configured in `zssdk.zscore.data._retry`) that handles rate limiting and transient failures automatically. When a retryable response or connection error occurs, the SDK:
643
+
644
+ 1. **Checks for rate limit headers** — If present, waits the specified time before retrying.
645
+ 2. **Falls back to exponential backoff** — If no header is present, uses exponential backoff (base 0.3s, growth factor 2).
646
+ 3. **Caps wait time** — Maximum wait is 300 seconds per retry.
647
+ 4. **Limits attempts** — Retries up to 3 times (`max_attempts`) before raising the final exception.
648
+
649
+ The retry logic is applied per request across all supported products (ZIA, ZID, ZCC, ZPA, ZDX, ZTW).
650
+
651
+ ### HTTP Status Codes That Trigger Retries
652
+
653
+ The SDK retries requests when it receives one of the following responses:
654
+
655
+ | Status Code | Meaning | Policy Name |
656
+ |-------------|-------------------------|--------------------|
657
+ | `429` | Too Many Requests | TooManyRequests, Throttling |
658
+ | `500` | Internal Server Error | ServerError (with TransientFailure) |
659
+ | `502` | Bad Gateway | BadGateway |
660
+ | `503` | Service Unavailable | ServiceUnavailable |
661
+ | `504` | Gateway Timeout | GatewayTimeout |
662
+
663
+ Connection errors (e.g., `ConnectionError`, `ReadTimeoutError`) also trigger retries.
664
+
665
+ ### Retry-After and Rate Limit Headers
666
+
667
+ When rate limiting is enabled (default), the SDK uses response headers to determine how long to wait before retrying. Headers are checked in this order:
668
+
669
+ 1. **`Retry-After`** or **`retry-after`** — Standard HTTP headers. Supports values like `9` (seconds) or `9s`.
670
+ 2. **`x-ratelimit-reset`**, **`X-RateLimit-Reset`**, **`RateLimit-Reset`**, **`X-Rate-Limit-Retry-After-Seconds`** — Product-specific headers indicating seconds until the rate limit resets.
671
+
672
+ If no rate limit header is present, the SDK falls back to **exponential backoff** (base 0.3s, growth factor 2).
673
+
674
+ ---
675
+
676
+ ## Logging
677
+
678
+ SDK logging is controlled by environment variables (see [Environment Variables](#environment-variables)) or a `LoggerConfig` object.
679
+
680
+ ### Log format (`ZSSDK_LOG_FORMAT`)
681
+
682
+ The `logging_format` setting supports three values:
683
+
684
+ | Format | Description |
685
+ |-----------|-----------------------------------------------------------------------------|
686
+ | `basic` | Human-readable lines: `%(asctime)s - %(name)s - %(module)s - %(levelname)s - %(message)s`. Default format. |
687
+ | `json` | Structured JSON output, one record per line, suitable for log aggregators (e.g., Grafana Loki). |
688
+ | `custom` | Use your own `logging.Formatter` instance. **Only available programmatically** via `LoggerConfig`; requires passing `custom_formatter` and cannot be set via environment variables. |
689
+
690
+ **Environment variables example:**
691
+
692
+ ```sh
693
+ export ZSSDK_LOG_ENABLED=true
694
+ export ZSSDK_LOG_VERBOSE=false
695
+ export ZSSDK_LOG_TO_FILE=false
696
+ export ZSSDK_LOG_FILE_PATH=zssdk.log
697
+ export ZSSDK_LOG_FORMAT=basic
698
+ ```
699
+
700
+ **Programmatic configuration:**
701
+
702
+ ```python
703
+ from zssdk.zscore.config import Config, LoggerConfig
704
+
705
+ config = Config(
706
+ logger_config=LoggerConfig(
707
+ enabled=True,
708
+ verbose=False,
709
+ logging_format="json",
710
+ log_to_file=True,
711
+ log_file_path="/var/log/zssdk.log",
712
+ )
713
+ )
714
+ session = Session(config=config, profile_name="default")
715
+ ```
716
+
717
+ **Custom format (programmatic only):**
718
+
719
+ ```python
720
+ import logging
721
+ from zssdk.zscore.config import Config, LoggerConfig
722
+
723
+ custom_formatter = logging.Formatter("%(levelname)s | %(message)s")
724
+ config = Config(
725
+ logger_config=LoggerConfig(
726
+ enabled=True,
727
+ logging_format="custom",
728
+ custom_formatter=custom_formatter,
729
+ )
730
+ )
731
+ session = Session(config=config, profile_name="default")
732
+ ```
733
+
734
+ Sensitive fields (tokens, secrets, passwords) are redacted in log output.
735
+
736
+ ---
737
+
738
+ ## Auto-completion and IntelliSense
739
+
740
+ The SDK ships with PEP 484 [type stub](https://peps.python.org/pep-0484/) files (`.pyi`) that enable rich IDE support. Compatible editors (e.g., VS Code with Pylance, PyCharm) automatically use these stubs for:
741
+
742
+ - **Auto-completion** — As you type `session.zia.` or `cred.`, the IDE suggests available resources, methods, and properties.
743
+ - **Parameter hints** — Method signatures and parameter names appear in tooltips.
744
+ - **Docstrings** — Resource and method documentation is shown in hover tooltips.
745
+ - **Type checking** — Static type checkers (e.g., Pyright, mypy) can validate your code.
746
+
747
+ ### What You Get
748
+
749
+ | Location | Stub file(s) | Purpose |
750
+ |-----------------------|------------------------|----------------------------------------------|
751
+ | Session / services | `session.pyi` | `session.zia`, `session.zid`, etc. |
752
+ | ZIA resources | `zia_resources.pyi` | `VpnCredential`, `AdminUser`, collections |
753
+ | ZID resources | `zid_resources.pyi` | `UserProfile`, `Group`, `ApiClient` |
754
+ | ZPA, ZCC, ZDX, ZTW | `*_resources.pyi` | Product-specific resources and methods |
755
+ | Low-level clients | `*_client.pyi` | Service client method signatures |
756
+
757
+ ### Setup
758
+
759
+ No additional setup is required. The stubs are part of the installed package and are picked up automatically by IDEs that support PEP 484. Ensure your IDE's Python interpreter points to the environment where `zscaler-sdk-python` is installed.
760
+
761
+ ### Example
762
+
763
+ When you type `session.zia.` in VS Code or PyCharm, you will see completions for resources such as `VpnCredential`, `AdminUser`, `vpn_credentials`, and `admin_users`. Selecting a resource shows its available properties and methods (e.g., `create()`, `load()`, `update()`, `delete()`).
764
+
765
+ ---
766
+
767
+ ## Examples
768
+
769
+ The repository includes runnable CLI scripts and inline examples under `examples/`, organized by product. Prerequisites and configuration are covered in the [Configuration](#configuration) section above.
770
+
771
+ All CLI scripts are self-documenting. Run any script with no arguments for a usage hint, or `--help` for the full reference:
772
+
773
+ ```sh
774
+ python examples/zid/user_management/user_management.py --help
775
+ python examples/zia/vpn_credentials_management/vpn_credentials_management.py --help
776
+ ```
777
+
778
+ ---
779
+
780
+ ## Migrating from zscaler-sdk-python
781
+
782
+ If you are coming from the previous [`zscaler-sdk-python`](https://github.com/zscaler/zscaler-sdk-python) package, here is what changes.
783
+
784
+ ### Installation
785
+
786
+ ```sh
787
+ # Remove the old package
788
+ pip uninstall zscaler-sdk-python
789
+
790
+ # Install the new package
791
+ pip install zscaler-sdk-python
792
+ ```
793
+
794
+ The import name changes from `zscaler` to `zssdk`.
795
+
796
+ ### Authentication
797
+
798
+ **Before:**
799
+
800
+ ```python
801
+ from zscaler import ZscalerClient
802
+
803
+ config = {
804
+ "clientId": "...",
805
+ "clientSecret": "...",
806
+ "vanityDomain": "...",
807
+ "cloud": "beta",
808
+ }
809
+ client = ZscalerClient(config)
810
+ ```
811
+
812
+ **After:**
813
+
814
+ ```python
815
+ from zssdk import Session
816
+
817
+ session = Session(
818
+ client_id="...",
819
+ client_secret="...",
820
+ vanity_domain="...",
821
+ cloud="beta",
822
+ )
823
+ ```
824
+
825
+ Key differences:
826
+ - Constructor uses Python keyword arguments (`snake_case`) instead of a config dictionary (`camelCase`).
827
+ - Configuration can also come from `~/.zscaler/config` (INI format) or environment variables. See [Configuration](#configuration).
828
+
829
+ ### Working with resources
830
+
831
+ **Before** — dict access, error tuples:
832
+
833
+ ```python
834
+ with ZscalerClient(config) as client:
835
+ role, resp, err = client.zia.admin_roles.get_role(role_id="12345")
836
+ if err:
837
+ print(f"Error: {err}")
838
+ else:
839
+ print(role["name"])
840
+ ```
841
+
842
+ **After** — resource objects, exceptions:
843
+
844
+ ```python
845
+ from zssdk.zsresource.exceptions import NotFoundException
846
+
847
+ try:
848
+ role = session.zia.AdminRole(id=12345)
849
+ role.load()
850
+ print(role.name)
851
+ except NotFoundException:
852
+ print("Role not found")
853
+ ```
854
+
855
+ ### Pagination
856
+
857
+ **Before** — manual loop:
858
+
859
+ ```python
860
+ groups, resp, err = client.zia.user_management.list_groups()
861
+ while resp.has_next():
862
+ more, resp, err = resp.next()
863
+ if err:
864
+ break
865
+ groups.extend(more)
866
+ ```
867
+
868
+ **After** — iterator with chaining:
869
+
870
+ ```python
871
+ # All groups, paginated automatically
872
+ for group in session.zia.admin_roles.all():
873
+ print(group.name)
874
+
875
+ # With server-side filter and limit
876
+ for group in session.zia.admin_roles.filter(search="API").limit(50):
877
+ print(group.name)
878
+ ```
879
+
880
+ ### Configuration
881
+
882
+ **Before** — YAML file at `~/.zscaler/zscaler.yaml`:
883
+
884
+ ```yaml
885
+ zscaler:
886
+ client:
887
+ clientId: "..."
888
+ clientSecret: "..."
889
+ vanityDomain: "..."
890
+ ```
891
+
892
+ **After** — INI file at `~/.zscaler/config`:
893
+
894
+ ```ini
895
+ [default]
896
+ vanity_domain = ...
897
+ client_id = ...
898
+ client_secret = ...
899
+ ```
900
+
901
+ ### Quick reference
902
+
903
+ | What | `zscaler-sdk-python` v1 | `zscaler-sdk-python` v2 |
904
+ |---|---|---|
905
+ | Import | `from zscaler import ZscalerClient` | `from zssdk import Session` |
906
+ | Access field | `user["name"]` | `user.name` |
907
+ | Create resource | `client.zia.admin_roles.add_role(name="X")` | `role = session.zia.AdminRole(); role.name = "X"; role.create()` |
908
+ | Delete resource | `client.zia.admin_roles.delete_role(role_id="123")` | `role = session.zia.AdminRole(id=123); role.delete()` |
909
+ | Handle error | `result, resp, err = ...; if err: ...` | `try: ... except NotFoundException: ...` |
910
+ | Paginate | `while resp.has_next(): resp.next()` | `for item in collection.all():` |
911
+ | Filter | `query_params={"search": "X"}` | `.filter(search="X")` or `.search("[?name=='X']")` |
912
+ | Config file | `~/.zscaler/zscaler.yaml` | `~/.zscaler/config` (INI) |
913
+
914
+ ---
915
+
916
+ ## Contributing
917
+
918
+ Contributions are welcome. Please follow the project's coding standards and submit pull requests via the repository's normal workflow.
919
+
920
+ ---
921
+
922
+ ## Need Help?
923
+
924
+ - [Zscaler Community](https://community.zscaler.com/)
925
+ - [OneAPI Documentation](https://help.zscaler.com/oneapi/understanding-oneapi)
926
+ - [Zscaler Identity API](https://help.zscaler.com/zidentity/getting-started-zidentity-api)
927
+ - [ZIA API](https://help.zscaler.com/zia/getting-started-zia-api)
928
+ - [Automation Docs](http://automation.zsapidocs.net/docs/)