Skip to content

Commit

Permalink
Merge pull request #22 from christophwille/christophwille/builtins
Browse files Browse the repository at this point in the history
Builtins0-4
  • Loading branch information
christophwille authored Nov 4, 2021
2 parents 9c52a85 + ab0f673 commit 2a7f8aa
Show file tree
Hide file tree
Showing 13 changed files with 4,111 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# OPA tooling
opa_windows_amd64.exe

# User-specific files
*.suo
*.user
Expand Down
18 changes: 15 additions & 3 deletions sample-policies/build-on-windows.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
opa_windows_amd64 build -t wasm -e "example/hello" example.rego
.\opa_windows_amd64 build -t wasm -e "example/hello" example.rego
tar -xzf bundle.tar.gz /policy.wasm
copy policy.wasm example.wasm
del policy.wasm
del bundle.tar.gz

opa_windows_amd64 build -t wasm -e "app/rbac" rbac.rego
.\opa_windows_amd64 build -t wasm -e "app/rbac" rbac.rego
tar -xzf bundle.tar.gz /policy.wasm
copy policy.wasm rbac.wasm
del policy.wasm
Expand All @@ -15,4 +15,16 @@ del bundle.tar.gz
.\opa_windows_amd64 build -t wasm -e "example" -e "example/one" example-one.rego
tar -xzf bundle.tar.gz /policy.wasm
copy policy.wasm multi.wasm
del policy.wasm
del policy.wasm

.\opa_windows_amd64 build -t wasm -e "builtincallpkg" --capabilities v0.34.0.json simple-custom-builtincall.rego
tar -xzf bundle.tar.gz /policy.wasm
copy policy.wasm simplebuiltincall.wasm
del policy.wasm
del bundle.tar.gz

.\opa_windows_amd64 build -t wasm -e "builtincallsallpkg" --capabilities v0.34.0.json custom-builtincall.rego
tar -xzf bundle.tar.gz /policy.wasm
copy policy.wasm builtincall.wasm
del policy.wasm
del bundle.tar.gz
Binary file added sample-policies/builtincall.wasm
Binary file not shown.
7 changes: 7 additions & 0 deletions sample-policies/custom-builtincall.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package builtincallsallpkg

result0 := custom.func0()
result1 := custom.func1("s1")
result2 := custom.func2("s1", "s2")
result3 := custom.func3("s1", "s2", "s3")
result4 := custom.func4("s1", "s2", "s3", "s4")
5 changes: 5 additions & 0 deletions sample-policies/simple-custom-builtincall.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package builtincallpkg

default someep = false

result := custom.func("Jane")
Binary file added sample-policies/simplebuiltincall.wasm
Binary file not shown.
Loading

0 comments on commit 2a7f8aa

Please sign in to comment.