zscaler-sdk-python 0.1.3__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 +35 -0
  2. zscaler/cache/__init__.py +0 -0
  3. zscaler/cache/cache.py +105 -0
  4. zscaler/cache/no_op_cache.py +66 -0
  5. zscaler/cache/zscaler_cache.py +159 -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 +21 -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 +37 -0
  16. zscaler/user_agent.py +21 -0
  17. zscaler/utils.py +546 -0
  18. zscaler/zia/__init__.py +629 -0
  19. zscaler/zia/activate.py +51 -0
  20. zscaler/zia/admin_and_role_management.py +336 -0
  21. zscaler/zia/apptotal.py +71 -0
  22. zscaler/zia/audit_logs.py +93 -0
  23. zscaler/zia/authentication_settings.py +94 -0
  24. zscaler/zia/client.py +88 -0
  25. zscaler/zia/cloud_apps.py +402 -0
  26. zscaler/zia/device_management.py +90 -0
  27. zscaler/zia/dlp.py +772 -0
  28. zscaler/zia/errors.py +37 -0
  29. zscaler/zia/firewall.py +1064 -0
  30. zscaler/zia/forwarding_control.py +267 -0
  31. zscaler/zia/isolation_profile.py +83 -0
  32. zscaler/zia/labels.py +178 -0
  33. zscaler/zia/locations.py +645 -0
  34. zscaler/zia/sandbox.py +201 -0
  35. zscaler/zia/security.py +232 -0
  36. zscaler/zia/ssl_inspection.py +169 -0
  37. zscaler/zia/traffic.py +819 -0
  38. zscaler/zia/url_categories.py +422 -0
  39. zscaler/zia/url_filtering.py +306 -0
  40. zscaler/zia/users.py +378 -0
  41. zscaler/zia/web_dlp.py +291 -0
  42. zscaler/zia/workload_groups.py +58 -0
  43. zscaler/zia/zpa_gateway.py +179 -0
  44. zscaler/zpa/README.md +40 -0
  45. zscaler/zpa/__init__.py +655 -0
  46. zscaler/zpa/app_segments.py +317 -0
  47. zscaler/zpa/app_segments_inspection.py +295 -0
  48. zscaler/zpa/app_segments_pra.py +296 -0
  49. zscaler/zpa/certificates.py +230 -0
  50. zscaler/zpa/client.py +113 -0
  51. zscaler/zpa/cloud_connector_groups.py +75 -0
  52. zscaler/zpa/connectors.py +500 -0
  53. zscaler/zpa/emergency_access.py +170 -0
  54. zscaler/zpa/errors.py +37 -0
  55. zscaler/zpa/idp.py +83 -0
  56. zscaler/zpa/inspection.py +968 -0
  57. zscaler/zpa/isolation_profile.py +85 -0
  58. zscaler/zpa/lss.py +544 -0
  59. zscaler/zpa/machine_groups.py +79 -0
  60. zscaler/zpa/policies.py +824 -0
  61. zscaler/zpa/posture_profiles.py +120 -0
  62. zscaler/zpa/privileged_remote_access.py +827 -0
  63. zscaler/zpa/provisioning.py +262 -0
  64. zscaler/zpa/saml_attributes.py +96 -0
  65. zscaler/zpa/scim_attributes.py +115 -0
  66. zscaler/zpa/scim_groups.py +133 -0
  67. zscaler/zpa/segment_groups.py +183 -0
  68. zscaler/zpa/server_groups.py +211 -0
  69. zscaler/zpa/servers.py +198 -0
  70. zscaler/zpa/service_edges.py +388 -0
  71. zscaler/zpa/trusted_networks.py +125 -0
  72. zscaler_sdk_python-0.1.3.dist-info/LICENSE.md +21 -0
  73. zscaler_sdk_python-0.1.3.dist-info/METADATA +362 -0
  74. zscaler_sdk_python-0.1.3.dist-info/RECORD +75 -0
  75. zscaler_sdk_python-0.1.3.dist-info/WHEEL +4 -0
