proxies

The following methods allow for interaction with the ZIA Proxies API endpoints.

Methods are accessible via zia.proxies

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 ProxiesAPI

Bases: APIClient

A Client object for the Proxies resource.

add_proxy(**kwargs)

Adds a new proxy for a third-party proxy service.

Parameters:
  • name (str) – The name of the Proxy.

  • **kwargs – Optional keyword args.

Keyword Arguments:
  • description (str) – Additional notes or information

  • type (str) – Gateway type. Supported Values: PROXYCHAIN, ZIA, ECSELF

  • address (list) – The IP address or the FQDN of the third-party proxy service

  • port (str) – The port number on which the third-party proxy service listens to the requests forwarded from Zscaler

  • cert (list) – The root certificate used by the third-party proxy to perform SSL inspection.

  • insert_xau_header (bool) – Flag indicating whether X-Authenticated-User header is added by the proxy.

  • base64_encode_xau_header (bool) – Flag indicating whether the added X-Authenticated-User header is Base64 encoded.

Returns:

The newly created IP Destination Group resource record.

Return type:

Tuple

Examples

Add a Proxy of Type PROXYCHAIN:

>>> zia.proxies.add_proxy(
...     name='Proxy01',
...     description='Proxy01',
...     type='PROXYCHAIN',
...     address='192.168.1.1',
...     port='5000',
...     cert={'id': 5465},
...     insert_xau_header=True,
...     base64_encode_xau_header=True,
... )
delete_proxy(proxy_id)

Deletes the specified Proxies.

Parameters:

proxy_id (str) – The unique identifier of the Proxies.

Returns:

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

Return type:

tuple

get_proxy(proxy_id)

Fetches a specific Proxiess by ID.

Parameters:

proxy_id (int) – The unique identifier for the Proxies.

Returns:

A tuple containing (Proxies instance, Response, error).

Return type:

tuple

list_proxies(query_params=None)

Lists Proxiess in your organization with pagination. A subset of Proxiess can be returned that match a supported filter expression or query.

Parameters:

{dict} (query_params) –

Map of query parameters for the request. [query_params.page] {int}: Specifies the page offset.

[query_params.page_size] {int}: Page size for pagination.

[query_params.search] {str}: Search string for filtering results.

Returns:

A tuple containing (list of Proxiess instances, Response, error)

Return type:

tuple

Examples

List Proxiess using default settings:

>>> label_list, _, error = client.zia.rule_labels.list_labels(
    query_params={'search': updated_label.name})
>>> if error:
...     print(f"Error listing labels: {error}")
...     return
... print(f"Total labels found: {len(label_list)}")
... for label in label_list:
...     print(label.as_dict())
list_proxies_lite()

Fetches a specific Proxies lite.

Args:

Returns:

A tuple containing (Proxies instance, Response, error).

Return type:

tuple

Example

List all proxies:

>>> rules_list, response, error = client.zia.proxies.list_proxies_lite()
... if error:
...    print(f"Error listing bandwidth control rules: {error}")
...    return
... print(f"Total rules found: {len(rules_list)}")
... for rule in rules_list:
...    print(rule.as_dict())
list_proxy_gateway_lite()

Retrieves the name and ID of the proxy.

Args:

Returns:

A tuple containing (Proxies instance, Response, error).

Return type:

tuple

Examples

>>> gw_list, _, error = client.zia.proxies.list_proxy_gateway_lite()
>>> if error:
...     print(f"Error listing gateways: {error}")
...     return
... print(f"Total gateways found: {len(gw_list)}")
... for gw in gw_list:
...     print(gw.as_dict())
list_proxy_gateways()

Retrieves a list of Proxy Gateways.

Returns:

A tuple containing:

N/A

Return type:

tuple

Examples

>>> gw_list, _, error = client.zia.proxies.list_proxy_gateways()
>>> if error:
...     print(f"Error listing gateways: {error}")
...     return
... print(f"Total gateways found: {len(gw_list)}")
... for gw in gw_list:
...     print(gw.as_dict())
update_proxy(proxy_id, **kwargs)

Updates information for the specified ZIA Proxies.

Parameters:

proxy_id (int) – The unique ID for the Proxies.

Returns:

A tuple containing the updated Proxies, response, and error.

Return type:

tuple