zscaler-sdk-python 1.0.0__py2.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 (75) hide show
  1. zscaler/__init__.py +34 -0
  2. zscaler/cache/__init__.py +0 -0
  3. zscaler/cache/cache.py +105 -0
  4. zscaler/cache/no_op_cache.py +68 -0
  5. zscaler/cache/zscaler_cache.py +161 -0
  6. zscaler/constants.py +26 -0
  7. zscaler/errors/__init__.py +0 -0
  8. zscaler/errors/error.py +10 -0
  9. zscaler/errors/http_error.py +20 -0
  10. zscaler/errors/zscaler_api_error.py +24 -0
  11. zscaler/exceptions/__init__.py +1 -0
  12. zscaler/exceptions/exceptions.py +101 -0
  13. zscaler/logger.py +57 -0
  14. zscaler/ratelimiter/__init__.py +0 -0
  15. zscaler/ratelimiter/ratelimiter.py +39 -0
  16. zscaler/user_agent.py +23 -0
  17. zscaler/utils.py +577 -0
  18. zscaler/zia/__init__.py +657 -0
  19. zscaler/zia/activate.py +52 -0
  20. zscaler/zia/admin_and_role_management.py +344 -0
  21. zscaler/zia/apptotal.py +71 -0
  22. zscaler/zia/audit_logs.py +95 -0
  23. zscaler/zia/authentication_settings.py +98 -0
  24. zscaler/zia/client.py +88 -0
  25. zscaler/zia/cloud_apps.py +406 -0
  26. zscaler/zia/device_management.py +90 -0
  27. zscaler/zia/dlp.py +784 -0
  28. zscaler/zia/errors.py +37 -0
  29. zscaler/zia/firewall.py +1104 -0
  30. zscaler/zia/forwarding_control.py +271 -0
  31. zscaler/zia/isolation_profile.py +83 -0
  32. zscaler/zia/labels.py +180 -0
  33. zscaler/zia/locations.py +661 -0
  34. zscaler/zia/sandbox.py +180 -0
  35. zscaler/zia/security.py +236 -0
  36. zscaler/zia/ssl_inspection.py +175 -0
  37. zscaler/zia/traffic.py +853 -0
  38. zscaler/zia/url_categories.py +442 -0
  39. zscaler/zia/url_filtering.py +310 -0
  40. zscaler/zia/users.py +386 -0
  41. zscaler/zia/web_dlp.py +295 -0
  42. zscaler/zia/workload_groups.py +58 -0
  43. zscaler/zia/zpa_gateway.py +187 -0
  44. zscaler/zpa/__init__.py +683 -0
  45. zscaler/zpa/app_segments.py +331 -0
  46. zscaler/zpa/app_segments_inspection.py +311 -0
  47. zscaler/zpa/app_segments_pra.py +310 -0
  48. zscaler/zpa/certificates.py +234 -0
  49. zscaler/zpa/client.py +113 -0
  50. zscaler/zpa/cloud_connector_groups.py +75 -0
  51. zscaler/zpa/connectors.py +518 -0
  52. zscaler/zpa/emergency_access.py +178 -0
  53. zscaler/zpa/errors.py +37 -0
  54. zscaler/zpa/idp.py +83 -0
  55. zscaler/zpa/inspection.py +1012 -0
  56. zscaler/zpa/isolation_profile.py +85 -0
  57. zscaler/zpa/lss.py +568 -0
  58. zscaler/zpa/machine_groups.py +79 -0
  59. zscaler/zpa/policies.py +848 -0
  60. zscaler/zpa/posture_profiles.py +122 -0
  61. zscaler/zpa/privileged_remote_access.py +862 -0
  62. zscaler/zpa/provisioning.py +271 -0
  63. zscaler/zpa/saml_attributes.py +100 -0
  64. zscaler/zpa/scim_attributes.py +117 -0
  65. zscaler/zpa/scim_groups.py +146 -0
  66. zscaler/zpa/segment_groups.py +191 -0
  67. zscaler/zpa/server_groups.py +217 -0
  68. zscaler/zpa/servers.py +202 -0
  69. zscaler/zpa/service_edges.py +404 -0
  70. zscaler/zpa/trusted_networks.py +127 -0
  71. zscaler_sdk_python-1.0.0.dist-info/LICENSE.md +21 -0
  72. zscaler_sdk_python-1.0.0.dist-info/METADATA +59 -0
  73. zscaler_sdk_python-1.0.0.dist-info/RECORD +75 -0
  74. zscaler_sdk_python-1.0.0.dist-info/WHEEL +6 -0
  75. zscaler_sdk_python-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,122 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # Copyright (c) 2023, Zscaler Inc.
