| 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 |
|
| 13 |
from oslo_policy import policy |
| 14 |
|
| 15 |
from neutron.conf.policies import base |
| 16 |
from neutron_lib.policy import RULE_ADMIN_OR_OWNER |
| 17 |
|
| 18 |
|
| 19 |
COLLECTION_PATH = '/taas/tap_flows' |
| 20 |
RESOURCE_PATH = '/taas/tap_flows/{id}' |
| 21 |
|
| 22 |
DEPRECATED_REASON = """ |
| 23 |
The neutron TAAS API now supports Secure RBAC default roles. |
| 24 |
""" |
| 25 |
|
| 26 |
rules = [ |
| 27 |
policy.DocumentedRuleDefault( |
| 28 |
name='create_tap_flow', |
| 29 |
check_str=base.ADMIN_OR_PROJECT_MEMBER, |
| 30 |
scope_types=['project'], |
| 31 |
description='Create a tap flow', |
| 32 |
operations=[ |
| 33 |
{ |
| 34 |
'method': 'POST', |
| 35 |
'path': COLLECTION_PATH, |
| 36 |
} |
| 37 |
], |
| 38 |
deprecated_rule=policy.DeprecatedRule( |
| 39 |
name='create_tap_flow', |
| 40 |
check_str=RULE_ADMIN_OR_OWNER, |
| 41 |
deprecated_reason=DEPRECATED_REASON, |
| 42 |
deprecated_since='2025.2') |
| 43 |
), |
| 44 |
policy.DocumentedRuleDefault( |
| 45 |
name='update_tap_flow', |
| 46 |
check_str=base.ADMIN_OR_PROJECT_MEMBER, |
| 47 |
scope_types=['project'], |
| 48 |
description='Update a tap flow', |
| 49 |
operations=[ |
| 50 |
{ |
| 51 |
'method': 'PUT', |
| 52 |
'path': RESOURCE_PATH, |
| 53 |
} |
| 54 |
], |
| 55 |
deprecated_rule=policy.DeprecatedRule( |
| 56 |
name='update_tap_flow', |
| 57 |
check_str=RULE_ADMIN_OR_OWNER, |
| 58 |
deprecated_reason=DEPRECATED_REASON, |
| 59 |
deprecated_since='2025.2') |
| 60 |
), |
| 61 |
policy.DocumentedRuleDefault( |
| 62 |
name='get_tap_flow', |
| 63 |
check_str=base.ADMIN_OR_PROJECT_MEMBER, |
| 64 |
scope_types=['project'], |
| 65 |
description='Show a tap flow', |
| 66 |
operations=[ |
| 67 |
{ |
| 68 |
'method': 'GET', |
| 69 |
'path': RESOURCE_PATH, |
| 70 |
} |
| 71 |
], |
| 72 |
deprecated_rule=policy.DeprecatedRule( |
| 73 |
name='get_tap_flow', |
| 74 |
check_str=RULE_ADMIN_OR_OWNER, |
| 75 |
deprecated_reason=DEPRECATED_REASON, |
| 76 |
deprecated_since='2025.2') |
| 77 |
), |
| 78 |
policy.DocumentedRuleDefault( |
| 79 |
name='delete_tap_flow', |
| 80 |
check_str=base.ADMIN_OR_PROJECT_MEMBER, |
| 81 |
scope_types=['project'], |
| 82 |
description='Delete a tap flow', |
| 83 |
operations=[ |
| 84 |
{ |
| 85 |
'method': 'DELETE', |
| 86 |
'path': RESOURCE_PATH, |
| 87 |
} |
| 88 |
], |
| 89 |
deprecated_rule=policy.DeprecatedRule( |
| 90 |
name='delete_tap_flow', |
| 91 |
check_str=RULE_ADMIN_OR_OWNER, |
| 92 |
deprecated_reason=DEPRECATED_REASON, |
| 93 |
deprecated_since='2025.2') |
| 94 |
), |
| 95 |
] |
| 96 |
|
| 97 |
|
| 98 |
def list_rules(): |
| 99 |
return rules |