Coverage for manila/policies/share_snapshot_instance_export_location.py: 100%
10 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_snapshot_instance_export_location:%s'
21DEPRECATED_REASON = """
22The share snapshot instance export location API now supports scope and
23default roles.
24"""
26deprecated_snapshot_instance_index = policy.DeprecatedRule(
27 name=BASE_POLICY_NAME % 'index',
28 check_str=base.RULE_ADMIN_API,
29 deprecated_reason=DEPRECATED_REASON,
30 deprecated_since=versionutils.deprecated.WALLABY
31)
32deprecated_snapshot_instance_show = policy.DeprecatedRule(
33 name=BASE_POLICY_NAME % 'show',
34 check_str=base.RULE_ADMIN_API,
35 deprecated_reason=DEPRECATED_REASON,
36 deprecated_since=versionutils.deprecated.WALLABY
37)
40share_snapshot_instance_export_location_policies = [
41 policy.DocumentedRuleDefault(
42 name=BASE_POLICY_NAME % 'index',
43 check_str=base.ADMIN,
44 scope_types=['project'],
45 description="List export locations of a share snapshot instance.",
46 operations=[
47 {
48 'method': 'GET',
49 'path': ('/snapshot-instances/{snapshot_instance_id}/'
50 'export-locations'),
51 }
52 ],
53 deprecated_rule=deprecated_snapshot_instance_index
54 ),
55 policy.DocumentedRuleDefault(
56 name=BASE_POLICY_NAME % 'show',
57 check_str=base.ADMIN,
58 scope_types=['project'],
59 description="Show details of a specified export location of a share "
60 "snapshot instance.",
61 operations=[
62 {
63 'method': 'GET',
64 'path': ('/snapshot-instances/{snapshot_instance_id}/'
65 'export-locations/{export_location_id}'),
66 }
67 ],
68 deprecated_rule=deprecated_snapshot_instance_show
69 ),
70]
73def list_rules():
74 return share_snapshot_instance_export_location_policies