From ee938f61e6062207f5458769b03758b79a68e707 Mon Sep 17 00:00:00 2001 From: Tapish Jain Date: Mon, 21 Oct 2024 10:11:55 -0700 Subject: [PATCH] PAPP-34694: adding ipv6 destination group support --- zscaler.json | 17 ++++++++++++++++- zscaler_connector.py | 12 +++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/zscaler.json b/zscaler.json index 27f6e64..d251e29 100644 --- a/zscaler.json +++ b/zscaler.json @@ -4288,6 +4288,16 @@ "default": 50, "order": 3 }, + "include_ipv6": { + "description": "Retrieve IPv6 destination groups", + "data_type": "boolean", + "example_values": [ + true, + false + ], + "default": false, + "order": 4 + }, "lite": { "description": "Whether to retrieve only limited information of IP destination groups. Includes ID, name and type of the IP destination groups", "data_type": "boolean", @@ -4296,7 +4306,7 @@ false ], "default": false, - "order": 4 + "order": 5 } }, "output": [ @@ -4314,6 +4324,11 @@ "data_type": "boolean", "column_name": "Lite" }, + { + "data_path": "action_result.parameter.include_ipv6", + "data_type": "boolean", + "column_name": "Include Ipv6" + }, { "data_path": "action_result.parameter.limit", "data_type": "numeric", diff --git a/zscaler_connector.py b/zscaler_connector.py index 038e8db..03af843 100644 --- a/zscaler_connector.py +++ b/zscaler_connector.py @@ -1264,6 +1264,7 @@ def _handle_list_destination_group(self, param): :param ip_group_ids: Destination groups to retrieve :param exclude_type: Group types to exclude from search :param category_type: Destination types to filter by + :param include_ipv6: Retrieve IPv6 groups :param limit: Number of groups to retrieve :param lite: Retrieve limited information for each group :return: status phantom.APP_ERROR/phantom.APP_SUCCESS(along with appropriate message) @@ -1276,6 +1277,7 @@ def _handle_list_destination_group(self, param): exclude_type = param.get("exclude_type", "") category_type = param.get("category_type", "") category_type_list = [item.strip() for item in category_type.split(",") if item.strip()] + include_ipv6 = param.get("include_ipv6", False) limit = param.get("limit", 50) lite = param.get("lite", False) @@ -1304,7 +1306,15 @@ def _handle_list_destination_group(self, param): if phantom.is_fail(ret_val): return action_result.get_status() - # action_result.add_data(destination_groups) + if include_ipv6: + self.save_progress("Retrieving ipv6 destination groups") + params['page'] = 1 + params['pageSize'] = limit + endpoint = '/ipDestinationGroups/ipv6DestinationGroups/lite' if lite else '/ipDestinationGroups/ipv6DestinationGroups' + ret_val = self._get_batched_groups(endpoint, params, action_result) + if phantom.is_fail(ret_val): + return action_result.get_status() + summary = action_result.update_summary({}) summary["message"] = "Destination groups retrieved" return action_result.set_status(phantom.APP_SUCCESS)