Skip to main content

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.

Table 1 - Rego Examples
QueryRegoHow to Evaluate
List of all group namesquery[x] { groups[x] = _}Highlight query and click on the Preview Selection button.
Contents of a specific groupquery[x] { x := groups[“admin-team”] }Highlight query and click on the Preview Selection button.
Find all groups that bob is a member ofquery[name] { some name groupobj := groups[name] some i "bob" = groupobj.users[i]}Highlight query and click on the Preview Selection button.