zscaler-sdk-python 0.10.3__tar.gz → 0.10.4__tar.gz

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 (100) hide show
  1. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/PKG-INFO +1 -1
  2. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/pyproject.toml +1 -1
  3. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/__init__.py +1 -1
  4. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/__init__.py +61 -170
  5. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/client.py +1 -1
  6. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/cloud_apps.py +9 -2
  7. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/isolation_profile.py +1 -2
  8. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/labels.py +3 -5
  9. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/locations.py +12 -14
  10. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/pac_files.py +4 -6
  11. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/traffic.py +7 -7
  12. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/users.py +3 -5
  13. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/workload_groups.py +2 -4
  14. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/zpa_gateway.py +7 -3
  15. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/LICENSE.md +0 -0
  16. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/README.md +0 -0
  17. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/cache/__init__.py +0 -0
  18. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/cache/cache.py +0 -0
  19. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/cache/no_op_cache.py +0 -0
  20. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/cache/zscaler_cache.py +0 -0
  21. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/constants.py +0 -0
  22. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/errors/__init__.py +0 -0
  23. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/errors/error.py +0 -0
  24. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/errors/http_error.py +0 -0
  25. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/errors/zscaler_api_error.py +0 -0
  26. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/exceptions/__init__.py +0 -0
  27. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/exceptions/exceptions.py +0 -0
  28. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/logger.py +0 -0
  29. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/ratelimiter/__init__.py +0 -0
  30. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/ratelimiter/ratelimiter.py +0 -0
  31. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/user_agent.py +0 -0
  32. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/utils.py +0 -0
  33. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcc/__init__.py +0 -0
  34. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcc/client.py +0 -0
  35. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcc/devices.py +0 -0
  36. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcc/secrets.py +0 -0
  37. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/__init__.py +0 -0
  38. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/activation.py +0 -0
  39. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/admin_and_role_management.py +0 -0
  40. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/client.py +0 -0
  41. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/ecgroups.py +0 -0
  42. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/locations.py +0 -0
  43. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zcon/provisioning.py +0 -0
  44. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/__init__.py +0 -0
  45. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/admin.py +0 -0
  46. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/alerts.py +0 -0
  47. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/apps.py +0 -0
  48. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/devices.py +0 -0
  49. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/filters.py +0 -0
  50. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/inventory.py +0 -0
  51. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/troubleshooting.py +0 -0
  52. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/users.py +0 -0
  53. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zdx/zdx_client.py +0 -0
  54. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/activate.py +0 -0
  55. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/admin_and_role_management.py +0 -0
  56. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/apptotal.py +0 -0
  57. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/audit_logs.py +0 -0
  58. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/authentication_settings.py +0 -0
  59. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/cloudappcontrol.py +0 -0
  60. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/device_management.py +0 -0
  61. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/dlp.py +0 -0
  62. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/errors.py +0 -0
  63. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/firewall.py +0 -0
  64. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/forwarding_control.py +0 -0
  65. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/sandbox.py +0 -0
  66. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/security.py +0 -0
  67. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/ssl_inspection.py +0 -0
  68. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/url_categories.py +0 -0
  69. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/url_filtering.py +0 -0
  70. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zia/web_dlp.py +0 -0
  71. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/README.md +0 -0
  72. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/__init__.py +0 -0
  73. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/app_segments.py +0 -0
  74. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/app_segments_inspection.py +0 -0
  75. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/app_segments_pra.py +0 -0
  76. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/authdomains.py +0 -0
  77. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/certificates.py +0 -0
  78. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/client.py +0 -0
  79. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/cloud_connector_groups.py +0 -0
  80. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/connectors.py +0 -0
  81. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/emergency_access.py +0 -0
  82. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/errors.py +0 -0
  83. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/idp.py +0 -0
  84. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/inspection.py +0 -0
  85. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/isolation.py +0 -0
  86. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/lss.py +0 -0
  87. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/machine_groups.py +0 -0
  88. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/microtenants.py +0 -0
  89. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/policies.py +0 -0
  90. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/posture_profiles.py +0 -0
  91. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/privileged_remote_access.py +0 -0
  92. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/provisioning.py +0 -0
  93. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/saml_attributes.py +0 -0
  94. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/scim_attributes.py +0 -0
  95. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/scim_groups.py +0 -0
  96. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/segment_groups.py +0 -0
  97. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/server_groups.py +0 -0
  98. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/servers.py +0 -0
  99. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/service_edges.py +0 -0
  100. {zscaler_sdk_python-0.10.3 → zscaler_sdk_python-0.10.4}/zscaler/zpa/trusted_networks.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zscaler-sdk-python
