forwarding_gateways

The following methods allow for interaction with the ZTW Forwarding Gateways API endpoints.

Methods are accessible via ztw.forwarding_gateways

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 ForwardingGatewaysAPI

Bases: APIClient

add_gateway(**kwargs)

Creates a new ZTW Forwarding Gateway.

Parameters:
  • name (str) – Name of the gateway.

  • **kwargs – Optional keyword args.

Keyword Arguments:
  • type (str) – Type of the gateway. Supported types are ZIA and ECSELF (Log and Control gateway). Supported Values: “PROXYCHAIN”, “ZIA”, “ECSELF”

  • description (str) – Description of the gateway.

  • fail_closed (bool) – Indicates that traffic must be dropped when both primary and secondary proxies defined in the gateway are unreachable.

  • manual_primary (str) – Specifies the primary proxy through which traffic must be forwarded.

  • manual_secondary (str) – Specifies the secondary proxy through which traffic must be forwarded.

  • subcloud_primary (list) – If a manual (DC) primary proxy is used and if the organization has subclouds associated, you can specify a subcloud using this field for the specified DC

  • subcloud_secondary (list) – If a manual (DC) secondary proxy is used and if the organization has subclouds associated, you can specify a subcloud using this field for the specified DC

  • primary_type (str) – Type of the primary proxy, such as automatic proxy (AUTO), manual proxy (DC) Supported values: “NONE”, “AUTO”, “MANUAL_OVERRIDE”, “SUBCLOUD”, “VZEN”, “PZEN”, “DC”

  • secondary_type (str) – Type of the secondary proxy, such as automatic proxy (AUTO), manual proxy (DC) Supported values: “NONE”, “AUTO”, “MANUAL_OVERRIDE”, “SUBCLOUD”, “VZEN”, “PZEN”, “DC”

Returns:

A tuple containing the newly added Forwarding Gateway, response, and error.

Return type:

tuple

delete_gateway(gateway_id)

Deletes a ZIA gateway or Log and Control gateway based on the specified ID.

Parameters:

gateway_id (str) – The unique identifier of the ZIA gateway or Log and Control gateway.

Returns:

A tuple containing the response object and error (if any).

Return type:

tuple

list_gateway_lite(query_params=None)

Lists IP Source Groups name and ID all IP Source Groups. This endpoint retrieves only IPv4 source address groups. If the search parameter is provided, the function filters the rules client-side.

Parameters:

{dict} (query_params) –

Map of query parameters for the request.

[query_params.search] {str}: The search string used to match against a

group’s name or description attributes.

Returns:

List of forward gateways resource records.

Return type:

tuple

Examples

Gets a list of all forward gateways.

>>> gw_list, response, error = ztw.forwarding_gateways.list_gateway_lite():
... if error:
...     print(f"Error listing forward gateways: {error}")
...     return
... print(f"Total gateways found: {len(gw_list)}")
... for gw in gw_list:
...     print(gw.as_dict())

Gets a list of all forward gateways name and ID.

>>> gw_list, response, error = ztw.forwarding_gateways.list_gateway_lite(query_params={"search": 'Group01'}):
... if error:
...     print(f"Error listing forward gateways: {error}")
...     return
... print(f"Total gateways found: {len(gw_list)}")
... for gw in gw_list:
...     print(gw.as_dict())
list_gateways(query_params=None)

Retrieves a list of ZIA gateways and Log and Control gateways.

Returns:

A tuple containing:

N/A

Return type:

tuple

Examples

Gets a list of all forwarding gateways.

>>> forwarding_gateways_list, response, error = ztw.forwarding_gateways.list_gateways()
... if error:
...     print(f"Error listing forwarding gateways: {error}")
...     return
... print(f"Total forwarding gateways found: {len(forwarding_gateways_list)}")
... for forwarding_gateway in forwarding_gateways_list:
...     print(forwarding_gateway.as_dict())