Skip to content

Ad hoc evaluation of input given a policy #72

Discussion options

You must be logged in to vote

this is my solution for now:

it took forever to find out how it works... the documentation is everything but not helpful :(

via the cli

opa eval --data acme.rego --input input.json data.system

via rest api:

curl http://[::]:8081/v1/policies/x -X "PUT" -v -H "Content-Type: text/plain" --data-binary @acme.rego

curl http://[::]:8081/ -X "POST" -v -H "Content-Type: application/json" --data-binary @input.json

for the files:
acme.rego

Note that naming the package is done in the rego file! Here: system.main
When then contacting the root url: http://[::]:8081/ it queries the package system.main per default

package system.main
import future.keywords.in

default domain = false
default apiMethods = f…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
4 replies
@challarao
Comment options

@firstdorsal
Comment options

@challarao
Comment options

@anderseknert
Comment options

Answer selected by firstdorsal
Comment options

You must be logged in to vote
5 replies
@firstdorsal
Comment options

@anderseknert
Comment options

@firstdorsal
Comment options

@firstdorsal
Comment options

@anderseknert
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants