Coverage for watcher/common/policies/audit.py: 100%
6 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
13from oslo_policy import policy
15from watcher.common.policies import base
17AUDIT = 'audit:%s'
19rules = [
20 policy.DocumentedRuleDefault(
21 name=AUDIT % 'create',
22 check_str=base.RULE_ADMIN_API,
23 description='Create a new audit.',
24 operations=[
25 {
26 'path': '/v1/audits',
27 'method': 'POST'
28 }
29 ]
30 ),
31 policy.DocumentedRuleDefault(
32 name=AUDIT % 'delete',
33 check_str=base.RULE_ADMIN_API,
34 description='Delete an audit.',
35 operations=[
36 {
37 'path': '/v1/audits/{audit_uuid}',
38 'method': 'DELETE'
39 }
40 ]
41 ),
42 policy.DocumentedRuleDefault(
43 name=AUDIT % 'detail',
44 check_str=base.RULE_ADMIN_API,
45 description='Retrieve audit list with details.',
46 operations=[
47 {
48 'path': '/v1/audits/detail',
49 'method': 'GET'
50 }
51 ]
52 ),
53 policy.DocumentedRuleDefault(
54 name=AUDIT % 'get',
55 check_str=base.RULE_ADMIN_API,
56 description='Get an audit.',
57 operations=[
58 {
59 'path': '/v1/audits/{audit_uuid}',
60 'method': 'GET'
61 }
62 ]
63 ),
64 policy.DocumentedRuleDefault(
65 name=AUDIT % 'get_all',
66 check_str=base.RULE_ADMIN_API,
67 description='Get all audits.',
68 operations=[
69 {
70 'path': '/v1/audits',
71 'method': 'GET'
72 }
73 ]
74 ),
75 policy.DocumentedRuleDefault(
76 name=AUDIT % 'update',
77 check_str=base.RULE_ADMIN_API,
78 description='Update an audit.',
79 operations=[
80 {
81 'path': '/v1/audits/{audit_uuid}',
82 'method': 'PATCH'
83 }
84 ]
85 )
86]
89def list_rules():
90 return rules