3
- Version: 0.10.3
3
+ Version: 0.10.4
4
4
  Summary: Official Python SDK for the Zscaler Products (Beta)
5
5
  Home-page: https://github.com/zscaler/zscaler-sdk-python
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "zscaler-sdk-python"
3
- version = "0.10.3"
3
+ version = "0.10.4"
4
4
  description = "Official Python SDK for the Zscaler Products (Beta)"
5
5
  authors = ["Zscaler, Inc. <devrel@zscaler.com>"]
6
6
  license = "MIT"
@@ -29,7 +29,7 @@ __license__ = "MIT"
29
29
  __contributors__ = [
30
30
  "William Guilherme",
31
31
  ]
32
- __version__ = "0.10.3"
32
+ __version__ = "0.10.4"
33
33
 
34
34
  from zscaler.zdx import ZDXClientHelper # noqa
35
35
  from zscaler.zia import ZIAClientHelper # noqa
@@ -405,11 +405,15 @@ class ZIAClientHelper(ZIAClient):
405
405
  self,
406
406
  path=None,
407
407
  expected_status_code=200,
408
+ limit=None, # OPTIONAL PARAMETER
408
409
  page=None,
410
+ page_number=None, # Snake_case for user input
409
411
  pagesize=None,
410
412
  search=None,
413
+ filter=None,
411
414
  max_items=None, # Maximum number of items to retrieve across pages
412
415
  max_pages=None, # Maximum number of pages to retrieve
416
+ app_segment=None,
413
417
  type=None, # Specify type of VPN credentials (CN, IP, UFQDN, XAUTH)
414
418
  include_only_without_location=None, # Include only VPN credentials not associated with any location
415
419
  location_id=None, # VPN credentials for a specific location ID
@@ -421,22 +425,25 @@ class ZIAClientHelper(ZIAClient):
421
425
 
422
426
  Args:
423
427
  path (str): The API endpoint path to send requests to.
424
- expected_status_code (int): The expected HTTP status code for a successful request. Defaults to 200.
425
- page (int): Specific page number to fetch. Defaults to 1 if not provided.
426
- pagesize (int): Number of items per page, default is 100, with a maximum of 10000.
427
- search (str): Search query to filter the results.
428
- max_items (int): Maximum number of items to retrieve.
429
- max_pages (int): Maximum number of pages to fetch.
430
- type (str, optional): Type of VPN credentials (e.g., CN, IP, UFQDN, XAUTH).
431
- include_only_without_location (bool, optional): Filter to include only VPN credentials not associated with a location.
432
- location_id (int, optional): Retrieve VPN credentials for the specified location ID.
433
- managed_by (int, optional): Retrieve VPN credentials managed by the specified partner.
434
- prefix (int, optional): Retrieve VPN credentials managed by a given partner.
428
+ expected_status_code (int): The expected HTTP status code for a successful request.
429
+ filter (int, optional): Retrieves the list of PAC files without the PAC file content in the response
430
+ limit (int, optional): Number of items to retrieve (sent as 'limit' in the URL construct).
431
+ page (int, optional): Specific page number to fetch (sent as 'page').
432
+ page_number (int, optional): Alternative parameter for specifying a page number (sent as 'pageNumber').
433
+ pagesize (int, optional): Number of items per page (default=1000, sent as 'pageSize').
434
+ search (str, optional): Search query to filter results.
435
+ max_items (int, optional): Maximum number of items to retrieve.
436
+ max_pages (int, optional): Maximum number of pages to fetch.
437
+ type (str, optional): Type of VPN credentials (e.g., CN, IP).
438
+ include_only_without_location (bool, optional): Filter only items w/o location.
439
+ location_id (int, optional): ID of a specific location.
440
+ managed_by (int, optional): Items managed by a given partner.
441
+ prefix (int, optional): Items with partner prefix.
435
442
 
