Skip to content

Commit

Permalink
Add group_id action_parameter handler.
Browse files Browse the repository at this point in the history
Relates to #647.
  • Loading branch information
jshcodes committed May 9, 2022
1 parent 67e2f57 commit 7864107
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/falconpy/device_control_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions src/falconpy/prevention_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions src/falconpy/response_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions src/falconpy/sensor_update_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7864107

Please sign in to comment.