policy_group_set

The following methods allow for interaction with the ZPA Policy Group Set API endpoints.

Methods are accessible via zpa.policy_group_set

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 PolicyGroupSetAPI

Bases: APIClient

A Client object for the Policy Group Set resource.

get_set(group_set_id, query_params=None)

Get a specific Policy Group Set by ID.

Parameters:
  • group_set_id (str) – The unique identifier for the policy group set.

  • query_params (dict, optional) – Map of query parameters for the request. [query_params.microtenant_id] {str}: The microtenant ID, if applicable.

Returns:

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

Return type:

tuple

Examples

Print a specific policy group set:

>>> fetched_set, _, error = client.zpa.policy_group_set.get_set('216196257331370181')
>>> if error:
...     print(f"Error fetching policy group set by ID: {error}")
...     return
... print(f"Fetched policy group set by ID: {fetched_set.as_dict()}")
get_set_by_policy_type(policy_type, query_params=None)

Get Policy Group Set fo a customer for policy type.

Parameters:
  • policy_type (str) – The policy type.

  • query_params (dict, optional) – Map of query parameters for the request. [query_params.microtenant_id] {str}: The microtenant ID, if applicable.

Returns:

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

Return type:

tuple

Examples

Print a specific policy group set:

>>> fetched_set, _, error = client.zpa.policy_group_set.get_set_by_policy_type('VALUE')
>>> if error:
...     print(f"Error fetching policy group set: {error}")
...     return
... print(f"Fetched policy group set: {fetched_set.as_dict()}")
get_set_summary(policy_type, query_params=None)

Get Policy Group Set Summary fo a customer for policy type.

Parameters:
  • policy_type (str) – The policy type.

  • query_params (dict, optional) – Map of query parameters for the request. [query_params.microtenant_id] {str}: The microtenant ID, if applicable.

Returns:

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

Return type:

tuple

Examples

Print a specific policy group set:

>>> fetched_set, _, error = client.zpa.policy_group_set.get_set_summary('VALUE')
>>> if error:
...     print(f"Error fetching policy group set: {error}")
...     return
... print(f"Fetched policy group set: {fetched_set.as_dict()}")
get_set_summary_stats(policy_type, query_params=None)

Get summary stats for groups and rules within a Policy Group Set.

Parameters:
  • policy_type (str) – The policy type.

  • query_params (dict, optional) – Map of query parameters for the request. [query_params.microtenant_id] {str}: The microtenant ID, if applicable.

Returns:

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

Return type:

tuple

Examples

Print a specific policy group set:

>>> fetched_set, _, error = client.zpa.policy_group_set.get_set_summary_stats('VALUE')
>>> if error:
...     print(f"Error fetching policy group set: {error}")
...     return
... print(f"Fetched policy group set: {fetched_set.as_dict()}")
list_rules(policy_type, query_params=None)

Get paginated rules across groups within a Policy Group Set.

Parameters:
  • policy_type (str) – The policy type.

  • {dict} (query_params) – Map of query parameters for the request. [query_params.search] {string}: The search string used to support search by features and fields for the API. [query_params.page] {integer}: Specifies the page number. [query_params.pagesize] {integer}: Specifies the page size. If not provided, the default page size is 20. The max page size is 500.

Returns:

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

Return type:

tuple

Examples

List policy group sets:

>>> set_list, _, error = client.zpa.policy_group_set.list_rules('VALUE')
>>> if error:
...     print(f"Error listing policy group sets: {error}")
...     return
... print(f"Total policy group sets found: {len(set_list)}")
... for set in set_list:
...     print(set.as_dict())

List policy group sets using filters:

>>> set_list, _, error = client.zpa.policy_group_set.list_rules(
...     'VALUE', query_params={'search': 'Example'})
>>> if error:
...     print(f"Error listing policy group sets: {error}")
...     return
... print(f"Total policy group sets found: {len(set_list)}")

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_sets(query_params=None)

Get all Policy Group Sets for a customer.

Parameters:

{dict} (query_params) – Map of query parameters for the request. [query_params.create_if_not_exist] {boolean}: create resource if missing

Returns:

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

Return type:

tuple

Examples

List policy group sets:

>>> set_list, _, error = client.zpa.policy_group_set.list_sets()
>>> if error:
...     print(f"Error listing policy group sets: {error}")
...     return
... print(f"Total policy group sets found: {len(set_list)}")
... for set in set_list:
...     print(set.as_dict())

List policy group sets using filters:

>>> set_list, _, error = client.zpa.policy_group_set.list_sets(
...     query_params={'create_if_not_exist': 'VALUE'})
>>> if error:
...     print(f"Error listing policy group sets: {error}")
...     return
... print(f"Total policy group sets found: {len(set_list)}")

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.