Coverage for manila/policies/quota_class_set.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 = 'quota_class_set:%s' 

20 

21DEPRECATED_REASON = """ 

22The quota class API now supports scope and default roles. 

23""" 

24 

25deprecated_quota_class_update = policy.DeprecatedRule( 

26 name=BASE_POLICY_NAME % 'update', 

27 check_str=base.RULE_ADMIN_API, 

28 deprecated_reason=DEPRECATED_REASON, 

29 deprecated_since=versionutils.deprecated.WALLABY 

30) 

31deprecated_quota_class_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 

39quota_class_set_policies = [ 

40 policy.DocumentedRuleDefault( 

41 name=BASE_POLICY_NAME % 'update', 

42 check_str=base.ADMIN, 

43 scope_types=['project'], 

44 description="Update quota class.", 

45 operations=[ 

46 { 

47 'method': 'PUT', 

48 'path': '/quota-class-sets/{class_name}' 

49 }, 

50 { 

51 'method': 'PUT', 

52 'path': '/os-quota-class-sets/{class_name}' 

53 } 

54 ], 

55 deprecated_rule=deprecated_quota_class_update 

56 ), 

57 policy.DocumentedRuleDefault( 

58 name=BASE_POLICY_NAME % 'show', 

59 check_str=base.ADMIN_OR_PROJECT_READER, 

60 scope_types=['project'], 

61 description="Get quota class.", 

62 operations=[ 

63 { 

64 'method': 'GET', 

65 'path': '/quota-class-sets/{class_name}' 

66 }, 

67 { 

68 'method': 'GET', 

69 'path': '/os-quota-class-sets/{class_name}' 

70 } 

71 ], 

72 deprecated_rule=deprecated_quota_class_show 

73 ), 

74] 

75 

76 

77def list_rules(): 

78 return quota_class_set_policies