zscaler-sdk-python 0.3.0__tar.gz → 0.3.1__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.
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/PKG-INFO +3 -2
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/pyproject.toml +4 -3
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/__init__.py +1 -1
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/cache/zscaler_cache.py +1 -1
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/__init__.py +79 -63
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/app_segments.py +2 -1
- zscaler_sdk_python-0.3.0/zscaler/zpa/policiesv2.py → zscaler_sdk_python-0.3.1/zscaler/zpa/policies.py +1433 -228
- zscaler_sdk_python-0.3.0/zscaler/zpa/policies.py +0 -857
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/LICENSE.md +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/README.md +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/cache/__init__.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/cache/cache.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/cache/no_op_cache.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/constants.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/errors/__init__.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/errors/error.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/errors/http_error.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/errors/zscaler_api_error.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/exceptions/__init__.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/exceptions/exceptions.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/logger.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/ratelimiter/__init__.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/ratelimiter/ratelimiter.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/user_agent.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/utils.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/__init__.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/activate.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/admin_and_role_management.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/apptotal.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/audit_logs.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/authentication_settings.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/client.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/cloud_apps.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/device_management.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/dlp.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/errors.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/firewall.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/forwarding_control.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/isolation_profile.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/labels.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/locations.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/sandbox.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/security.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/ssl_inspection.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/traffic.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/url_categories.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/url_filtering.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/users.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/web_dlp.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/workload_groups.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zia/zpa_gateway.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/README.md +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/app_segments_inspection.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/app_segments_pra.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/certificates.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/client.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/cloud_connector_groups.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/connectors.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/emergency_access.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/errors.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/idp.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/inspection.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/isolation.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/lss.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/machine_groups.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/posture_profiles.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/privileged_remote_access.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/provisioning.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/saml_attributes.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/scim_attributes.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/scim_groups.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/segment_groups.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/server_groups.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/servers.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/zscaler/zpa/service_edges.py +0 -0
- {zscaler_sdk_python-0.3.0 → zscaler_sdk_python-0.3.1}/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.3.
|
|
3
|
+
Version: 0.3.1
|
|
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
|
|
@@ -23,13 +23,14 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
23
|
Provides-Extra: dev
|
|
24
24
|
Requires-Dist: aenum ; extra == "dev"
|
|
25
25
|
Requires-Dist: arrow
|
|
26
|
-
Requires-Dist: black ; extra == "dev"
|
|
26
|
+
Requires-Dist: black (>=24.3.0) ; extra == "dev"
|
|
27
27
|
Requires-Dist: certifi
|
|
28
28
|
Requires-Dist: charset-normalizer
|
|
29
29
|
Requires-Dist: cryptography (>=3.4,<43.0)
|
|
30
30
|
Requires-Dist: flake8
|
|
31
31
|
Requires-Dist: flatdict
|
|
32
32
|
Requires-Dist: idna
|
|
33
|
+
Requires-Dist: okta (>=2.9.7)
|
|
33
34
|
Requires-Dist: pycryptodomex
|
|
34
35
|
Requires-Dist: pydash ; extra == "dev"
|
|
35
36
|
Requires-Dist: python-box (>=7.1.1,<8.0.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "zscaler-sdk-python"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = "Official Python SDK for the Zscaler Products (Beta)"
|
|
5
5
|
authors = ["Zscaler, Inc. <devrel@zscaler.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -48,11 +48,12 @@ aenum = "*"
|
|
|
48
48
|
pydash = "*"
|
|
49
49
|
flake8 = "*"
|
|
50
50
|
pytz = "*"
|
|
51
|
-
black = "
|
|
51
|
+
black = ">=24.3.0"
|
|
52
52
|
cryptography = ">=3.4,<43.0"
|
|
53
|
+
okta = ">=2.9.7"
|
|
53
54
|
|
|
54
55
|
[tool.poetry.dev-dependencies]
|
|
55
|
-
black = "24.3.0"
|
|
56
|
+
black = ">=24.3.0"
|
|
56
57
|
pytest = "^8.2.1"
|
|
57
58
|
pytest-asyncio = ">=0.23.7"
|
|
58
59
|
pytest-mock = "*"
|
|
@@ -40,7 +40,6 @@ from zscaler.zpa.isolation import IsolationAPI
|
|
|
40
40
|
from zscaler.zpa.lss import LSSConfigControllerAPI
|
|
41
41
|
from zscaler.zpa.machine_groups import MachineGroupsAPI
|
|
42
42
|
from zscaler.zpa.policies import PolicySetsAPI
|
|
43
|
-
from zscaler.zpa.policiesv2 import PolicySetsV2API
|
|
44
43
|
from zscaler.zpa.posture_profiles import PostureProfilesAPI
|
|
45
44
|
from zscaler.zpa.privileged_remote_access import PrivilegedRemoteAccessAPI
|
|
46
45
|
from zscaler.zpa.provisioning import ProvisioningKeyAPI
|
|
@@ -118,6 +117,7 @@ class ZPAClientHelper(ZPAClient):
|
|
|
118
117
|
self.v2_lss_url = f"{self.baseurl}/mgmtconfig/v2/admin/lssConfig/customers/{customer_id}"
|
|
119
118
|
self.cbi_url = f"{self.baseurl}/cbiconfig/cbi/api/customers/{customer_id}"
|
|
120
119
|
self.fail_safe = fail_safe
|
|
120
|
+
|
|
121
121
|
# Cache setup
|
|
122
122
|
cache_enabled = os.environ.get("ZSCALER_CLIENT_CACHE_ENABLED", "true").lower() == "true"
|
|
123
123
|
if cache is None:
|
|
@@ -133,25 +133,26 @@ class ZPAClientHelper(ZPAClient):
|
|
|
133
133
|
# Initialize user-agent
|
|
134
134
|
ua = UserAgent()
|
|
135
135
|
self.user_agent = ua.get_user_agent_string()
|
|
136
|
+
self.access_token = None
|
|
137
|
+
self.headers = {}
|
|
136
138
|
self.refreshToken()
|
|
137
139
|
|
|
138
140
|
def refreshToken(self):
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
141
|
+
if not self.access_token or is_token_expired(self.access_token):
|
|
142
|
+
response = self.login()
|
|
143
|
+
if response is None or response.status_code > 299 or not response.json():
|
|
144
|
+
logger.error("Failed to login using provided credentials, response: %s", response)
|
|
145
|
+
raise Exception("Failed to login using provided credentials.")
|
|
146
|
+
self.access_token = response.json().get("access_token")
|
|
147
|
+
self.headers = {
|
|
148
|
+
"Content-Type": "application/json",
|
|
149
|
+
"Accept": "application/json",
|
|
150
|
+
"Authorization": f"Bearer {self.access_token}",
|
|
151
|
+
"User-Agent": self.user_agent,
|
|
152
|
+
}
|
|
151
153
|
|
|
152
154
|
@retry_with_backoff(retries=5)
|
|
153
155
|
def login(self):
|
|
154
|
-
"""Log in to the ZPA API and set the access token for subsequent requests."""
|
|
155
156
|
params = {"client_id": self.client_id, "client_secret": self.client_secret}
|
|
156
157
|
headers = {
|
|
157
158
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
@@ -164,7 +165,6 @@ class ZPAClientHelper(ZPAClient):
|
|
|
164
165
|
url = DEV_AUTH_URL + "?grant_type=CLIENT_CREDENTIALS"
|
|
165
166
|
data = urllib.parse.urlencode(params)
|
|
166
167
|
resp = requests.post(url, data=data, headers=headers, timeout=self.timeout)
|
|
167
|
-
# Avoid logging all data from the response, focus on the status and a summary instead
|
|
168
168
|
logger.info("Login attempt with status: %d", resp.status_code)
|
|
169
169
|
return resp
|
|
170
170
|
except Exception as e:
|
|
@@ -172,16 +172,6 @@ class ZPAClientHelper(ZPAClient):
|
|
|
172
172
|
return None
|
|
173
173
|
|
|
174
174
|
def send(self, method, path, json=None, params=None, api_version: str = None):
|
|
175
|
-
"""
|
|
176
|
-
Send a request to the ZPA API.
|
|
177
|
-
|
|
178
|
-
Parameters:
|
|
179
|
-
- method (str): The HTTP method.
|
|
180
|
-
- path (str): API endpoint path.
|
|
181
|
-
- json (dict, optional): Request payload. Defaults to None.
|
|
182
|
-
Returns:
|
|
183
|
-
- Response: Response object from the request.
|
|
184
|
-
"""
|
|
185
175
|
api = self.url
|
|
186
176
|
if api_version is None:
|
|
187
177
|
api = self.url
|
|
@@ -196,13 +186,10 @@ class ZPAClientHelper(ZPAClient):
|
|
|
196
186
|
|
|
197
187
|
url = f"{api}/{path.lstrip('/')}"
|
|
198
188
|
start_time = time.time()
|
|
199
|
-
# Update headers to include the user agent
|
|
200
189
|
headers_with_user_agent = self.headers.copy()
|
|
201
190
|
headers_with_user_agent["User-Agent"] = self.user_agent
|
|
202
|
-
# Generate a unique UUID for this request
|
|
203
191
|
request_uuid = uuid.uuid4()
|
|
204
192
|
dump_request(logger, url, method, json, params, headers_with_user_agent, request_uuid)
|
|
205
|
-
# Check cache before sending request
|
|
206
193
|
cache_key = self.cache.create_key(url, params)
|
|
207
194
|
if method == "GET" and self.cache.contains(cache_key):
|
|
208
195
|
resp = self.cache.get(cache_key)
|
|
@@ -219,12 +206,13 @@ class ZPAClientHelper(ZPAClient):
|
|
|
219
206
|
return resp
|
|
220
207
|
|
|
221
208
|
attempts = 0
|
|
222
|
-
while attempts < 5:
|
|
209
|
+
while attempts < 5:
|
|
223
210
|
try:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
211
|
+
self.refreshToken()
|
|
212
|
+
should_wait, delay = self.rate_limiter.wait(method)
|
|
213
|
+
if should_wait:
|
|
214
|
+
logger.warning(f"Rate limit exceeded. Retrying in {delay} seconds.")
|
|
215
|
+
time.sleep(delay)
|
|
228
216
|
resp = requests.request(
|
|
229
217
|
method,
|
|
230
218
|
url,
|
|
@@ -241,37 +229,39 @@ class ZPAClientHelper(ZPAClient):
|
|
|
241
229
|
request_uuid=request_uuid,
|
|
242
230
|
start_time=start_time,
|
|
243
231
|
)
|
|
244
|
-
if resp.status_code == 429:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
232
|
+
if resp.status_code == 429:
|
|
233
|
+
retry_after = resp.headers.get("Retry-After")
|
|
234
|
+
if retry_after:
|
|
235
|
+
try:
|
|
236
|
+
sleep_time = int(retry_after)
|
|
237
|
+
except ValueError:
|
|
238
|
+
sleep_time = int(retry_after[:-1])
|
|
239
|
+
logger.warning(f"Rate limit exceeded. Retrying in {sleep_time} seconds.")
|
|
240
|
+
time.sleep(sleep_time)
|
|
241
|
+
else:
|
|
242
|
+
time.sleep(60)
|
|
250
243
|
attempts += 1
|
|
251
244
|
continue
|
|
252
245
|
else:
|
|
253
246
|
break
|
|
254
247
|
except requests.RequestException as e:
|
|
255
|
-
if attempts == 4:
|
|
248
|
+
if attempts == 4:
|
|
256
249
|
logger.error(f"Failed to send {method} request to {url} after 5 attempts. Error: {str(e)}")
|
|
257
250
|
raise e
|
|
258
251
|
else:
|
|
259
252
|
logger.warning(f"Failed to send {method} request to {url}. Retrying... Error: {str(e)}")
|
|
260
253
|
attempts += 1
|
|
261
|
-
sleep(5)
|
|
254
|
+
time.sleep(5)
|
|
262
255
|
|
|
263
|
-
# If Non-GET call, clear the
|
|
264
256
|
if method != "GET":
|
|
265
|
-
|
|
257
|
+
logger.info(f"Clearing cache for non-GET request: {method} {url}")
|
|
258
|
+
self.cache.clear()
|
|
266
259
|
|
|
267
|
-
# Detailed logging for request and response
|
|
268
260
|
try:
|
|
269
261
|
response_data = resp.json()
|
|
270
|
-
except ValueError:
|
|
262
|
+
except ValueError:
|
|
271
263
|
response_data = resp.text
|
|
272
|
-
# check if call was succesful
|
|
273
264
|
if 200 > resp.status_code or resp.status_code > 299:
|
|
274
|
-
# create errors
|
|
275
265
|
try:
|
|
276
266
|
error = ZscalerAPIError(url, resp, response_data)
|
|
277
267
|
if self.fail_safe:
|
|
@@ -284,7 +274,6 @@ class ZPAClientHelper(ZPAClient):
|
|
|
284
274
|
logger.error(response_data)
|
|
285
275
|
raise HTTPException(response_data)
|
|
286
276
|
logger.error(error)
|
|
287
|
-
# Cache the response if it's a successful GET request
|
|
288
277
|
if method == "GET" and resp.status_code == 200:
|
|
289
278
|
self.cache.add(cache_key, resp)
|
|
290
279
|
return resp
|
|
@@ -294,23 +283,34 @@ class ZPAClientHelper(ZPAClient):
|
|
|
294
283
|
Send a GET request to the ZPA API.
|
|
295
284
|
|
|
296
285
|
Parameters:
|
|
297
|
-
|
|
298
|
-
|
|
286
|
+
path (str): API endpoint path.
|
|
287
|
+
json (dict, optional): Request payload. Defaults to None.
|
|
288
|
+
params (dict, optional): Query parameters. Defaults to None.
|
|
289
|
+
api_version (str, optional): API version to use. Defaults to None.
|
|
290
|
+
|
|
299
291
|
Returns:
|
|
300
|
-
|
|
292
|
+
dict: Formatted JSON response from the API.
|
|
301
293
|
"""
|
|
302
|
-
|
|
303
|
-
# Use rate limiter before making a request
|
|
304
294
|
should_wait, delay = self.rate_limiter.wait("GET")
|
|
305
295
|
if should_wait:
|
|
306
296
|
time.sleep(delay)
|
|
307
|
-
|
|
308
|
-
# Now proceed with sending the request
|
|
309
297
|
resp = self.send("GET", path, json, params, api_version=api_version)
|
|
310
298
|
formatted_resp = format_json_response(resp, box_attrs=dict())
|
|
311
299
|
return formatted_resp
|
|
312
300
|
|
|
313
301
|
def put(self, path, json=None, params=None, api_version: str = None):
|
|
302
|
+
"""
|
|
303
|
+
Send a PUT request to the ZPA API.
|
|
304
|
+
|
|
305
|
+
Parameters:
|
|
306
|
+
path (str): API endpoint path.
|
|
307
|
+
json (dict, optional): Request payload. Defaults to None.
|
|
308
|
+
params (dict, optional): Query parameters. Defaults to None.
|
|
309
|
+
api_version (str, optional): API version to use. Defaults to None.
|
|
310
|
+
|
|
311
|
+
Returns:
|
|
312
|
+
dict: Formatted JSON response from the API.
|
|
313
|
+
"""
|
|
314
314
|
should_wait, delay = self.rate_limiter.wait("PUT")
|
|
315
315
|
if should_wait:
|
|
316
316
|
time.sleep(delay)
|
|
@@ -319,6 +319,18 @@ class ZPAClientHelper(ZPAClient):
|
|
|
319
319
|
return formatted_resp
|
|
320
320
|
|
|
321
321
|
def post(self, path, json=None, params=None, api_version: str = None):
|
|
322
|
+
"""
|
|
323
|
+
Send a POST request to the ZPA API.
|
|
324
|
+
|
|
325
|
+
Parameters:
|
|
326
|
+
path (str): API endpoint path.
|
|
327
|
+
json (dict, optional): Request payload. Defaults to None.
|
|
328
|
+
params (dict, optional): Query parameters. Defaults to None.
|
|
329
|
+
api_version (str, optional): API version to use. Defaults to None.
|
|
330
|
+
|
|
331
|
+
Returns:
|
|
332
|
+
dict: Formatted JSON response from the API.
|
|
333
|
+
"""
|
|
322
334
|
should_wait, delay = self.rate_limiter.wait("POST")
|
|
323
335
|
if should_wait:
|
|
324
336
|
time.sleep(delay)
|
|
@@ -327,6 +339,18 @@ class ZPAClientHelper(ZPAClient):
|
|
|
327
339
|
return formatted_resp
|
|
328
340
|
|
|
329
341
|
def delete(self, path, json=None, params=None, api_version: str = None):
|
|
342
|
+
"""
|
|
343
|
+
Send a DELETE request to the ZPA API.
|
|
344
|
+
|
|
345
|
+
Parameters:
|
|
346
|
+
path (str): API endpoint path.
|
|
347
|
+
json (dict, optional): Request payload. Defaults to None.
|
|
348
|
+
params (dict, optional): Query parameters. Defaults to None.
|
|
349
|
+
api_version (str, optional): API version to use. Defaults to None.
|
|
350
|
+
|
|
351
|
+
Returns:
|
|
352
|
+
Response: Response object from the DELETE request.
|
|
353
|
+
"""
|
|
330
354
|
should_wait, delay = self.rate_limiter.wait("DELETE")
|
|
331
355
|
if should_wait:
|
|
332
356
|
time.sleep(delay)
|
|
@@ -575,14 +599,6 @@ class ZPAClientHelper(ZPAClient):
|
|
|
575
599
|
"""
|
|
576
600
|
return PolicySetsAPI(self)
|
|
577
601
|
|
|
578
|
-
@property
|
|
579
|
-
def policiesv2(self):
|
|
580
|
-
"""
|
|
581
|
-
The interface object for the :ref:`ZPA Policy Sets V2 interface <zpa-policiesv2>`.
|
|
582
|
-
|
|
583
|
-
"""
|
|
584
|
-
return PolicySetsV2API(self)
|
|
585
|
-
|
|
586
602
|
@property
|
|
587
603
|
def posture_profiles(self):
|
|
588
604
|
"""
|
|
@@ -96,7 +96,8 @@ class ApplicationSegmentAPI:
|
|
|
96
96
|
Retrieve all configured application segments of a specified type, optionally expanding all related data.
|
|
97
97
|
|
|
98
98
|
Args:
|
|
99
|
-
application_type (str): Type of application segment to retrieve.
|
|
99
|
+
application_type (str): Type of application segment to retrieve.
|
|
100
|
+
Must be one of "BROWSER_ACCESS", "INSPECT", "SECURE_REMOTE_ACCESS".
|
|
100
101
|
expand_all (bool, optional): Whether to expand all related data. Defaults to False.
|
|
101
102
|
|
|
102
103
|
Keyword Args:
|