Coverage for watcher/common/policies/action_plan.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +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_policy import policy 

14 

15from watcher.common.policies import base 

16 

17ACTION_PLAN = 'action_plan:%s' 

18 

19rules = [ 

20 policy.DocumentedRuleDefault( 

21 name=ACTION_PLAN % 'delete', 

22 check_str=base.RULE_ADMIN_API, 

23 description='Delete an action plan.', 

24 operations=[ 

25 { 

26 'path': '/v1/action_plans/{action_plan_uuid}', 

27 'method': 'DELETE' 

28 } 

29 ] 

30 ), 

31 policy.DocumentedRuleDefault( 

32 name=ACTION_PLAN % 'detail', 

33 check_str=base.RULE_ADMIN_API, 

34 description='Retrieve a list of action plans with detail.', 

35 operations=[ 

36 { 

37 'path': '/v1/action_plans/detail', 

38 'method': 'GET' 

39 } 

40 ] 

41 ), 

42 policy.DocumentedRuleDefault( 

43 name=ACTION_PLAN % 'get', 

44 check_str=base.RULE_ADMIN_API, 

45 description='Get an action plan.', 

46 operations=[ 

47 { 

48 'path': '/v1/action_plans/{action_plan_id}', 

49 'method': 'GET' 

50 } 

51 ] 

52 ), 

53 policy.DocumentedRuleDefault( 

54 name=ACTION_PLAN % 'get_all', 

55 check_str=base.RULE_ADMIN_API, 

56 description='Get all action plans.', 

57 operations=[ 

58 { 

59 'path': '/v1/action_plans', 

60 'method': 'GET' 

61 } 

62 ] 

63 ), 

64 policy.DocumentedRuleDefault( 

65 name=ACTION_PLAN % 'update', 

66 check_str=base.RULE_ADMIN_API, 

67 description='Update an action plans.', 

68 operations=[ 

69 { 

70 'path': '/v1/action_plans/{action_plan_uuid}', 

71 'method': 'PATCH' 

72 } 

73 ] 

74 ), 

75 policy.DocumentedRuleDefault( 

76 name=ACTION_PLAN % 'start', 

77 check_str=base.RULE_ADMIN_API, 

78 description='Start an action plans.', 

79 operations=[ 

80 { 

81 'path': '/v1/action_plans/{action_plan_uuid}/start', 

82 'method': 'POST' 

83 } 

84 ] 

85 ) 

86] 

87 

88 

89def list_rules(): 

90 return rules