Files
regorus/tests/parser/cases/rules/set.yaml
Ming-Wei Shih c0972ad2ba Update license to MIT
Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>
2023-02-09 19:40:35 +00:00

136 lines
2.9 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: contains
rego: |
package test
import future.keywords
deny.a contains 0, "bar" in ["bar1"] if true
policy:
- spec:
head:
set:
refr:
refdot:
refr:
var: deny
field: a
key:
inexpr:
key:
number: 0
value:
string: bar
collection:
array:
- string: bar1
bodies:
- query:
stmts:
- literal:
expr:
true
- note: old-syntax
rego: |
package test
import future.keywords.if
# The following are not sets
x1 if true
x2 { true }
# The following are sets
y.a { true }
y["b"] { true }
# The following are not sets
z.a if { true }
z["b"] if { true }
policy:
- spec:
head:
compr:
refr:
var: x1
bodies:
- query:
stmts:
- literal:
expr:
true
- spec:
head:
compr:
refr:
var: x2
bodies:
- query:
stmts:
- literal:
expr:
true
- spec:
head:
set:
refr:
refdot:
refr:
var: y
field: a
bodies:
- query:
stmts:
- literal:
expr:
true
- spec:
head:
set:
refr:
var: y
key:
string: b
bodies:
- query:
stmts:
- literal:
expr:
true
- spec:
head:
compr:
refr:
refdot:
refr:
var: z
field: a
bodies:
- query:
stmts:
- literal:
expr:
true
- spec:
head:
compr:
refr:
refbrack:
refr:
var: z
index:
string: b
bodies:
- query:
stmts:
- literal:
expr:
true