bgpvpn: Add `is_filter` to API definition
The BGPVPN API definition predates the introduction of ``is_filter``. No attribute on ``bgpvpns`` was declared as filterable, which causes list operations with query filters (e.g. ``?name=foo``) to return HTTP 400 when filter-validation is enabled. Add ``is_filter: True`` to the four scalar attributes (``id``, ``tenant_id``, ``name``, and ``type``) and reformat the attribute map to match the multi-line style used in other updated API definitions. Related-Bug: #2167310 Assisted-By: Composer 2.5 Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com> Change-Id: Idf19641083e17fb823522a4b22f09a0db2d41087
This commit is contained in:
1 parent
5a5725ba76
commit
e9290a22d1
2 files changed
+93
-55
No files matched your search
@@ -82,61 +82,91 @@ ROUTER_ASSOCIATIONS = 'router_associations'
|
||||
# The resource attribute map for the extension.
|
||||
RESOURCE_ATTRIBUTE_MAP: ResourceAttributeMap = {
|
||||
COLLECTION_NAME: {
|
||||
'id': {'allow_post': False, 'allow_put': False,
|
||||
'validate': {'type:uuid': None},
|
||||
'is_visible': True,
|
||||
'primary_key': True,
|
||||
'enforce_policy': True},
|
||||
'tenant_id': {'allow_post': True, 'allow_put': False,
|
||||
'validate': {
|
||||
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
||||
'required_by_policy': True,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'name': {'allow_post': True, 'allow_put': True,
|
||||
'default': '',
|
||||
'validate': {'type:name_string': db_const.NAME_FIELD_SIZE},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'type': {'allow_post': True, 'allow_put': False,
|
||||
'default': BGPVPN_L3,
|
||||
'validate': {'type:values': BGPVPN_TYPES},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'route_targets': {'allow_post': True, 'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none':
|
||||
RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'import_targets': {'allow_post': True, 'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none':
|
||||
RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'export_targets': {'allow_post': True, 'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none':
|
||||
RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'route_distinguishers': {'allow_post': True, 'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none':
|
||||
RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'networks': {'allow_post': False, 'allow_put': False,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
'routers': {'allow_post': False, 'allow_put': False,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True}
|
||||
'id': {
|
||||
'allow_post': False,
|
||||
'allow_put': False,
|
||||
'validate': {'type:uuid': None},
|
||||
'is_filter': True,
|
||||
'is_visible': True,
|
||||
'primary_key': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'tenant_id': {
|
||||
'allow_post': True,
|
||||
'allow_put': False,
|
||||
'validate': {
|
||||
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
||||
'required_by_policy': True,
|
||||
'is_filter': True,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'name': {
|
||||
'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': '',
|
||||
'validate': {'type:name_string': db_const.NAME_FIELD_SIZE},
|
||||
'is_filter': True,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'type': {
|
||||
'allow_post': True,
|
||||
'allow_put': False,
|
||||
'default': BGPVPN_L3,
|
||||
'validate': {'type:values': BGPVPN_TYPES},
|
||||
'is_filter': True,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'route_targets': {
|
||||
'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none': RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'import_targets': {
|
||||
'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none': RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'export_targets': {
|
||||
'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none': RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'route_distinguishers': {
|
||||
'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': [],
|
||||
'convert_to': converters.convert_to_list,
|
||||
'validate': {'type:list_of_regex_or_none': RTRD_REGEX},
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'networks': {
|
||||
'allow_post': False,
|
||||
'allow_put': False,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
},
|
||||
'routers': {
|
||||
'allow_post': False,
|
||||
'allow_put': False,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Added ``is_filter`` to all scalar attributes in the BGPVPN API definition
|
||||
(``id``, ``tenant_id``, ``name``, and ``type``). Previously, no BGPVPN
|
||||
attribute was declared as filterable, which caused list operations with
|
||||
query filters (e.g. ``?name=foo``) to return HTTP 400 when the
|
||||
filter-validation extension is enabled.
|
||||
Reference in new issue
Block a user