Coverage for manila/policies/availability_zone.py: 100%
9 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 = 'availability_zone:%s'
21DEPRECATED_REASON = """
22The availability zone API now supports scope and default roles.
23"""
25deprecated_get_availability_zone = policy.DeprecatedRule(
26 name=BASE_POLICY_NAME % 'index',
27 check_str=base.RULE_DEFAULT,
28 deprecated_reason=DEPRECATED_REASON,
29 deprecated_since=versionutils.deprecated.WALLABY
30)
33availability_zone_policies = [
34 policy.DocumentedRuleDefault(
35 name=BASE_POLICY_NAME % 'index',
36 check_str=base.ADMIN_OR_PROJECT_READER,
37 scope_types=['project'],
38 description="Get all storage availability zones.",
39 operations=[
40 {
41 'method': 'GET',
42 'path': '/os-availability-zone',
43 },
44 {
45 'method': 'GET',
46 'path': '/availability-zone',
47 },
48 ],
49 deprecated_rule=deprecated_get_availability_zone
50 ),
51]
54def list_rules():
55 return availability_zone_policies