436
443
  Returns:
437
444
  tuple: A tuple containing:
438
- - BoxList: A list of fetched items wrapped in a BoxList for easy access.
439
- - str: An error message if any occurred during the data fetching process.
445
+ - BoxList: A list of fetched items (BoxList).
446
+ - str: An error message if any occurred, else None.
440
447
  """
441
448
  logger = logging.getLogger(__name__)
442
449
 
@@ -446,10 +453,21 @@ class ZIAClientHelper(ZIAClient):
446
453
  }
447
454
 
448
455
  # Initialize parameters
449
- params = {
450
- "page": page if page is not None else 1, # Start at page 1 if not specified
451
- "pageSize": pagesize if pagesize is not None else 100, # Allow any user-defined pagesize
452
- }
456
+ params = {}
457
+
458
+ # Handle 'page' and 'page_number' parameters
459
+ if page is not None:
460
+ params["page"] = page
461
+ elif page_number is not None:
462
+ params["pageNumber"] = page_number # Use camelCase in the URL construct
463
+ else:
464
+ params["page"] = 1 # Default to page 1 if neither is provided
465
+
466
+ # Handle 'limit' and 'pagesize' logic
467
+ if limit is not None:
468
+ params["limit"] = limit # Explicitly use 'limit' in the URL construct
469
+ else:
470
+ params["pageSize"] = pagesize if pagesize is not None else 1000 # Default to 'pageSize'
453
471
 
454
472
  # Add optional filters to the params if provided
455
473
  if search:
@@ -458,33 +476,37 @@ class ZIAClientHelper(ZIAClient):
458
476
  params["type"] = type
459
477
  if include_only_without_location is not None:
460
478
  params["includeOnlyWithoutLocation"] = include_only_without_location
479
+ if app_segment:
480
+ params["appSegment"] = app_segment
461
481
  if location_id:
462
482
  params["locationId"] = location_id
463
483
  if managed_by:
464
484
  params["managedBy"] = managed_by
465
485
  if prefix:
466
486
  params["prefix"] = prefix
487
+ if filter:
488
+ params["filter"] = filter
467
489
 
468
- # If the user specifies a page, fetch only that page
469
- if page is not None:
490
+ # If the user specifies a specific page, fetch only that page.
491
+ if page is not None or page_number is not None:
470
492
  response = self.send("GET", path=path, params=params)
471
493
  if response.status_code != expected_status_code:
472
494
  error_msg = ERROR_MESSAGES["UNEXPECTED_STATUS"].format(
473
- status_code=response.status_code, page=params["page"]
495
+ status_code=response.status_code, page=params.get("page", params.get("pageNumber"))
474
496
  )
475
497
  logger.error(error_msg)
476
498
  return BoxList([]), error_msg
477
499
 
478
500
  response_data = response.json()
479
501
  if not isinstance(response_data, list):
480
- error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params["page"])
481
- logger.warn(error_msg)
502
+ error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params.get("page", params.get("pageNumber")))
503
+ logger.warning(error_msg)
482
504
  return BoxList([]), error_msg
483
505
 
484
506
  data = convert_keys_to_snake(response_data)
485
507
  return BoxList(data), None
486
508
 
487
- # If no page is specified, iterate through pages to fetch all items
509
+ # If no specific page is specified, iterate through pages to fetch all items
488
510
  ret_data = []
489
511
  total_collected = 0
490
512
  try:
@@ -499,7 +521,7 @@ class ZIAClientHelper(ZIAClient):
499
521
  # Check for unexpected status code
500
522
  if response.status_code != expected_status_code:
501
523
  error_msg = ERROR_MESSAGES["UNEXPECTED_STATUS"].format(
502
- status_code=response.status_code, page=params["page"]
524
+ status_code=response.status_code, page=params.get("page", params.get("pageNumber"))
503
525
  )
504
526
  logger.error(error_msg)
505
527
  return BoxList([]), error_msg
@@ -507,177 +529,46 @@ class ZIAClientHelper(ZIAClient):
507
529
  # Parse the response as a flat list of items
508
530
  response_data = response.json()
509
531
  if not isinstance(response_data, list):
510
- error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params["page"])
511
- logger.warn(error_msg)
532
+ error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params.get("page", params.get("pageNumber")))
533
+ logger.warning(error_msg)
512
534
  return BoxList([]), error_msg
513
535
 
514
536
  data = convert_keys_to_snake(response_data)
515
537
 
516
538
  # Limit data collection based on max_items
517
539
  if max_items is not None:
518
- data = data[: max_items - total_collected] # Limit items on the current page
540
+ data = data[: max_items - total_collected]
519
541
  ret_data.extend(data)
520
542
  total_collected += len(data)
521
543
 
522
544
  # Check if we've reached max_items or max_pages limits
523
545
  if (max_items is not None and total_collected >= max_items) or (
524
- max_pages is not None and params["page"] >= max_pages
546
+ max_pages is not None and params.get("page", params.get("pageNumber")) >= max_pages
525
547
  ):
526
548
  break
527
549
 
528
- # Stop if fewer items than pageSize are returned
529
- if len(data) < params["pageSize"]:
550
+ # Stop if fewer items than pageSize or limit are returned
551
+ if "pageSize" in params and len(data) < params["pageSize"]:
552
+ break
553
+ if "limit" in params and len(data) < params["limit"]:
530
554
  break
531
555
 
532
556
  # Move to the next page
533
- params["page"] += 1
557
+ if "page" in params:
558
+ params["page"] += 1
559
+ elif "pageNumber" in params:
560
+ params["pageNumber"] += 1
534
561
 
535
562
  finally:
536
- time.sleep(2) # Ensure a delay between requests regardless of outcome
563
+ time.sleep(2) # Ensure a delay between requests, regardless of outcome
537
564
 
538
565
  if not ret_data:
539
- error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params["page"])
540
- logger.warn(error_msg)
566
+ error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params.get("page", params.get("pageNumber")))
567
+ logger.warning(error_msg)
541
568
  return BoxList([]), error_msg
542
569
 
543
570
  return BoxList(ret_data), None
544
571
 
545
-
546
- # def get_paginated_data(
547
- # self,
548
- # path=None,
549
- # expected_status_code=200,
550
- # page=None,
551
- # pagesize=None,
552
- # search=None,
553
- # max_items=None, # Maximum number of items to retrieve across pages
554
- # max_pages=None, # Maximum number of pages to retrieve
555
- # type=None, # Specify type of VPN credentials (CN, IP, UFQDN, XAUTH)
556
- # include_only_without_location=None, # Include only VPN credentials not associated with any location
557
- # location_id=None, # VPN credentials for a specific location ID
558
- # managed_by=None, # VPN credentials managed by a given partner
559
- # prefix=None, # VPN credentials managed by a given partner
560
- # ):
561
- # """
562
- # Fetches paginated data from the API based on specified parameters and handles pagination.
563
-
564
- # Args:
565
- # path (str): The API endpoint path to send requests to.
566
- # expected_status_code (int): The expected HTTP status code for a successful request. Defaults to 200.
567
- # page (int): Specific page number to fetch. Defaults to 1 if not provided.
568
- # pagesize (int): Number of items per page, default is 100, with a maximum of 1000.
569
- # search (str): Search query to filter the results.
570
- # max_items (int): Maximum number of items to retrieve.
571
- # max_pages (int): Maximum number of pages to fetch.
572
- # type (str, optional): Type of VPN credentials (e.g., CN, IP, UFQDN, XAUTH).
573
- # include_only_without_location (bool, optional): Filter to include only VPN credentials not associated with a location.
574
- # location_id (int, optional): Retrieve VPN credentials for the specified location ID.
575
- # managed_by (int, optional): Retrieve VPN credentials managed by the specified partner.
576
- # prefix (int, optional): Retrieve VPN credentials managed by the specified partner.
577
-
578
- # Returns:
579
- # tuple: A tuple containing:
580
- # - BoxList: A list of fetched items wrapped in a BoxList for easy access.
581
- # - str: An error message if any occurred during the data fetching process.
582
- # """
583
- # logger = logging.getLogger(__name__)
584
-
585
- # ERROR_MESSAGES = {
586
- # "UNEXPECTED_STATUS": "Unexpected status code {status_code} received for page {page}.",
587
- # "EMPTY_RESULTS": "No results found for page {page}.",
588
- # }
589
-
590
- # # Initialize pagination parameters
591
- # # params = {
592
- # # "page": page if page is not None else 1, # Start at page 1 if not specified
593
- # # "pagesize": min(pagesize if pagesize is not None else 100, max_page_size), # Apply max_page_size limit
594
- # # }
595
-
596
- # params = {
597
- # "page": page if page is not None else 1, # Start at page 1 if not specified
598
- # "pagesize": max(100, min(pagesize or 100, 10000)), # Ensure pagesize is within API limits
599
- # }
600
-
601
- # # Add optional filters to the params if provided
602
- # if search:
603
- # params["search"] = search
604
- # if type:
605
- # params["type"] = type
606
- # if include_only_without_location is not None:
607
- # params["includeOnlyWithoutLocation"] = include_only_without_location
608
- # if location_id:
609
- # params["locationId"] = location_id
610
- # if managed_by:
611
- # params["managedBy"] = managed_by
612
- # if prefix:
613
- # params["prefix"] = prefix
614
-
615
- # ret_data = []
616
- # total_collected = 0
617
-
618
- # try:
619
- # while True:
620
- # # Apply rate-limiting if necessary
621
- # should_wait, delay = self.rate_limiter.wait("GET")
622
- # if should_wait:
623
- # time.sleep(delay)
624
-
625
- # # Send the request to the API
626
- # response = self.send("GET", path=path, params=params)
627
-
628
- # # Check for unexpected status code
629
- # if response.status_code != expected_status_code:
630
- # error_msg = ERROR_MESSAGES["UNEXPECTED_STATUS"].format(
631
- # status_code=response.status_code, page=params["page"]
632
- # )
633
- # logger.error(error_msg)
634
- # return BoxList([]), error_msg
635
-
636
- # # Parse the response as a flat list of items
637
- # response_data = response.json()
638
- # if not isinstance(response_data, list):
639
- # error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params["page"])
640
- # logger.warn(error_msg)
641
- # return BoxList([]), error_msg
642
-
643
- # data = convert_keys_to_snake(response_data)
644
-
645
- # # If searching for a specific item, stop if we find a match
646
- # if search:
647
- # for item in data:
648
- # if item.get("name") == search:
649
- # ret_data.append(item)
650
- # return BoxList(ret_data), None
651
-
652
- # # Limit data collection based on max_items
653
- # if max_items is not None:
654
- # data = data[: max_items - total_collected] # Limit items on the current page
655
- # ret_data.extend(data)
656
- # total_collected += len(data)
657
-
658
- # # Check if we've reached max_items or max_pages limits
659
- # if (max_items is not None and total_collected >= max_items) or (
660
- # max_pages is not None and params["page"] >= max_pages
661
- # ):
662
- # break
663
-
664
- # # Stop if we've processed all available pages (i.e., less than requested page size)
665
- # if len(data) < params["pagesize"]:
666
- # break
667
-
668
- # # Move to the next page
669
- # params["page"] += 1
670
-
671
- # finally:
672
- # time.sleep(2) # Ensure a delay between requests regardless of outcome
673
-
674
- # if not ret_data:
675
- # error_msg = ERROR_MESSAGES["EMPTY_RESULTS"].format(page=params["page"])
676
- # logger.warn(error_msg)
677
- # return BoxList([]), error_msg
678
-
679
- # return BoxList(ret_data), None
680
-
681
572
  @property
