Coverage for watcher/common/policies/scoring_engine.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 

17SCORING_ENGINE = 'scoring_engine:%s' 

18 

19rules = [ 

20 # FIXME(lbragstad): Find someone from watcher to double check this 

21 # information. This API isn't listed in watcher's API reference 

22 # documentation. 

23 policy.DocumentedRuleDefault( 

24 name=SCORING_ENGINE % 'detail', 

25 check_str=base.RULE_ADMIN_API, 

26 description='List scoring engines with details.', 

27 operations=[ 

28 { 

29 'path': '/v1/scoring_engines/detail', 

30 'method': 'GET' 

31 } 

32 ] 

33 ), 

34 # FIXME(lbragstad): Find someone from watcher to double check this 

35 # information. This API isn't listed in watcher's API reference 

36 # documentation. 

37 policy.DocumentedRuleDefault( 

38 name=SCORING_ENGINE % 'get', 

39 check_str=base.RULE_ADMIN_API, 

40 description='Get a scoring engine.', 

41 operations=[ 

42 { 

43 'path': '/v1/scoring_engines/{scoring_engine_id}', 

44 'method': 'GET' 

45 } 

46 ] 

47 ), 

48 # FIXME(lbragstad): Find someone from watcher to double check this 

49 # information. This API isn't listed in watcher's API reference 

50 # documentation. 

51 policy.DocumentedRuleDefault( 

52 name=SCORING_ENGINE % 'get_all', 

53 check_str=base.RULE_ADMIN_API, 

54 description='Get all scoring engines.', 

55 operations=[ 

56 { 

57 'path': '/v1/scoring_engines', 

58 'method': 'GET' 

59 } 

60 ] 

61 ) 

62] 

63 

64 

65def list_rules(): 

66 return rules