Skip to content

Commit

Permalink
Fix missing cloud check and update code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hur committed Oct 28, 2024
1 parent 8d9b172 commit c0174af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions caracara/modules/custom_ioa/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ class CustomIoaRule:
# This field should exist if this object has been added to a group
group: IoaRuleGroup

# All these fields should exist if `exists_in_cloud()` returns True, with the exception of
# instance_id which should exist and initialised to `None` if this object does not exist in the
# cloud
# The fields below will only be populated if `exists_in_cloud()` returns `True`,
# otherwise they will be `None`
instance_id: str
action_label: str
comment: str
Expand Down Expand Up @@ -610,6 +609,8 @@ def dump(self) -> dict:
This object model is defined in the CrowdStrike API Swagger document.
"""
if not self.exists_in_cloud():
raise ValueError("This group does not exist in the cloud!")
return {
"customer_id": self.customer_id,
"instance_id": self.instance_id,
Expand Down

0 comments on commit c0174af

Please sign in to comment.