From 7864107ce651c6bc84c8120e33b3a24068971492 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Sun, 8 May 2022 22:39:01 -0400 Subject: [PATCH] Add group_id action_parameter handler. Relates to #647. --- src/falconpy/device_control_policies.py | 6 ++++++ src/falconpy/prevention_policy.py | 6 ++++++ src/falconpy/response_policies.py | 6 ++++++ src/falconpy/sensor_update_policy.py | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/src/falconpy/device_control_policies.py b/src/falconpy/device_control_policies.py index 5e1cca9bb..d8ee386b9 100644 --- a/src/falconpy/device_control_policies.py +++ b/src/falconpy/device_control_policies.py @@ -173,6 +173,12 @@ def perform_action(self: object, body: dict = None, parameters: dict = None, **k if action_name.lower() in _allowed_actions: if not body: body = generic_payload_list(submitted_keywords=kwargs, payload_value="ids") + if kwargs.get("group_id", None): + body["action_parameters"] = [{ + "name": "group_id", + "value": kwargs.get("group_id", None) + }] + # Passing an action_parameters list will override the group_id keyword if kwargs.get("action_parameters", None): body["action_parameters"] = kwargs.get("action_parameters", None) diff --git a/src/falconpy/prevention_policy.py b/src/falconpy/prevention_policy.py index 5132e3912..2a8035e1d 100644 --- a/src/falconpy/prevention_policy.py +++ b/src/falconpy/prevention_policy.py @@ -168,6 +168,12 @@ def perform_policies_action(self: object, """ if not body: body = generic_payload_list(submitted_keywords=kwargs, payload_value="ids") + if kwargs.get("group_id", None): + body["action_parameters"] = [{ + "name": "group_id", + "value": kwargs.get("group_id", None) + }] + # Passing an action_parameters list will override the group_id keyword if kwargs.get("action_parameters", None): body["action_parameters"] = kwargs.get("action_parameters", None) diff --git a/src/falconpy/response_policies.py b/src/falconpy/response_policies.py index 0ac6de493..ef56a9528 100644 --- a/src/falconpy/response_policies.py +++ b/src/falconpy/response_policies.py @@ -161,6 +161,12 @@ def perform_policies_action(self: object, """ if not body: body = generic_payload_list(submitted_keywords=kwargs, payload_value="ids") + if kwargs.get("group_id", None): + body["action_parameters"] = [{ + "name": "group_id", + "value": kwargs.get("group_id", None) + }] + # Passing an action_parameters list will override the group_id keyword if kwargs.get("action_parameters", None): body["action_parameters"] = kwargs.get("action_parameters", None) diff --git a/src/falconpy/sensor_update_policy.py b/src/falconpy/sensor_update_policy.py index 3cf5d6d14..8cf415a1e 100644 --- a/src/falconpy/sensor_update_policy.py +++ b/src/falconpy/sensor_update_policy.py @@ -308,6 +308,12 @@ def perform_policies_action(self: object, if action_name.lower() in _allowed_actions: if not body: body = generic_payload_list(submitted_keywords=kwargs, payload_value="ids") + if kwargs.get("group_id", None): + body["action_parameters"] = [{ + "name": "group_id", + "value": kwargs.get("group_id", None) + }] + # Passing an action_parameters list will override the group_id keyword if kwargs.get("action_parameters", None): body["action_parameters"] = kwargs.get("action_parameters", None)