4
+ #
5
+ # Permission to use, copy, modify, and/or distribute this software for any
6
+ # purpose with or without fee is hereby granted, provided that the above
7
+ # copyright notice and this permission notice appear in all copies.
8
+ #
9
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+
18
+ from box import Box, BoxList
19
+ from requests import Response
20
+
21
+ from zscaler.utils import remove_cloud_suffix
22
+
23
+ from . import ZPAClient
24
+
25
+
26
+ class PostureProfilesAPI:
27
+ def __init__(self, client: ZPAClient):
28
+ self.rest = client
29
+
30
+ def list_profiles(self, **kwargs) -> BoxList:
31
+ """
32
+ Returns a list of all configured posture profiles.
33
+
34
+ Keyword Args:
35
+ max_items (int):
36
+ The maximum number of items to request before stopping iteration.
37
+ max_pages (int):
38
+ The maximum number of pages to request before stopping iteration.
39
+ pagesize (int):
40
+ Specifies the page size. The default size is 20, but the maximum size is 500.
41
+ search (str, optional):
42
+ The search string used to match against features and fields.
43
+
44
+ Returns:
45
+ BoxList: A list of all configured posture profiles.
46
+
47
+ Examples:
48
+ >>> for posture_profile in zpa.posture_profiles.list_profiles():
49
+ ... pprint(posture_profile)
50
+ """
51
+ list, _ = self.rest.get_paginated_data(
52
+ path="/posture", **kwargs, api_version="v2"
53
+ )
54
+ return list
55
+
56
+ def get_profile_by_name(self, name):
57
+ profiles = self.list_profiles()
58
+ for profile in profiles:
59
+ if profile.get("name") == name:
60
+ return profile
61
+ return None
62
+
63
+ def get_profile(self, profile_id: str) -> Box:
64
+ """
65
+ Returns information on the specified posture profiles.
66
+
67
+ Args:
68
+ profile_id (str):
69
+ The unique identifier for the posture profiles.
70
+
71
+ Returns:
72
+ :obj:`Box`: The resource record for the posture profiles.
73
+
74
+ Examples:
75
+ >>> pprint(zpa.posture_profiles.get_profile('99999'))
76
+
77
+ """
78
+ response = self.rest.get("/posture/%s" % (profile_id))
79
+ if isinstance(response, Response):
80
+ status_code = response.status_code
81
+ if status_code != 200:
82
+ return None
83
+ return response
84
+
85
+ def get_udid_by_profile_name(self, search_name: str, **kwargs) -> str:
86
+ """
87
+ Searches for a posture profile by name and returns its posture_udid.
88
+
89
+ Args:
90
+ search_name (str): The name of the posture profile to search for.
91
+
92
+ Keyword Args:
93
+ **kwargs: Additional keyword arguments to pass to the list_profiles method.
94
+
95
+ Returns:
96
+ str: The posture_udid of the found posture profile, or None if not found.
97
+ """
98
+ profiles = self.list_profiles(**kwargs)
99
+ for profile in profiles:
100
+ clean_profile_name = remove_cloud_suffix(profile.get("name"))
101
+ if clean_profile_name == search_name or profile.get("name") == search_name:
102
+ return profile.get("posture_udid")
103
+ return None
104
+
105
+ def get_name_by_posture_udid(self, search_udid: str, **kwargs) -> str:
106
+ """
107
+ Searches for a posture profile by posture_udid and returns its name.
108
+
109
+ Args:
110
+ search_udid (str): The posture_udid of the posture profile to search for.
111
+
112
+ Keyword Args:
113
+ **kwargs: Additional keyword arguments to pass to the list_profiles method.
114
+
115
+ Returns:
116
+ str: The name of the found posture profile, or None if not found.
117
+ """
118
+ profiles = self.list_profiles(**kwargs)
119
+ for profile in profiles:
120
+ if profile.get("posture_udid") == search_udid:
121
+ return profile.get("name")
122
+ return None