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