trusted_networks

The following methods allow for interaction with the ZCC Trusted Networks API endpoints.

Methods are accessible via zcc.trusted_networks

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 TrustedNetworksAPI

Bases: APIClient

add_trusted_network(**kwargs)

Creates a new ZIA Rule Label.

Parameters:
  • id (str)

  • active (bool)

  • company_id (str)

  • condition_type (str)

  • created_by (str)

  • dns_search_domains (str)

  • dns_servers (str)

  • edited_by (str)

  • guid (str)

  • hostnames (str)

  • network_name (str)

  • resolved_ips_for_hostname (str)

  • ssids (str)

  • trusted_dhcp_servers (str)

  • trusted_egress_ips (str)

  • trusted_gateways (str)

  • trusted_subnets (str)

Returns:

A tuple containing the newly added Trusted Network, response, and error.

Return type:

tuple

Examples

Add a new Trusted Network :

>>> updated_network, response, error = client.zcc.trusted_networks.add_trusted_network(
...     active=True,
...     network_name=network_name,
...     dns_servers='10.11.12.13, 10.11.12.14',
...     dns_search_domains='network1.acme.com, network2.acme.com, network3.acme.com',
...     hostnames='',
...     trusted_subnets='',
...     trusted_gateways='',
...     trusted_dhcp_servers='',
... )
>>> if error:
...     print(f"Error adding trusted network: {error}")
...     return
... print(f"Trusted network added successfully: {added_network.as_dict()}")
delete_trusted_network(network_id)

Deletes the specified Trusted Network.

Parameters:

network_id (str) – The unique identifier of the Trusted Network.

Returns:

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

Return type:

tuple

Examples

Delete an existing Trusted Network :

>>> _, _, error = client.zcc.trusted_networks.delete_trusted_network('541244')
>>> if error:
...     print(f"Error deleting trusted network: {error}")
...     return
... print(f"Trusted network with ID '541244' deleted successfully.")
list_by_company(query_params=None)

Returns the list of Trusted Networks By Company ID in the Client Connector Portal.

Parameters:

{dict} (query_params) – Map of query parameters for the request. [query_params.page] {int}: Specifies the page offset. [query_params.page_size] {int}: Specifies the page size. [query_params.search] {str}: The search string used to partially match.

Returns:

A list containing Trusted Networks By Company ID in the Client Connector Portal.

Return type:

list

Examples

List all Trusted Networks:

>>> network_list, response, error = client.zcc.trusted_networks.list_by_company()
>>>     if error:
...         print(f"Error listing trusted networks: {error}")
...         return
...     print(f"Total trusted networks found: {len(network_list)}")
...     for network in network_list:
...         print(network.as_dict())
update_trusted_network(**kwargs)

Update Trusted Network

Parameters:

N/A

Returns:

A tuple containing the Update Trusted Network, response, and error.

Return type:

tuple

Examples

Update an existing Trusted Network :

>>> updated_network, response, error = client.zcc.trusted_networks.update_trusted_network(
...     id='545845',
...     active=True,
...     network_name=network_name,
...     dns_servers="10.11.12.13",
...     dns_search_domains='network1.acme.com, network2.acme.com, network3.acme.com',
...     hostnames='',
...     trusted_subnets='',
...     trusted_gateways='',
...     trusted_dhcp_servers='',
... )
>>> if error:
...     print(f"Error updating trusted network: {error}")
...     return
... print(f"Trusted network updated successfully: {updated_network.as_dict()}")