Coverage for manila/policies/share_group_snapshot.py: 100%
15 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +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_log import versionutils
14from oslo_policy import policy
16from manila.policies import base
19BASE_POLICY_NAME = 'share_group_snapshot:%s'
21DEPRECATED_REASON = """
22The share group snapshots API now supports scope and default roles.
23"""
25deprecated_group_snapshot_create = policy.DeprecatedRule(
26 name=BASE_POLICY_NAME % 'create',
27 check_str=base.RULE_DEFAULT,
28 deprecated_reason=DEPRECATED_REASON,
29 deprecated_since=versionutils.deprecated.WALLABY
30)
31deprecated_group_snapshot_get = policy.DeprecatedRule(
32 name=BASE_POLICY_NAME % 'get',
33 check_str=base.RULE_DEFAULT,
34 deprecated_reason=DEPRECATED_REASON,
35 deprecated_since=versionutils.deprecated.WALLABY
36)
37deprecated_group_snapshot_get_all = policy.DeprecatedRule(
38 name=BASE_POLICY_NAME % 'get_all',
39 check_str=base.RULE_DEFAULT,
40 deprecated_reason=DEPRECATED_REASON,
41 deprecated_since=versionutils.deprecated.WALLABY
42)
43deprecated_group_snapshot_update = policy.DeprecatedRule(
44 name=BASE_POLICY_NAME % 'update',
45 check_str=base.RULE_DEFAULT,
46 deprecated_reason=DEPRECATED_REASON,
47 deprecated_since=versionutils.deprecated.WALLABY
48)
49deprecated_group_snapshot_delete = policy.DeprecatedRule(
50 name=BASE_POLICY_NAME % 'delete',
51 check_str=base.RULE_DEFAULT,
52 deprecated_reason=DEPRECATED_REASON,
53 deprecated_since=versionutils.deprecated.WALLABY
54)
55deprecated_group_snapshot_force_delete = policy.DeprecatedRule(
56 name=BASE_POLICY_NAME % 'force_delete',
57 check_str=base.RULE_ADMIN_API,
58 deprecated_reason=DEPRECATED_REASON,
59 deprecated_since=versionutils.deprecated.WALLABY
60)
61deprecated_group_snapshot_reset_status = policy.DeprecatedRule(
62 name=BASE_POLICY_NAME % 'reset_status',
63 check_str=base.RULE_ADMIN_API,
64 deprecated_reason=DEPRECATED_REASON,
65 deprecated_since=versionutils.deprecated.WALLABY
66)
69share_group_snapshot_policies = [
70 policy.DocumentedRuleDefault(
71 name=BASE_POLICY_NAME % 'create',
72 check_str=base.ADMIN_OR_PROJECT_MEMBER,
73 scope_types=['project'],
74 description="Create a new share group snapshot.",
75 operations=[
76 {
77 'method': 'POST',
78 'path': '/share-group-snapshots'
79 }
80 ],
81 deprecated_rule=deprecated_group_snapshot_create
82 ),
83 policy.DocumentedRuleDefault(
84 name=BASE_POLICY_NAME % 'get',
85 check_str=base.ADMIN_OR_PROJECT_READER,
86 scope_types=['project'],
87 description="Get details of a share group snapshot.",
88 operations=[
89 {
90 'method': 'GET',
91 'path': '/share-group-snapshots/{share_group_snapshot_id}'
92 }
93 ],
94 deprecated_rule=deprecated_group_snapshot_get
95 ),
96 policy.DocumentedRuleDefault(
97 name=BASE_POLICY_NAME % 'get_all',
98 check_str=base.ADMIN_OR_PROJECT_READER,
99 scope_types=['project'],
100 description="Get all share group snapshots.",
101 operations=[
102 {
103 'method': 'GET',
104 'path': '/share-group-snapshots?{query}'
105 },
106 {
107 'method': 'GET',
108 'path': '/share-group-snapshots/detail?{query}'
109 }
110 ],
111 deprecated_rule=deprecated_group_snapshot_get_all
112 ),
113 policy.DocumentedRuleDefault(
114 name=BASE_POLICY_NAME % 'update',
115 check_str=base.ADMIN_OR_PROJECT_MEMBER,
116 scope_types=['project'],
117 description="Update a share group snapshot.",
118 operations=[
119 {
120 'method': 'PUT',
121 'path': '/share-group-snapshots/{share_group_snapshot_id}'
122 }
123 ],
124 deprecated_rule=deprecated_group_snapshot_update
125 ),
126 policy.DocumentedRuleDefault(
127 name=BASE_POLICY_NAME % 'delete',
128 check_str=base.ADMIN_OR_PROJECT_MEMBER,
129 scope_types=['project'],
130 description="Delete a share group snapshot.",
131 operations=[
132 {
133 'method': 'DELETE',
134 'path': '/share-group-snapshots/{share_group_snapshot_id}'
135 }
136 ],
137 deprecated_rule=deprecated_group_snapshot_delete
138 ),
139 policy.DocumentedRuleDefault(
140 name=BASE_POLICY_NAME % 'force_delete',
141 check_str=base.ADMIN,
142 scope_types=['project'],
143 description="Force delete a share group snapshot.",
144 operations=[
145 {
146 'method': 'POST',
147 'path': '/share-group-snapshots/{share_group_snapshot_id}/'
148 'action'
149 }
150 ],
151 deprecated_rule=deprecated_group_snapshot_force_delete
152 ),
153 policy.DocumentedRuleDefault(
154 name=BASE_POLICY_NAME % 'reset_status',
155 check_str=base.ADMIN,
156 scope_types=['project'],
157 description="Reset a share group snapshot's status.",
158 operations=[
159 {
160 'method': 'POST',
161 'path': '/share-group-snapshots/{share_group_snapshot_id}/'
162 'action'
163 }
164 ],
165 deprecated_rule=deprecated_group_snapshot_reset_status
166 ),
167]
170def list_rules():
171 return share_group_snapshot_policies