policy_rules

The following methods allow for interaction with the ZMS Policy Rules API endpoints.

Methods are accessible via zms.policy_rules

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 PolicyRulesAPI

Bases: APIClient

A Client object for the ZMS Policy Rules domain.

Provides access to policy rule operations including: - List policy rules with filtering and pagination - List default policy rules

list_default_policy_rules(customer_id, page_num=1, page_size=20)

Get default policy rules for a given customer.

Parameters:
  • customer_id – The customer ID.

  • page_num – Page number (default 1).

  • page_size – Number of items per page (default 20).

Returns:

(default_policy_rules_connection dict, response, error)

Return type:

tuple

Examples

List default policy rules:

>>> result, _, err = client.zms.policy_rules.list_default_policy_rules(
...     customer_id="123456789"
... )
>>> if err:
...     print(err)
>>> for rule in result.get("nodes", []):
...     print(rule.get("name"), rule.get("direction"))
list_policy_rules(customer_id, page_num=1, page_size=20, fetch_all=False, filter_by=None)

Get policy rules for a given customer with optional filtering and pagination.

Parameters:
  • customer_id – The customer ID.

  • page_num – Page number (default 1).

  • page_size – Number of items per page (default 20).

  • fetch_all – Whether to fetch all rules ignoring pagination.

  • filter_by – Filter options using PolicyRuleFilter.

Returns:

(policy_rules_connection dict, response, error)

Return type:

tuple

Examples

List policy rules:

>>> result, _, err = client.zms.policy_rules.list_policy_rules(
...     customer_id="123456789"
... )
>>> if err:
...     print(err)
>>> for rule in result.get("nodes", []):
...     print(rule.get("name"), rule.get("action"))