682
573
  def admin_and_role_management(self):
683
574
  """
@@ -34,7 +34,7 @@ class ZIAClient:
34
34
  self,
35
35
  path: str = None,
36
36
  data_key_name: str = None,
37
- data_per_page: int = 500,
37
+ data_per_page: int = 1000,
38
38
  expected_status_code=200,
39
39
  ):
40
40
  """
@@ -367,10 +367,16 @@ class CloudAppsAPI:
367
367
 
368
368
  return self.rest.post(f"shadowIT/applications/{entity}/exportCsv", json=payload).text
369
369
 
370
- def list_apps(self):
370
+ def list_apps(self, **kwargs):
371
371
  """
372
372
  List all predefined and custom cloud applications by name and id.
373
373
 
374
+ Keyword Args:
375
+ **limit (int, optional):
376
+ Specifies the maximum number of cloud applications that must be retrieved in a page. The maximum size is 1000
377
+ **page_number (int, optional):
378
+ Specifies the page number. The numbering starts at 0.
379
+
374
380
  Returns:
375
381
  :obj:`BoxList` of :obj:`Box`: A list of cloud applications.
376
382
 
@@ -382,7 +388,8 @@ class CloudAppsAPI:
382
388
  print(app.name)
383
389
 
384
390
  """
385
- return self.rest.get("cloudApplications/lite")
391
+ list, _ = self.rest.get_paginated_data(path="/cloudApplications/lite", **kwargs)
392
+ return list
386
393
 
