Coverage for manila/policies/share_replica_export_location.py: 100%

10 statements  

« 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. 

12 

13from oslo_log import versionutils 

14from oslo_policy import policy 

15 

16from manila.policies import base 

17 

18 

19BASE_POLICY_NAME = 'share_replica_export_location:%s' 

20 

21DEPRECATED_REASON = """ 

22The share replica export location API now supports scope and default roles. 

23""" 

24 

25deprecated_replica_location_index = 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) 

31deprecated_replica_location_show = policy.DeprecatedRule( 

32 name=BASE_POLICY_NAME % 'show', 

33 check_str=base.RULE_DEFAULT, 

34 deprecated_reason=DEPRECATED_REASON, 

35 deprecated_since=versionutils.deprecated.WALLABY 

36) 

37 

38 

39share_replica_export_location_policies = [ 

40 policy.DocumentedRuleDefault( 

41 name=BASE_POLICY_NAME % 'index', 

42 check_str=base.ADMIN_OR_PROJECT_READER, 

43 scope_types=['project'], 

44 description="Get all export locations of a given share replica.", 

45 operations=[ 

46 { 

47 'method': 'GET', 

48 'path': '/share-replicas/{share_replica_id}/export-locations', 

49 } 

50 ], 

51 deprecated_rule=deprecated_replica_location_index 

52 ), 

53 policy.DocumentedRuleDefault( 

54 name=BASE_POLICY_NAME % 'show', 

55 check_str=base.ADMIN_OR_PROJECT_READER, 

56 scope_types=['project'], 

57 description="Get details about the requested share replica export " 

58 "location.", 

59 operations=[ 

60 { 

61 'method': 'GET', 

62 'path': ('/share-replicas/{share_replica_id}/export-locations/' 

63 '{export_location_id}'), 

64 } 

65 ], 

66 deprecated_rule=deprecated_replica_location_show 

67 ), 

68] 

69 

70 

71def list_rules(): 

72 return share_replica_export_location_policies