@@ -0,0 +1,388 @@
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 add_id_groups, pick_version_profile, snake_to_camel
22
+ from zscaler.zpa.client import ZPAClient
23
+
24
+
25
+ class ServiceEdgesAPI:
26
+ # Parameter names that will be reformatted to be compatible with ZPAs API
27
+ reformat_params = [
28
+ ("service_edge_ids", "serviceEdges"),
29
+ ("trusted_network_ids", "trustedNetworks"),
30
+ ]
31
+
32
+ def __init__(self, client: ZPAClient):
33
+ self.rest = client
34
+
35
+ def list_service_edges(self, **kwargs) -> BoxList:
36
+ """
37
+ Returns information on all configured ZPA Service Edges.
38
+
39
+ Args:
40
+ **kwargs: Optional keyword args.
41
+
42
+ Keyword Args:
43
+ **max_items (int, optional):
44
+ The maximum number of items to request before stopping iteration.
45
+ **max_pages (int, optional):
46
+ The maximum number of pages to request before stopping iteration.
47
+ **pagesize (int, optional):
48
+ Specifies the page size. The default size is 100, but the maximum size is 1000.
49
+ **search (str, optional):
50
+ The search string used to match against a department's name or comments attributes.
51
+
52
+ Returns:
53
+ :obj:`BoxList`: List containing information on all configured ZPA Service Edges.
54
+
55
+ Examples:
56
+ >>> for service_edge in zpa.service_edges.list_service_edges():
57
+ ... print(service_edge)
58
+
59
+ """
60
+ list, _ = self.rest.get_paginated_data(path="/serviceEdge", **kwargs, api_version="v1")
61
+ return list
62
+
63
+ def get_service_edge(self, service_edge_id: str) -> Box:
64
+ """
65
+ Returns information on the specified Service Edge.
66
+
67
+ Args:
68
+ service_edge_id (str): The unique id of the ZPA Service Edge.
69
+
70
+ Returns:
71
+ :obj:`Box`: The Service Edge resource record.
72
+
73
+ Examples:
74
+ >>> service_edge = zpa.service_edges.get_service_edge('999999')
75
+
76
+ """
77
+ response = self.rest.get("/serviceEdge/%s" % (service_edge_id))
78
+ if isinstance(response, Response):
79
+ status_code = response.status_code
80
+ if status_code != 200:
81
+ return None
82
+ return response
83
+
84
+ def get_service_edge_by_name(self, name):
85
+ apps = self.list_service_edges()
86
+ for app in apps:
87
+ if app.get("name") == name:
88
+ return app
89
+ return None
90
+
91
+ def update_service_edge(self, service_edge_id: str, **kwargs) -> Box:
92
+ """
93
+ Updates the specified ZPA Service Edge.
94
+
95
+ Args:
96
+ service_edge_id (str): The unique id of the Service Edge that will be updated in ZPA.
97
+ **kwargs: Optional keyword args.
98
+
99
+ Keyword Args:
100
+ **description (str): Additional information about the Service Edge.
101
+ **enabled (bool): Enable the Service Edge. Defaults to ``True``.
102
+ **name (str): The name of the Service Edge in ZPA.
103
+
104
+ Returns:
105
+ :obj:`Box`: The updated Service Edge resource record.
106
+
107
+ Examples:
108
+ >>> updated_service_edge = zpa.service_edge.update_service_edge('99999',
109
+ ... description="Updated Description",
110
+ ... name="Updated Name")
111
+
112
+ """
113
+
114
+ # Set payload to equal existing record
115
+ payload = {snake_to_camel(k): v for k, v in self.get_service_edge(service_edge_id).items()}
116
+
117
+ # Add optional parameters to payload
118
+ for key, value in kwargs.items():
119
+ payload[snake_to_camel(key)] = value
120
+
121
+ # Add optional parameters to payload
122
+ for key, value in kwargs.items():
123
+ payload[snake_to_camel(key)] = value
124
+
125
+ resp = self.rest.put("/serviceEdge/%s" % (service_edge_id), json=payload).status_code
126
+ if not isinstance(resp, Response):
127
+ return self.get_service_edge(service_edge_id)
128
+
129
+ def delete_service_edge(self, service_edge_id: str) -> int:
130
+ """
131
+ Deletes the specified Service Edge from ZPA.
132
+
133
+ Args:
134
+ service_edge_id (str): The unique id of the ZPA Service Edge that will be deleted.
135
+
136
+ Returns:
137
+ :obj:`int`: The status code of the operation.
138
+
139
+ Examples:
140
+ >>> zpa.service_edges.delete_service_edge('99999')
141
+
142
+ """
143
+ return self.rest.delete(f"serviceEdge/{service_edge_id}").status_code
144
+
145
+ def bulk_delete_service_edges(self, service_edge_ids: list) -> int:
146
+ """
147
+ Bulk deletes the specified Service Edges from ZPA.
148
+
149
+ Args:
150
+ service_edge_ids (list): A list of Service Edge ids that will be deleted from ZPA.
151
+
152
+ Returns:
153
+ :obj:`int`: The status code for the operation.
154
+
155
+ Examples:
156
+ >>> zpa.service_edges.bulk_delete_service_edges(['99999', '88888'])
157
+
158
+ """
159
+ payload = {
160
+ "ids": service_edge_ids,
161
+ }
162
+
163
+ return self.rest.post("connector/bulkDelete", json=payload).status_code
164
+
165
+ def list_service_edge_groups(self, **kwargs) -> BoxList:
166
+ """
167
+ Returns information on all configured Service Edge Groups in ZPA.
168
+
169
+ Args:
170
+ **kwargs: Optional keyword args.
171
+
172
+ Keyword Args:
173
+ **max_items (int, optional):
174
+ The maximum number of items to request before stopping iteration.
175
+ **max_pages (int, optional):
176
+ The maximum number of pages to request before stopping iteration.
177
+ **pagesize (int, optional):
178
+ Specifies the page size. The default size is 100, but the maximum size is 1000.
179
+ **search (str, optional):
180
+ The search string used to match against a department's name or comments attributes.
181
+
182
+ Returns:
183
+ :obj:`BoxList`: A list of all ZPA Service Edge Group resource records.
184
+
185
+ Examples:
186
+ Print all Service Edge Groups in ZPA.
187
+
188
+ >>> for group in zpa.service_edges.list_service_edge_groups():
189
+ ... print(group)
190
+
191
+ """
192
+ list, _ = self.rest.get_paginated_data(path="/serviceEdgeGroup", **kwargs, api_version="v1")
193
+ return list
194
+
195
+ def get_service_edge_group(self, group_id: str) -> Box:
196
+ """
197
+ Returns information on the specified ZPA Service Edge Group.
198
+
199
+ Args:
200
+ group_id (str): The unique id of the ZPA Service Edge Group.
201
+
202
+ Returns:
203
+ :obj:`Box`: The specified ZPA Service Edge Group resource record.
204
+
205
+ Examples:
206
+ >>> group = zpa.service_edges.get_service_edge_group("99999")
207
+
208
+ """
209
+ response = self.rest.get("/serviceEdgeGroup/%s" % (group_id))
210
+ if isinstance(response, Response):
211
+ status_code = response.status_code
212
+ if status_code != 200:
213
+ return None
214
+ return response
215
+
216
+ def get_service_edge_group_by_name(self, name):
217
+ groups = self.list_service_edge_groups()
218
+ for group in groups:
219
+ if group.get("name") == name:
220
+ return group
221
+ return None
222
+
223
+ def add_service_edge_group(self, name: str, latitude: str, longitude: str, location: str, **kwargs):
224
+ """
225
+ Adds a new Service Edge Group to ZPA.
226
+
227
+ Args:
228
+ latitude (str): The latitude representing the physical location of the ZPA Service Edges in this group.
229
+ longitude (str): The longitude representing the physical location of the ZPA Service Edges in this group.
230
+ location (str): The name of the physical location of the ZPA Service Edges in this group.
231
+ name (str): The name of the Service Edge Group.
232
+ **kwargs: Optional keyword args.
233
+
234
+ Keyword Args:
235
+ **cityCountry (str):
236
+ The City and Country for where the App Connectors are located. Format is:
237
+
238
+ ``<City>, <Country Code>`` e.g. ``Sydney, AU``
239
+ **country_code (str):
240
+ The ISO<std> Country Code that represents the country where the App Connectors are located.
241
+ **enabled (bool):
242
+ Is the Service Edge Group enabled? Defaults to ``True``.
243
+ **is_public (bool):
244
+ Is the Service Edge publicly accessible? Defaults to ``False``.
245
+ **override_version_profile (bool):
246
+ Override the local App Connector version according to ``version_profile``. Defaults to ``False``.
247
+ **service_edge_ids (list):
248
+ A list of unique ids of ZPA Service Edges that belong to this Service Edge Group.
249
+ **trusted_network_ids (list):
250
+ A list of unique ids of Trusted Networks that are associated with this Service Edge Group.
251
+ **upgrade_day (str):
252
+ The day of the week that upgrades will be pushed to the App Connector.
253
+ **upgrade_time_in_secs (str):
254
+ The time of the day that upgrades will be pushed to the App Connector.
255
+ **version_profile (str):
256
+ The version profile to use. This will automatically set ``override_version_profile`` to True.
257
+ Accepted values are:
258
+
259
+ ``default``, ``previous_default`` and ``new_release``
260
+
261
+ Returns:
262
+ :obj:`Box`: The resource record of the newly created Service Edge Group.
263
+
264
+ Examples:
265
+ Add a new Service Edge Group for Service Edges in Sydney and set the version profile to new releases.
266
+
267
+ >>> group = zpa.service_edges.add_service_edge_group(name="My SE Group",
268
+ ... latitude="33.8688",
269
+ ... longitude="151.2093",
270
+ ... location="Sydney",
271
+ ... version_profile="new_release)
272
+
273
+ """
274
+ payload = {
275
+ "name": name,
276
+ "latitude": latitude,
277
+ "longitude": longitude,
278
+ "location": location,
279
+ }
280
+
281
+ # Perform formatting on simplified params
282
+ add_id_groups(self.reformat_params, kwargs, payload)
283
+ pick_version_profile(kwargs, payload)
284
+
285
+ # Add optional parameters to payload
286
+ for key, value in kwargs.items():
287
+ payload[snake_to_camel(key)] = value
288
+
289
+ response = self.rest.post("serviceEdgeGroup", json=payload)
290
+ if isinstance(response, Response):
291
+ # this is only true when the creation failed (status code is not 2xx)
292
+ status_code = response.status_code
293
+ # Handle error response
294
+ raise Exception(f"API call failed with status {status_code}: {response.json()}")
295
+ return response
296
+
297
+ def update_service_edge_group(self, group_id: str, **kwargs) -> Box:
298
+ """
299
+ Updates the specified ZPA Service Edge Group.
300
+
301
+ Args:
302
+ group_id (str): The unique id of the ZPA Service Edge Group that will be updated.
303
+ **kwargs: Optional keyword args.
304
+
305
+ Keyword Args:
306
+ **cityCountry (str):
307
+ The City and Country for where the App Connectors are located. Format is:
308
+
309
+ ``<City>, <Country Code>`` e.g. ``Sydney, AU``
310
+ **country_code (str):
311
+ The ISO<std> Country Code that represents the country where the App Connectors are located.
312
+ **enabled (bool):
313
+ Is the Service Edge Group enabled? Defaults to ``True``.
314
+ **is_public (bool):
315
+ Is the Service Edge publicly accessible? Defaults to ``False``.
316
+ **latitude (str):
317
+ The latitude representing the physical location of the ZPA Service Edges in this group.
318
+ **longitude (str):
319
+ The longitude representing the physical location of the ZPA Service Edges in this group.
320
+ **location (str): T
321
+ he name of the physical location of the ZPA Service Edges in this group.
322
+ **name (str):
323
+ The name of the Service Edge Group.
324
+ **override_version_profile (bool):
325
+ Override the local App Connector version according to ``version_profile``. Defaults to ``False``.
326
+ **service_edge_ids (list):
327
+ A list of unique ids of ZPA Service Edges that belong to this Service Edge Group.
328
+ **trusted_network_ids (list):
329
+ A list of unique ids of Trusted Networks that are associated with this Service Edge Group.
330
+ **upgrade_day (str):
331
+ The day of the week that upgrades will be pushed to the Service Edges in this group.
332
+ **upgrade_time_in_secs (str):
333
+ The time of the day that upgrades will be pushed to the Service Edges in this group.
334
+ **version_profile (str):
335
+ The version profile to use. This will automatically set ``override_version_profile`` to True.
336
+ Accepted values are:
337
+
338
+ ``default``, ``previous_default`` and ``new_release``
339
+
340
+ Returns:
341
+ :obj:`Box`: The updated ZPA Service Edge Group resource record.
342
+
343
+ Examples:
344
+ Update the name of a Service Edge Group, change the Version Profile to 'default' and the upgrade day to
345
+ Friday.
346
+
347
+ >>> group = zpa.service_edges.update_service_edge_group('99999',
348
+ ... name="Updated Name",
349
+ ... version_profile="default",
350
+ ... upgrade_day="friday")
351
+
352
+ """
353
+ # Set payload to equal existing record
354
+ payload = {snake_to_camel(k): v for k, v in self.get_service_edge_group(group_id).items()}
355
+
356
+ # Perform formatting on simplified params
357
+ add_id_groups(self.reformat_params, kwargs, payload)
358
+ pick_version_profile(kwargs, payload)
359
+
360
+ # Add optional parameters to payload
361
+ for key, value in kwargs.items():
362
+ payload[snake_to_camel(key)] = value
363
+
364
+ # Add optional parameters to payload
365
+ for key, value in kwargs.items():
366
+ payload[snake_to_camel(key)] = value
367
+
368
+ resp = self.rest.put(f"serviceEdgeGroup/{group_id}", json=payload).status_code
369
+
370
+ # Return the object if it was updated successfully
371
+ if not isinstance(resp, Response):
372
+ return self.get_service_edge_group(group_id)
373
+
374
+ def delete_service_edge_group(self, service_edge_group_id: str) -> int:
375
+ """
376
+ Deletes the specified Service Edge Group from ZPA.
377
+
378
+ Args:
379
+ service_edge_group_id (str): The unique id of the ZPA Service Edge Group.
380
+
381
+ Returns:
382
+ :obj:`int`: The status code for the operation.
383
+
384
+ Examples:
385
+ >>> zpa.service_edges.delete_service_edge_group("99999")
386
+
387
+ """
388
+ return self.rest.delete(f"serviceEdgeGroup/{service_edge_group_id}").status_code
@@ -0,0 +1,125 @@
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 typing import Union
19
+
20
+ from box import Box, BoxList
21
+ from requests import Response
22
+
23
+ from zscaler.zpa.client import ZPAClient
24
+
25
+
26
+ class TrustedNetworksAPI:
27
+ def __init__(self, client: ZPAClient):
28
+ self.rest = client
29
+
30
+ def list_networks(self, **kwargs) -> BoxList:
31
+ """
32
+ Returns a list of all configured trusted networks.
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
+ :obj:`BoxList`: A list of all configured trusted networks.
46
+
47
+ Examples:
48
+ >>> for trusted_network in zpa.trusted_networks.list_networks():
49
+ ... pprint(trusted_network)
50
+
51
+ """
52
+ list, _ = self.rest.get_paginated_data(path="/network", **kwargs, api_version="v2")
53
+ return list
54
+
55
+ def get_network_by_name(self, name):
56
+ networks = self.list_networks()
57
+ for network in networks:
58
+ if network.get("name") == name:
59
+ return network
60
+ return None
61
+
62
+ def get_network(self, network_id: str) -> Box:
63
+ """
64
+ Returns information on the specified trusted network.
65
+
66
+ Args:
67
+ network_id (str):
68
+ The unique identifier for the trusted network.
69
+
70
+ Returns:
71
+ :obj:`Box`: The resource record for the trusted network.
72
+
73
+ Examples:
74
+ >>> pprint(zpa.trusted_networks.get_network('99999'))
75
+
76
+ """
77
+ response = self.rest.get("/network/%s" % (network_id))
78
+ if isinstance(response, Response):
79
+ status_code = response.status_code
80
+ if status_code != 200:
81
+ return None
82
+ return response
83
+
84
+ def get_by_network_id(self, network_id: str, **kwargs) -> Union[Box, None]:
85
+ """
86
+ Returns the trusted network based on the networkId.
87
+
88
+ Args:
89
+ network_id (str): The unique Network ID for the network ID.
90
+
91
+ Keyword Args:
92
+ **max_items (int): The maximum number of items to request before stopping iteration.
93
+ **max_pages (int): The maximum number of pages to request before stopping iteration.
94
+ **pagesize (int): Specifies the page size. The default size is 100, but the maximum size is 500.
95
+ **search (str, optional): The search string used to match against features and fields.
96
+
97
+ Returns:
98
+ Union[Box, None]: The resource record for the trusted networks.
99
+ """
100
+
101
+ page = 0
102
+ page_size = kwargs.get("pagesize", 100) # default page size changed to 100
103
+ max_pages = kwargs.get("max_pages", None)
104
+
105
+ while True:
106
+ params = {
107
+ "pagesize": page_size,
108
+ "page": page,
109
+ "search": network_id, # use the search parameter if supported
110
+ **kwargs,
111
+ }
112
+ networks = self.list_networks(**params)
113
+
114
+ if not networks:
115
+ break # exit if no more networks
116
+
117
+ for network in networks:
118
+ if network.get("networkId") == network_id:
119
+ return Box(network)
120
+
121
+ page += 1
122
+ if max_pages and page >= max_pages:
123
+ break
124
+
125
+ return None
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 [Zscaler](https://github.com/zscaler)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.