387
394
  def list_custom_tags(self):
388
395
  """
@@ -17,7 +17,6 @@
17
17
 
18
18
  from box import BoxList
19
19
 
20
- from zscaler.utils import snake_to_camel
21
20
  from zscaler.zia.client import ZIAClient
22
21
 
23
22
 
@@ -25,7 +24,7 @@ class IsolationProfileAPI:
25
24
  def __init__(self, client: ZIAClient):
26
25
  self.rest = client
27
26
 
28
- def list_isolation_profiles(self, **kwargs) -> BoxList:
27
+ def list_isolation_profiles(self) -> BoxList:
29
28
  """
30
29
  Returns a list of all profiles in the Isolation Profile field for URL Filtering rules and Cloud App Control rules.
31
30
 
@@ -31,11 +31,9 @@ class RuleLabelsAPI:
31
31
  Returns the list of ZIA Rule Labels.
32
32
 
33
33
  Keyword Args:
34
- **max_items (int, optional):
35
- The maximum number of items to request before stopping iteration.
36
- **max_pages (int, optional):
37
- The maximum number of pages to request before stopping iteration.
38
- **page_size (int, optional):
34
+ **page (int, optional):
35
+ Specifies the page offset.
36
+ **pagesize (int, optional):
39
37
  Specifies the page size. The default size is 100, but the maximum size is 1000.
