| 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 ipsec site |
| 19 |
connections. |
| 20 |
""" |
| 21 |
|
| 22 |
rules = [ |
| 23 |
policy.DocumentedRuleDefault( |
| 24 |
name='create_ipsec_site_connection', |
| 25 |
check_str=neutron_base.ADMIN_OR_PROJECT_MEMBER, |
| 26 |
scope_types=['project'], |
| 27 |
description='Create an IPsec site connection', |
| 28 |
operations=[ |
| 29 |
{ |
| 30 |
'method': 'POST', |
| 31 |
'path': '/vpn/ipsec-site-connections', |
| 32 |
}, |
| 33 |
], |
| 34 |
deprecated_rule=policy.DeprecatedRule( |
| 35 |
name='create_ipsec_site_connection', |
| 36 |
check_str=base.RULE_ANY, |
| 37 |
deprecated_reason=DEPRECATED_REASON, |
| 38 |
deprecated_since='2025.2') |
| 39 |
), |
| 40 |
policy.DocumentedRuleDefault( |
| 41 |
name='update_ipsec_site_connection', |
| 42 |
check_str=neutron_base.ADMIN_OR_PROJECT_MEMBER, |
| 43 |
scope_types=['project'], |
| 44 |
description='Update an IPsec site connection', |
| 45 |
operations=[ |
| 46 |
{ |
| 47 |
'method': 'PUT', |
| 48 |
'path': '/vpn/ipsec-site-connections/{id}', |
| 49 |
}, |
| 50 |
], |
| 51 |
deprecated_rule=policy.DeprecatedRule( |
| 52 |
name='update_ipsec_site_connection', |
| 53 |
check_str=base.RULE_ADMIN_OR_OWNER, |
| 54 |
deprecated_reason=DEPRECATED_REASON, |
| 55 |
deprecated_since='2025.2') |
| 56 |
), |
| 57 |
policy.DocumentedRuleDefault( |
| 58 |
name='delete_ipsec_site_connection', |
| 59 |
check_str=neutron_base.ADMIN_OR_PROJECT_MEMBER, |
| 60 |
scope_types=['project'], |
| 61 |
description='Delete an IPsec site connection', |
| 62 |
operations=[ |
| 63 |
{ |
| 64 |
'method': 'DELETE', |
| 65 |
'path': '/vpn/ipsec-site-connections/{id}', |
| 66 |
}, |
| 67 |
], |
| 68 |
deprecated_rule=policy.DeprecatedRule( |
| 69 |
name='delete_ipsec_site_connection', |
| 70 |
check_str=base.RULE_ADMIN_OR_OWNER, |
| 71 |
deprecated_reason=DEPRECATED_REASON, |
| 72 |
deprecated_since='2025.2') |
| 73 |
), |
| 74 |
policy.DocumentedRuleDefault( |
| 75 |
name='get_ipsec_site_connection', |
| 76 |
check_str=neutron_base.ADMIN_OR_PROJECT_MEMBER, |
| 77 |
scope_types=['project'], |
| 78 |
description='Get IPsec site connections', |
| 79 |
operations=[ |
| 80 |
{ |
| 81 |
'method': 'GET', |
| 82 |
'path': '/vpn/ipsec-site-connections', |
| 83 |
}, |
| 84 |
{ |
| 85 |
'method': 'GET', |
| 86 |
'path': '/vpn/ipsec-site-connections/{id}', |
| 87 |
}, |
| 88 |
], |
| 89 |
deprecated_rule=policy.DeprecatedRule( |
| 90 |
name='get_ipsec_site_connection', |
| 91 |
check_str=base.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 |