Mark the domain config API as experimental
This patch provides generic support for marking individual JSON Home resources with a status, and uses that support to mark the three APi variants for managing domain configs in the database as 'experimental'. Change-Id: Iae158f2943916fe78622b844c7e9837889e4cc2c Implements: blueprint domain-config-ext
This commit is contained in:
parent
55d940c70b
commit
3b1085b862
|
@ -54,6 +54,18 @@ class Parameters(object):
|
|||
USER_ID = build_v3_parameter_relation('user_id')
|
||||
|
||||
|
||||
class Status(object):
|
||||
"""Status values supported."""
|
||||
|
||||
DEPRECATED = 'deprecated'
|
||||
EXPERIMENTAL = 'experimental'
|
||||
STABLE = 'stable'
|
||||
|
||||
@classmethod
|
||||
def is_supported(cls, status):
|
||||
return status in [cls.DEPRECATED, cls.EXPERIMENTAL, cls.STABLE]
|
||||
|
||||
|
||||
def translate_urls(json_home, new_prefix):
|
||||
"""Given a JSON Home document, sticks new_prefix on each of the urls."""
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import webob.dec
|
|||
import webob.exc
|
||||
|
||||
from keystone.common import dependency
|
||||
from keystone.common import json_home
|
||||
from keystone.common import utils
|
||||
from keystone import exception
|
||||
from keystone.i18n import _
|
||||
|
@ -656,7 +657,7 @@ class RoutersBase(object):
|
|||
get_action=None, head_action=None, get_head_action=None,
|
||||
put_action=None, post_action=None, patch_action=None,
|
||||
delete_action=None, get_post_action=None,
|
||||
path_vars=None):
|
||||
path_vars=None, status=None):
|
||||
if get_head_action:
|
||||
getattr(controller, get_head_action) # ensure the attribute exists
|
||||
mapper.connect(path, controller=controller, action=get_head_action,
|
||||
|
@ -698,6 +699,14 @@ class RoutersBase(object):
|
|||
else:
|
||||
resource_data['href'] = path
|
||||
|
||||
if status:
|
||||
if not json_home.Status.is_supported(status):
|
||||
raise exception.Error(message=_(
|
||||
'Unexpected status requested for JSON Home response, %s') %
|
||||
status)
|
||||
resource_data.setdefault('hints', {})
|
||||
resource_data['hints']['status'] = status
|
||||
|
||||
self.v3_resources.append((rel, resource_data))
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class Routers(wsgi.RoutersBase):
|
|||
patch_action='update_domain_config_only',
|
||||
delete_action='delete_domain_config',
|
||||
rel=json_home.build_v3_resource_relation('domain_config'),
|
||||
status=json_home.Status.EXPERIMENTAL,
|
||||
path_vars={
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID
|
||||
})
|
||||
|
@ -66,6 +67,7 @@ class Routers(wsgi.RoutersBase):
|
|||
patch_action='update_domain_config_group',
|
||||
delete_action='delete_domain_config',
|
||||
rel=json_home.build_v3_resource_relation('domain_config_group'),
|
||||
status=json_home.Status.EXPERIMENTAL,
|
||||
path_vars={
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID,
|
||||
'group': config_group_param
|
||||
|
@ -78,6 +80,7 @@ class Routers(wsgi.RoutersBase):
|
|||
patch_action='update_domain_config',
|
||||
delete_action='delete_domain_config',
|
||||
rel=json_home.build_v3_resource_relation('domain_config_option'),
|
||||
status=json_home.Status.EXPERIMENTAL,
|
||||
path_vars={
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID,
|
||||
'group': config_group_param,
|
||||
|
|
|
@ -494,20 +494,23 @@ V3_JSON_HOME_RESOURCES_INHERIT_DISABLED = {
|
|||
'href-template':
|
||||
'/domains/{domain_id}/config',
|
||||
'href-vars': {
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID}},
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID},
|
||||
'hints': {'status': 'experimental'}},
|
||||
json_home.build_v3_resource_relation('domain_config_group'): {
|
||||
'href-template':
|
||||
'/domains/{domain_id}/config/{group}',
|
||||
'href-vars': {
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID,
|
||||
'group': json_home.build_v3_parameter_relation('config_group')}},
|
||||
'group': json_home.build_v3_parameter_relation('config_group')},
|
||||
'hints': {'status': 'experimental'}},
|
||||
json_home.build_v3_resource_relation('domain_config_option'): {
|
||||
'href-template':
|
||||
'/domains/{domain_id}/config/{group}/{option}',
|
||||
'href-vars': {
|
||||
'domain_id': json_home.Parameters.DOMAIN_ID,
|
||||
'group': json_home.build_v3_parameter_relation('config_group'),
|
||||
'option': json_home.build_v3_parameter_relation('config_option')}},
|
||||
'option': json_home.build_v3_parameter_relation('config_option')},
|
||||
'hints': {'status': 'experimental'}},
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue