Replies: 1 comment 2 replies
-
Hi there! Longer blog on the topic of dynamic policy composition over here. If you need to query entirely arbitrary paths, you can use object.get to query an arbitrary path under the # with input.rulePackageNameToRun as "policy.infra.server"
result := object.get(data.newco, split(input.rulePackageNameToRun, "."), {}) The first path component needs to be known in order for the compiler to know that the query isn't going to be recursive, i.e. package |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I execute a specific rule which the package name was passed as input?
Example:
rego:
So basically I want to replace the newco.policy.infra.server above with the value from the input.rulePackageNameToRun.
Replacing the allow line above with the below (of course) does not work
allow := data[input.ruleToRun].allow with input as input.data
On a other programing languages, I would split the input.ruleToRun by dot and do something like this:
but I don't know how to create a equivalent rego code to the above.
PS: the data.newco.policy.infra.server.allow rule is defined on another file but available in the same bundle.
Beta Was this translation helpful? Give feedback.
All reactions