40
38
 
41
39
  Returns:
@@ -35,11 +35,9 @@ class LocationsAPI:
35
35
  Filter based on whether the Enforce Authentication setting is enabled or disabled for a location.
36
36
  **bw_enforced (bool, optional):
37
37
  Filter based on whether Bandwith Control is being enforced for a location.
38
- **max_items (int, optional):
39
- The maximum number of items to request before stopping iteration.
40
- **max_pages (int, optional):
41
- The maximum number of pages to request before stopping iteration.
42
- **page_size (int, optional):
38
+ **page (int, optional):
39
+ Specifies the page offset.
40
+ **pagesize (int, optional):
43
41
  Specifies the page size. The default size is 100, but the maximum size is 1000.
44
42
  **search (str, optional):
45
43
  The search string used to partially match against a location's name and port attributes.
@@ -60,7 +58,7 @@ class LocationsAPI:
60
58
 
61
59
  List locations, returning 200 items per page for a maximum of 2 pages:
62
60
 
63
- >>> for location in zia.locations.list_locations(page_size=200, max_pages=2):
61
+ >>> for location in zia.locations.list_locations(pagesize=200, max_pages=2):
64
62
  ... print(location)
65
63
 
66
64
  """
@@ -243,7 +241,7 @@ class LocationsAPI:
243
241
  The maximum number of items to request before stopping iteration.
244
242
  **max_pages (int, optional):
245
243
  The maximum number of pages to request before stopping iteration.
246
- **page_size (int, optional):
244
+ **pagesize (int, optional):
247
245
  Specifies the page size. The default size is 100, but the maximum size is 1000.
248
246
  **search (str, optional):
249
247
  The search string used to partially match against a location's name and port attributes.
@@ -274,7 +272,7 @@ class LocationsAPI:
274
272
  The maximum number of items to request before stopping iteration.
275
273
  **max_pages (int, optional):
276
274
  The maximum number of pages to request before stopping iteration.
277
- **page_size (int, optional):
275
+ **pagesize (int, optional):
278
276
  Specifies the page size. The default size is 100, but the maximum size is 1000.
279
277
  **search (str, optional):
280
278
  The search string used to partially match against a location's name and port attributes.
@@ -295,7 +293,7 @@ class LocationsAPI:
295
293
 
296
294
  List locations, returning 200 items per page for a maximum of 2 pages:
297
295
 
298
- >>> for location in zia.locations.list_locations_lite(page_size=200, max_pages=2):
296
+ >>> for location in zia.locations.list_locations_lite(pagesize=200, max_pages=2):
299
297
  ... print(location)
300
298
 
301
299
  """
