Coverage for manila/policies/share_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# Copyright (c) 2017 Huawei Technologies Co., Ltd.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
16from oslo_log import versionutils
17from oslo_policy import policy
19from manila.policies import base
22BASE_POLICY_NAME = 'share_instance_export_location:%s'
24DEPRECATED_REASON = """
25The share instance export location API now supports scope and default roles.
26"""
28deprecated_instance_export_location_index = policy.DeprecatedRule(
29 name=BASE_POLICY_NAME % 'index',
30 check_str=base.RULE_ADMIN_API,
31 deprecated_reason=DEPRECATED_REASON,
32 deprecated_since=versionutils.deprecated.WALLABY
33)
34deprecated_instance_export_location_show = policy.DeprecatedRule(
35 name=BASE_POLICY_NAME % 'show',
36 check_str=base.RULE_ADMIN_API,
37 deprecated_reason=DEPRECATED_REASON,
38 deprecated_since=versionutils.deprecated.WALLABY
39)
42share_export_location_policies = [
43 policy.DocumentedRuleDefault(
44 name=BASE_POLICY_NAME % 'index',
45 check_str=base.ADMIN,
46 scope_types=['project'],
47 description='Return data about the requested export location.',
48 operations=[
49 {
50 'method': 'POST',
51 'path': ('/share_instances/{share_instance_id}/'
52 'export_locations'),
53 }
54 ],
55 deprecated_rule=deprecated_instance_export_location_index
56 ),
57 policy.DocumentedRuleDefault(
58 name=BASE_POLICY_NAME % 'show',
59 check_str=base.ADMIN,
60 scope_types=['project'],
61 description='Return data about the requested export location.',
62 operations=[
63 {
64 'method': 'GET',
65 'path': ('/share_instances/{share_instance_id}/'
66 'export_locations/{export_location_id}'),
67 }
68 ],
69 deprecated_rule=deprecated_instance_export_location_show
70 ),
71]
74def list_rules():
75 return share_export_location_policies