vzen_clusters¶
The following methods allow for interaction with the ZIA ZIA Virtual Service Edge clusters API endpoints.
Methods are accessible via zia.vzen_clusters
Copyright (c) 2023, Zscaler Inc.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- class VZENClustersAPI¶
Bases:
APIClientA Client object for the VZEN Clusters resource.
- add_vzen_cluster(**kwargs)¶
Adds a new Virtual Service Edge cluster.
- Parameters:
name (str) – Name of the Virtual Service Edge cluster
**kwargs – Optional keyword args.
- Keyword Arguments:
status (str) – Specifies the status of the Virtual Service Edge cluster. The status is set to ENABLED by default. Supported Values: ENABLED, DISABLED, DISABLED_BY_SERVICE_PROVIDER, NOT_PROVISIONED_IN_SERVICE_PROVIDER
ip_address (str) – The Virtual Service Edge cluster IP address
subnet_mask (str) – The Virtual Service Edge cluster subnet mask
default_gateway (str) – The IP address of the default gateway to the internet
ip_sec_enabled (bool) – The IP address of the default gateway to the internet
virtual_zen_node_ids (list) – The Virtual Service Edge instances you want to include in the cluster.
type (str) – The Virtual Service Edge cluster type See the available list of VZEN Types: for further detail on optional keyword parameter structures.
- Returns:
A tuple containing the newly added Virtual ZENS, response, and error.
- Return type:
Examples
Add a new Virtual ZEN :
>>> added_vzen, _, error = client.zia.vzen_clusters.add_vzen_cluster( ... name=f"NewVZEN_{random.randint(1000, 10000)}", ... status=True, ... ip_address='192.168.100.100', ... subnet_mask='255.255.255.0', ... default_gateway='192.168.100.1', ... ip_sec_enabled=True, ... virtual_zen_node_ids=[], ... ) >>> if error: ... print(f"Error adding vzen cluster: {error}") ... return ... print(f"VZEN Cluster added successfully: {added_vzen.as_dict()}")
- delete_vzen_cluster(cluster_id)¶
Deletes the Virtual Service Edge cluster based on the specified ID
- Parameters:
cluster_id (str) – The unique identifier of the VZEN Cluster.
- Returns:
A tuple containing the response object and error (if any).
- Return type:
Examples
Delete a VZEN Cluster:
>>> _, _, error = client.zia.vzen_clusters.delete_vzen_cluster('73459') >>> if error: ... print(f"Error deleting VZEN Cluster: {error}") ... return ... print(f"VZEN Cluster with ID {'73459' deleted successfully.")
- get_vzen_cluster(cluster_id)¶
Retrieves the Virtual Service Edge cluster based on the specified ID
- Parameters:
cluster_id (int) – The unique identifier for the vzen cluster.
- Returns:
A tuple containing (VZEN Cluster instance, Response, error).
- Return type:
Examples
Print a specific VZEN Cluster
>>> fetched_vzen, _, error = client.zia.vzen_clusters.get_vzen_cluster( '1254654') >>> if error: ... print(f"Error fetching VZEN Cluster by ID: {error}") ... return ... print(f"Fetched VZEN Cluster by ID: {fetched_vzen.as_dict()}")
- list_vzen_clusters(query_params=None)¶
Retrieves a list of ZIA Virtual Service Edge clusters
- Parameters:
{dict} (query_params) –
Map of query parameters for the request.
[query_params.search]{str}: Search for a configured Virtual Service Edge cluster- Returns:
A tuple containing (list of Service Edges instances, Response, error)
- Return type:
Examples
List Service Edges using default settings:
>>> vzen_list, _, error = client.zia.vzen_clusters.list_vzen_clusters( query_params={'search':'VZEN01'}) >>> if error: ... print(f"Error listing vzens: {error}") ... return ... print(f"Total vzens found: {len(vzen_list)}") ... for vzen in vzen_list: ... print(vzen.as_dict())
- update_vzen_cluster(cluster_id, **kwargs)¶
Updates the Virtual Service Edge cluster based on the specified ID
- Parameters:
cluster_id (int) – The unique ID for the VZEN Cluster.
- Returns:
A tuple containing the updated VZEN Cluster, response, and error.
- Return type:
Examples
Update a new VZEN Cluster :
>>> updated_vzen, _, error = client.zia.vzen_clusters.update_vzen_cluster( ... cluster_id='1524566' ... name=f"NewVZEN_{random.randint(1000, 10000)}", ... status=True, ... ip_address='192.168.100.100', ... subnet_mask='255.255.255.0', ... default_gateway='192.168.100.1', ... ip_sec_enabled=True, ... virtual_zen_node_ids=[], ... ) >>> if error: ... print(f"Error adding VZEN Cluster: {error}") ... return ... print(f"VZEN Cluster added successfully: {added_vzen.as_dict()}")