playground link - https://play.openpolicyagent.org/p/8cfHmyWx2J #336
backbencherengineer
started this conversation in
Community
Replies: 1 comment 11 replies
-
Hi there 👋 There is no "for" construct in Rego. You can use |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
HI
i am trying use for loop, however its not working.
Loop over each key in mandatory_keys
for key in mandatory_keys {
Check if key is present in new_labels_keys
if not key in new_labels_keys {
all_keys_present = false
}
}
}
label_pattern_match {
pattern = "^[a-z0-9]+$"
all_match := [regex.match(new_labels[key], pattern) | key := object.keys(new_labels)]
all_match_result = all_match[_]
all_match_result
}
values := {value | value := new_labels[_]}
Beta Was this translation helpful? Give feedback.
All reactions