Skip to content

Commit

Permalink
Merge pull request #86 from Expedient/fix-update-security-rule
Browse files Browse the repository at this point in the history
Fix update security rule
  • Loading branch information
maclin-masterson authored Dec 1, 2023
2 parents b708c04 + 541e4c7 commit b6f0d78
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

---
version: 2.4.1
version: 2.4.2
namespace: expedient
name: elastic
readme: README.md
Expand Down
29 changes: 18 additions & 11 deletions plugins/module_utils/kibana.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,24 @@ def get_security_rule_byid(self, rule_id):
def update_security_rule(self, body):
endpoint = "detection_engine/rules"
rule_object = self.get_security_rule_byid(body['id'])
rule_object.pop('updated_at')
rule_object.pop('updated_by')
rule_object.pop('created_at')
rule_object.pop('created_by')
rule_object.pop('execution_summary')
rule_object.pop('rule_id')
rule_object.pop('related_integrations')
rule_object.pop('immutable')
rule_object.pop('required_fields')
rule_object.pop('setup')
rule_object.pop('revision')
keys_to_remove = [
'updated_at',
'updated_by',
'created_at',
'created_by',
'execution_summary',
'rule_id',
'related_integrations',
'immutable',
'required_fields',
'setup',
'revision'
]

for key in keys_to_remove:
if key in rule_object:
rule_object.pop(key)

rule_object.update(body)
update_rule = self.send_api_request(endpoint, 'PUT', data=rule_object)
return update_rule
Expand Down

0 comments on commit b6f0d78

Please sign in to comment.