Annotate filter parameters for tag attributes

* Add additional attributes 'tags-any', 'not-tags' and 'not-tags-any'
  to the attribute map. These three attributes represent the query
  parameters on list request.
* Add 'is_filter' keyword for attributes 'tags', 'tags-any', 'not-tags'
  and 'not-tags-any'. This indicates that these four attributes can be
  used as filter parameters. In the future, we will rely on this metadata
  to perform filter validation: https://review.openstack.org/#/c/554368/

Change-Id: I9e2033e7ba9d198f96c1ce6089a809d6721dd82d
Related-Bug: #1749820
This commit is contained in:
Hongbin Lu 2018-05-08 22:35:35 +00:00
parent 32b6846ae6
commit 8b19db164a
1 changed files with 11 additions and 1 deletions

View File

@ -31,12 +31,22 @@ from neutron.db import standard_attr
TAG = 'tag'
TAGS = TAG + 's'
TAGS_ANY = TAGS + '-any'
NOT_TAGS = 'not-' + TAGS
NOT_TAGS_ANY = NOT_TAGS + '-any'
MAX_TAG_LEN = 60
TAG_PLUGIN_TYPE = 'TAG'
TAG_SUPPORTED_RESOURCES = standard_attr.get_tag_resource_parent_map()
TAG_ATTRIBUTE_MAP = {
TAGS: {'allow_post': False, 'allow_put': False, 'is_visible': True}
TAGS: {'allow_post': False, 'allow_put': False,
'is_visible': True, 'is_filter': True},
TAGS_ANY: {'allow_post': False, 'allow_put': False,
'is_visible': False, 'is_filter': True},
NOT_TAGS: {'allow_post': False, 'allow_put': False,
'is_visible': False, 'is_filter': True},
NOT_TAGS_ANY: {'allow_post': False, 'allow_put': False,
'is_visible': False, 'is_filter': True},
}