Coverage for watcher/common/policies/strategy.py: 100%
6 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« 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.
13from oslo_policy import policy
15from watcher.common.policies import base
17STRATEGY = 'strategy:%s'
19rules = [
20 policy.DocumentedRuleDefault(
21 name=STRATEGY % 'detail',
22 check_str=base.RULE_ADMIN_API,
23 description='List strategies with detail.',
24 operations=[
25 {
26 'path': '/v1/strategies/detail',
27 'method': 'GET'
28 }
29 ]
30 ),
31 policy.DocumentedRuleDefault(
32 name=STRATEGY % 'get',
33 check_str=base.RULE_ADMIN_API,
34 description='Get a strategy.',
35 operations=[
36 {
37 'path': '/v1/strategies/{strategy_uuid}',
38 'method': 'GET'
39 }
40 ]
41 ),
42 policy.DocumentedRuleDefault(
43 name=STRATEGY % 'get_all',
44 check_str=base.RULE_ADMIN_API,
45 description='List all strategies.',
46 operations=[
47 {
48 'path': '/v1/strategies',
49 'method': 'GET'
50 }
51 ]
52 ),
53 policy.DocumentedRuleDefault(
54 name=STRATEGY % 'state',
55 check_str=base.RULE_ADMIN_API,
56 description='Get state of strategy.',
57 operations=[
58 {
59 'path': '/v1/strategies{strategy_uuid}/state',
60 'method': 'GET'
61 }
62 ]
63 )
64]
67def list_rules():
68 return rules