@@ -518,7 +516,7 @@ class LocationsAPI:
518
516
  """
519
517
  return self.rest.get(f"locations/groups/{group_id}")
520
518
 
521
- def list_location_groups_lite(self, page: int = 1, page_size: int = 100) -> BoxList:
519
+ def list_location_groups_lite(self, **kwargs) -> BoxList:
522
520
  """
523
521
  Returns a list of location groups (lite version) by their ID where only name and ID is returned in ZIA.
524
522
 
@@ -535,8 +533,8 @@ class LocationsAPI:
535
533
  Get a list of all configured location groups:
536
534
  >>> location = zia.locations.list_location_groups_lite()
537
535
  """
538
- params = {"page": page, "pageSize": page_size}
539
- return self.rest.get("locations/groups/lite", params=params)
536
+ list, _ = self.rest.get_paginated_data(path="/locations/groups/lite", **kwargs)
537
+ return list
540
538
 
541
539
  def get_location_group_lite_by_id(self, group_id: int) -> Box:
542
540
  """
@@ -633,12 +631,12 @@ class LocationsAPI:
633
631
  country, postal code, etc.
634
632
 
635
633
  Args:
636
- **kwargs: Optional keyword arguments including 'prefix', 'page', and 'page_size'.
634
+ **kwargs: Optional keyword arguments including 'prefix', 'page', and 'pagesize'.
637
635
 
638
636
  Keyword Args:
639
637
  prefix (str): The prefix string to search for cities.
640
638
  page (int): The page number of the results.
641
- page_size (int): The number of results per page.
639
+ pagesize (int): The number of results per page.
642
640
 
643
641
  Returns:
644
642
  :obj:`BoxList`: The list of cities (along with their geographical data) that match the prefix search.
@@ -31,12 +31,10 @@ class PacFilesAPI:
31
31
  Returns the list of ZIA Pac Files.
32
32
 
33
33
  Keyword Args:
34
- **max_items (int, optional):
35
- The maximum number of items to request before stopping iteration.
36
- **max_pages (int, optional):
37
- The maximum number of pages to request before stopping iteration.
38
- **page_size (int, optional):
39
- Specifies the page size. The default size is 100, but the maximum size is 1000.
34
+ **filter (int, optional):
35
+ Retrieves the list of PAC files without the PAC file content in the response
36
+ **search (str, optional):
37
+ Returns PAC files with the names that match the search criteria
40
38
 
41
39
  Returns:
