site2site_vpn¶
The following methods allow for interaction with the ZTB Site2Site VPN (Cloud Gateway) API endpoints. Includes cloud gateway hubs, S2S VPN connections, cluster gateways with interfaces, and S2S hub lists.
Methods are accessible via ztb.site2site_vpn
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 Site2SiteVPNAPI¶
Bases:
APIClientClient for the ZTB Site2Site VPN (Cloud Gateway) resource.
Provides operations for managing cloud gateways, S2S VPN connections, and S2S hubs in the Zero Trust Branch API.
- create_s2s_connections(cluster_id, connection)¶
Create cluster S2S VPN connections.
- Parameters:
cluster_id (int) – The cluster ID.
connection (S2SConnection) – Connection payload (connect_to_hub, gateways, hubs).
- Returns:
(created S2SConnection or None, Response, error).
- Return type:
Examples
>>> conn = S2SConnection() >>> conn.connect_to_hub = True >>> conn.gateways = [...] >>> conn.hubs = S2SHubs({"primary_id": 1, "secondary_id": 2}) >>> result, _, error = client.ztb.site2site_vpn.create_s2s_connections(12345, conn)
- delete_s2s_connections(cluster_id, gateway_ids)¶
Delete cluster S2S VPN connections by gateway IDs.
- Parameters:
- Returns:
(None, Response, error).
- Return type:
Examples
>>> _, resp, error = client.ztb.site2site_vpn.delete_s2s_connections( ... 12345, ["gw-1", "gw-2"] ... )
- get_s2s_connections(cluster_id)¶
Get cluster S2S VPN connections.
- Parameters:
cluster_id (int) – The cluster ID.
- Returns:
(S2SConnection instance, Response, error).
- Return type:
Examples
>>> conn, _, error = client.ztb.site2site_vpn.get_s2s_connections(12345) >>> if error: ... print(f"Error: {error}") ... return >>> print(conn.as_dict())
- get_s2s_gateways(cluster_id)¶
Get list of cluster gateways with their interfaces.
- Parameters:
cluster_id (int) – The cluster ID.
- Returns:
(list of ClusterGatewayWithInterfaces, Response, error).
- Return type:
Examples
>>> gateways, _, error = client.ztb.site2site_vpn.get_s2s_gateways(12345) >>> if error: ... print(f"Error: {error}") ... return >>> for gw in gateways: ... print(gw.as_dict())
- list_hubs(query_params=None)¶
Get list of cloud gateways used as a hub.
- Parameters:
query_params (dict, optional) – Map of query parameters for the request.
[query_params.search](str): Search string for filtering results.[query_params.page](int): Page number for pagination.[query_params.limit](int): Page size / limit.[query_params.sort](str): Sort field. Available values: location, region, sites, public_ip, gateway_name, operational_state, updated_at, created_at.[query_params.sortdir](str): Sort direction. Available values: asc, desc. Default: desc.- Returns:
(list of CloudGatewayHub instances, Response, error).
- Return type:
Examples
>>> hubs, _, error = client.ztb.site2site_vpn.list_hubs() >>> if error: ... print(f"Error listing hubs: {error}") ... return >>> for hub in hubs: ... print(hub.as_dict())
With pagination and search: >>> hubs, _, error = client.ztb.site2site_vpn.list_hubs( … query_params={“search”: “prod”, “page”: 1, “limit”: 25, “sort”: “region”, “sortdir”: “asc”} … )
Client-side filtering with JMESPath:
The response object supports client-side filtering and projection via
resp.search(expression). See the JMESPath documentation for expression syntax.
- list_s2s_hubs(query_params=None)¶
Get S2S VPN hub list (cloud hubs for S2S VPN).
- Parameters:
query_params (dict, optional) – Query parameters.
[query_params.provider](str): Filter by provider. Available: aws, vultr.- Returns:
(list of S2SHubItem instances, Response, error).
- Return type:
Examples
>>> hubs, _, error = client.ztb.site2site_vpn.list_s2s_hubs() >>> hubs, _, error = client.ztb.site2site_vpn.list_s2s_hubs( ... query_params={"provider": "aws"} ... )
Client-side filtering with JMESPath:
The response object supports client-side filtering and projection via
resp.search(expression). See the JMESPath documentation for expression syntax.