Debian Codegraph @

policy/testdata/nested_rule/policy.yaml

raw symbols SCIP
1 # Copyright 2024 Google LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 name: nested_rule
16 rule:
17 variables:
18 - name: "permitted_regions"
19 expression: "['us', 'uk', 'es']"
20 match:
21 - rule:
22 id: "banned regions"
23 description: >
24 determine whether the resource origin is in the banned
25 list. If the region is also in the permitted list, the
26 ban has no effect.
27 variables:
28 - name: "banned_regions"
29 expression: "{'us': false, 'ru': false, 'ir': false}"
30 match:
31 - condition: |
32 resource.origin in variables.banned_regions &&
33 !(resource.origin in variables.permitted_regions)
34 output: "{'banned': true}"
35 explanation: "'resource is in the banned region ' + resource.origin"
36 - condition: resource.origin in variables.permitted_regions
37 output: "{'banned': false}"
38 - output: "{'banned': true}"