Skip to content

Commit

Permalink
add special exists function to check field presence
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Feb 8, 2025
1 parent 0ac6e4f commit 9dd531e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package Azure_Proactive_Resiliency_Library_v2.Microsoft_Network_applicationGatew
import rego.v1

valid_zones(after) if {
after.body.zones
data.utils.exists(after.body.zones)
count(after.body.zones) >= 2
}

Expand Down
4 changes: 4 additions & 0 deletions policy/common/common.utils.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package utils

import rego.v1

exists(x) if {
x == x
}

is_create_or_update(change_actions) if {
change_actions[count(change_actions) - 1] == ["create", "update"][_]
}
Expand Down

0 comments on commit 9dd531e

Please sign in to comment.