42
40
  :obj:`BoxList`: The list of PAC Files configured in ZIA.
@@ -58,7 +58,8 @@ class TrafficForwardingAPI:
58
58
  ... print(tunnel)
59
59
 
60
60
  """
61
- return BoxList(Iterator(self.rest, "greTunnels", **kwargs))
61
+ list, _ = self.rest.get_paginated_data(path="/greTunnels", **kwargs)
62
+ return list
62
63
 
63
64
  def get_gre_tunnel(self, tunnel_id: str) -> Box:
64
65
  """
@@ -230,11 +231,9 @@ class TrafficForwardingAPI:
230
231
  **include (str, optional):
231
232
  Include all, private, or public VIPs in the list. Available choices are `all`, `private`, `public`.
232
233
  Defaults to `public`.
233
- **max_items (int, optional):
234
- The maximum number of items to request before stopping iteration.
235
- **max_pages (int, optional):
236
- The maximum number of pages to request before stopping iteration.
237
- **page_size (int, optional):
234
+ **page (int, optional):
235
+ Specifies the page offset.
236
+ **pagesize (int, optional):
238
237
  Specifies the page size. The default size is 100, but the maximum size is 1000.
239
238
  **region (str, optional):
240
239
  Filter based on region.
@@ -259,7 +258,8 @@ class TrafficForwardingAPI:
259
258
  ... print(vip)
260
259
 
261
260
  """
262
- return BoxList(Iterator(self.rest, "vips", **kwargs))
261
+ list, _ = self.rest.get_paginated_data(path="/vips", **kwargs)
262
+ return list
263
263
 
264
264
  def add_gre_tunnel(
265
265
  self,
@@ -163,13 +163,11 @@ class UserManagementAPI:
163
163
  Filters by department name. This is a `starts with` match.
164
164
  **group (str, optional):
165
165
  Filters by group name. This is a `starts with` match.
166
- **max_items (int, optional):
167
- The maximum number of items to request before stopping iteration.
168
- **max_pages (int, optional):
169
- The maximum number of pages to request before stopping iteration.
170
166
  **name (str, optional):
171
167
  Filters by user name. This is a `partial` match.
172
- **page_size (int, optional):
168
+ **page (int, optional):
169
+ Specifies the page offset.
170
+ **pagesize (int, optional):
173
171
  Specifies the page size. The default size is 100, but the maximum size is 10000.
174
172
  **sort_by (str):
175
173
  The field name to sort by, supported values: id, name, creationTime or modifiedTime (default to name)
@@ -36,10 +36,8 @@ class WorkloadGroupsAPI:
36
36
  ... pprint(workloads)
37
37
 
38
38
  """
39
- response = self.rest.get("/workloadGroups")
40
- if isinstance(response, Response):
41
- return None
42
- return response
39
+ list, _ = self.rest.get_paginated_data(path="/workloadGroups", **kwargs)
40
+ return list
43
41
 
44
42
  # Search Workload Group By Name
45
43
  def get_group_by_name(self, name):
@@ -29,8 +29,11 @@ class ZPAGatewayAPI:
29
29
  """
30
30
  Returns a list of all ZPA Gateways.
31
31
 
32
- Returns:
33
- :obj:`BoxList`: The list of all ZPA Gateways Items
32
+ Keyword Args:
33
+ **app_segment (list, optional):
34
+ Filters the list by Application Segment
35
+ **search (str, optional):
36
+ The search string used to match against a ZPA gateway name or an associated Server Group name
34
37
 
35
38
  Returns:
36
39
  :obj:`BoxList`: The list of all ZPA Gateways Items
@@ -42,7 +45,8 @@ class ZPAGatewayAPI:
42
45
  ... for item in results:
43
46
  ... print(item)
44
47
  """
45
- return self.rest.get("zpaGateways")
48
+ list, _ = self.rest.get_paginated_data(path="/zpaGateways", **kwargs)
49
+ return list
46
50
 
47
51
  def get_gateway(self, gateway_id: str) -> Box:
48
52
  """