Inspect the Object Model
When populating the object model and writing custom Rego policies over the model, you can retrieve and inspect the contents of that model. For example, let me see the list of all groups.
To gain visibility into the contents of the object model, Styra recommends you to write small pieces of Rego and use the policy editor Preview button to evaluate your Rego. Use the following examples and try adding to the objects.rego
file. It is not required to Publish because you are experimenting with the data.
tip
In the Styra DAS UI, do a preview on the object/object.rego
file to view the entire object model as defined by the object.rego
mappings.
Query | Rego | How to Evaluate |
---|---|---|
List of all group names | query[x] { groups[x] = _} | Highlight query and click on the Preview Selection button. |
Contents of a specific group | query[x] { x := groups[“admin-team”] } | Highlight query and click on the Preview Selection button. |
Find all groups that bob is a member of | query[name] { some name groupobj := groups[name] some i "bob" = groupobj.users[i]} | Highlight query and click on the Preview Selection button. |