Merge "Annotate all the filter parameters for networks"

This commit is contained in:
Zuul 2018-04-11 23:37:17 +00:00 committed by Gerrit Code Review
commit d2c6567e8a
10 changed files with 22 additions and 4 deletions

View File

@ -84,6 +84,7 @@ The following are the defined keys for attribute maps:
``validate`` specifies rules for validating data in the attribute
``convert_to`` transformation to apply to the value before it is returned
``convert_list_to`` if the value is a list, apply this transformation to the value before it is returned
``is_filter`` the attribute can be used in ``GET`` requests as filter
``is_visible`` the attribute is returned in ``GET`` responses
``required_by_policy`` the attribute is required by the policy engine and should therefore be filled by the API layer even if not present in request body
``enforce_policy`` the attribute is actively part of the policy enforcing mechanism, ie: there might be rules which refer to this attribute

View File

@ -42,6 +42,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_post': True,
'allow_put': True,
'default': False,
'is_filter': True,
'is_visible': True,
'convert_to': converters.convert_to_boolean,
'enforce_policy': True,

View File

@ -147,6 +147,7 @@ KNOWN_KEYWORDS = (
'default',
'enforce_policy',
'is_visible',
'is_filter',
'primary_key',
'required_by_policy',
'validate',

View File

@ -36,6 +36,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_put': True,
'default': False,
'is_visible': True,
'is_filter': True,
'convert_to': converters.convert_to_boolean,
'enforce_policy': True,
'required_by_policy': True

View File

@ -36,24 +36,27 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True},
'name': {'allow_post': True, 'allow_put': True,
'validate': {
'type:string': db_const.NAME_FIELD_SIZE},
'default': '', 'is_visible': True},
'default': '', 'is_visible': True, 'is_filter': True},
subnet.COLLECTION_NAME: {'allow_post': False, 'allow_put': False,
'default': [],
'is_visible': True},
'admin_state_up': {'allow_post': True, 'allow_put': True,
'default': True,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True},
'status': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_visible': True, 'is_filter': 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},
constants.SHARED: {
'allow_post': True,
@ -61,6 +64,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'default': False,
'convert_to': converters.convert_to_boolean,
'is_visible': True,
'is_filter': True,
'required_by_policy': True,
'enforce_policy': True
}

View File

@ -49,7 +49,7 @@ UPDATED_TIMESTAMP = "2015-03-25T10:00:00-00:00"
RESOURCE_ATTRIBUTE_MAP = {
network.COLLECTION_NAME: {
MTU: {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_visible': True, 'is_filter': True},
},
}

View File

@ -65,17 +65,20 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:string': NETWORK_TYPE_MAX_LEN},
'default': constants.ATTR_NOT_SPECIFIED,
'enforce_policy': True,
'is_filter': True,
'is_visible': True},
PHYSICAL_NETWORK: {'allow_post': True, 'allow_put': True,
'validate': {'type:string':
PHYSICAL_NETWORK_MAX_LEN},
'default': constants.ATTR_NOT_SPECIFIED,
'enforce_policy': True,
'is_filter': True,
'is_visible': True},
SEGMENTATION_ID: {'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_int,
'enforce_policy': True,
'default': constants.ATTR_NOT_SPECIFIED,
'is_filter': True,
'is_visible': True},
}
}

View File

@ -49,7 +49,8 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_put': False,
'convert_to': converters.convert_to_boolean,
'default': constants.ATTR_NOT_SPECIFIED,
'is_visible': True
'is_visible': True,
'is_filter': True
}
}
}

View File

@ -58,6 +58,7 @@ ASSERT_FUNCTIONS = {
'convert_list_to': assert_converter,
'default': assert_converter,
'enforce_policy': assert_bool,
'is_filter': assert_bool,
'is_visible': assert_bool,
'primary_key': assert_true,
'required_by_policy': assert_bool,

View File

@ -0,0 +1,5 @@
---
features:
- |
Add a new keyword ``is_filter`` to attribute maps. This keyword indicates
that the attribute can be used for filtering result on list requests.