summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYogeshwar Srikrishnan <yoga80@yahoo.com>2011-10-19 10:38:43 -0500
committerYogeshwar Srikrishnan <yoga80@yahoo.com>2011-10-19 10:41:38 -0500
commit37ff1d676236aa9fe50b4cacbe0dfd5544ede9a0 (patch)
treea8440b3fd7baf26e657360a7bda31983ac907604
parent831a755a77a2c293d1557031d367d9f8633a4e63 (diff)
downloadkeystone-37ff1d676236aa9fe50b4cacbe0dfd5544ede9a0.tar.gz
keystone-37ff1d676236aa9fe50b4cacbe0dfd5544ede9a0.tar.xz
keystone-37ff1d676236aa9fe50b4cacbe0dfd5544ede9a0.zip
Changes to support API calls as per OS-KSCATALOG extension.
Change-Id: I087b6f06528e4751d92fd9a98d5dc4d7f4c1c774
-rw-r--r--keystone/contrib/extensions/admin/__init__.py5
-rw-r--r--keystone/contrib/extensions/admin/oskscatalog/extension_handler.py63
-rwxr-xr-xkeystone/routers/admin.py38
-rw-r--r--keystone/test/functional/common.py40
4 files changed, 92 insertions, 54 deletions
diff --git a/keystone/contrib/extensions/admin/__init__.py b/keystone/contrib/extensions/admin/__init__.py
index e8bb3ac8..dfa84fbd 100644
--- a/keystone/contrib/extensions/admin/__init__.py
+++ b/keystone/contrib/extensions/admin/__init__.py
@@ -19,8 +19,13 @@
from keystone.contrib.extensions.admin.osksadm.extension_handler\
import ExtensionHandler as KSADMExtensionHandler
+from keystone.contrib.extensions.admin.oskscatalog.extension_handler\
+ import ExtensionHandler as KSCATALOGExtensionHandler
def configure_extensions(mapper, options):
+ #TODO: Make extensions configurable.
ksadm_extenion_handler = KSADMExtensionHandler()
ksadm_extenion_handler.map_extension_methods(mapper, options)
+ kscatalog_extension_handler = KSCATALOGExtensionHandler()
+ kscatalog_extension_handler.map_extension_methods(mapper, options)
diff --git a/keystone/contrib/extensions/admin/oskscatalog/extension_handler.py b/keystone/contrib/extensions/admin/oskscatalog/extension_handler.py
new file mode 100644
index 00000000..cd0c3927
--- /dev/null
+++ b/keystone/contrib/extensions/admin/oskscatalog/extension_handler.py
@@ -0,0 +1,63 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from keystone.contrib.extensions.admin.extension import BaseExtensionHandler
+from keystone.controllers.endpointtemplates import EndpointTemplatesController
+
+
+class ExtensionHandler(BaseExtensionHandler):
+ def map_extension_methods(self, mapper, options):
+ #EndpointTemplates Calls
+ endpoint_templates_controller = EndpointTemplatesController(options)
+ mapper.connect("/OS-KSCATALOG/endpointTemplates",
+ controller=endpoint_templates_controller,
+ action="get_endpoint_templates",
+ conditions=dict(method=["GET"]))
+ mapper.connect("/OS-KSCATALOG/endpointTemplates",
+ controller=endpoint_templates_controller,
+ action="add_endpoint_template",
+ conditions=dict(method=["POST"]))
+ mapper.connect(
+ "/OS-KSCATALOG/endpointTemplates/{endpoint_template_id}",
+ controller=endpoint_templates_controller,
+ action="get_endpoint_template",
+ conditions=dict(method=["GET"]))
+ mapper.connect(
+ "/OS-KSCATALOG/endpointTemplates/{endpoint_template_id}",
+ controller=endpoint_templates_controller,
+ action="modify_endpoint_template",
+ conditions=dict(method=["PUT"]))
+ mapper.connect(
+ "/OS-KSCATALOG/endpointTemplates/{endpoint_template_id}",
+ controller=endpoint_templates_controller,
+ action="delete_endpoint_template",
+ conditions=dict(method=["DELETE"]))
+ #Endpoint Calls
+ mapper.connect("/tenants/{tenant_id}/OS-KSCATALOG/endpoints",
+ controller=endpoint_templates_controller,
+ action="get_endpoints_for_tenant",
+ conditions=dict(method=["GET"]))
+ mapper.connect("/tenants/{tenant_id}/OS-KSCATALOG/endpoints",
+ controller=endpoint_templates_controller,
+ action="add_endpoint_to_tenant",
+ conditions=dict(method=["POST"]))
+ mapper.connect(
+ "/tenants/{tenant_id}/OS-KSCATALOG/endpoints/{endpoint_id}",
+ controller=endpoint_templates_controller,
+ action="remove_endpoint_from_tenant",
+ conditions=dict(method=["DELETE"]))
diff --git a/keystone/routers/admin.py b/keystone/routers/admin.py
index 6c51e961..c915c74d 100755
--- a/keystone/routers/admin.py
+++ b/keystone/routers/admin.py
@@ -20,7 +20,6 @@ import routes
from keystone.common import wsgi
import keystone.backends as db
from keystone.controllers.auth import AuthController
-from keystone.controllers.endpointtemplates import EndpointTemplatesController
from keystone.controllers.roles import RolesController
from keystone.controllers.staticfiles import StaticFilesController
from keystone.controllers.tenant import TenantController
@@ -78,43 +77,6 @@ class AdminApi(wsgi.Router):
mapper.connect("/users/{user_id}/roles",
controller=roles_controller, action="get_user_roles",
conditions=dict(method=["GET"]))
-
- #EndpointTemplatesControllers and Endpoints
- endpoint_templates_controller = EndpointTemplatesController(options)
- mapper.connect("/endpointTemplates",
- controller=endpoint_templates_controller,
- action="get_endpoint_templates",
- conditions=dict(method=["GET"]))
- mapper.connect("/endpointTemplates",
- controller=endpoint_templates_controller,
- action="add_endpoint_template",
- conditions=dict(method=["POST"]))
- mapper.connect("/endpointTemplates/{endpoint_template_id}",
- controller=endpoint_templates_controller,
- action="get_endpoint_template",
- conditions=dict(method=["GET"]))
- mapper.connect("/endpointTemplates/{endpoint_template_id}",
- controller=endpoint_templates_controller,
- action="modify_endpoint_template",
- conditions=dict(method=["PUT"]))
- mapper.connect("/endpointTemplates/{endpoint_template_id}",
- controller=endpoint_templates_controller,
- action="delete_endpoint_template",
- conditions=dict(method=["DELETE"]))
- mapper.connect("/tenants/{tenant_id}/endpoints",
- controller=endpoint_templates_controller,
- action="get_endpoints_for_tenant",
- conditions=dict(method=["GET"]))
- mapper.connect("/tenants/{tenant_id}/endpoints",
- controller=endpoint_templates_controller,
- action="add_endpoint_to_tenant",
- conditions=dict(method=["POST"]))
- mapper.connect(
- "/tenants/{tenant_id}/endpoints/{endpoint_id}",
- controller=endpoint_templates_controller,
- action="remove_endpoint_from_tenant",
- conditions=dict(method=["DELETE"]))
-
# Miscellaneous Operations
version_controller = VersionController(options)
mapper.connect("/", controller=version_controller,
diff --git a/keystone/test/functional/common.py b/keystone/test/functional/common.py
index a8f4b3cb..2213c1b8 100644
--- a/keystone/test/functional/common.py
+++ b/keystone/test/functional/common.py
@@ -328,48 +328,56 @@ class ApiTestCase(RestfulTestCase):
path='/OS-KSADM/roles/%s' % (role_id,), **kwargs)
def get_endpoint_templates(self, **kwargs):
- """GET /endpointTemplates"""
- return self.admin_request(method='GET', path='/endpointTemplates',
+ """GET /OS-KSCATALOG/endpointTemplates"""
+ return self.admin_request(method='GET',
+ path='/OS-KSCATALOG/endpointTemplates',
**kwargs)
def post_endpoint_template(self, **kwargs):
- """POST /endpointTemplates"""
- return self.admin_request(method='POST', path='/endpointTemplates',
+ """POST /OS-KSCATALOG/endpointTemplates"""
+ return self.admin_request(method='POST',
+ path='/OS-KSCATALOG/endpointTemplates',
**kwargs)
def put_endpoint_template(self, endpoint_template_id, **kwargs):
- """PUT /endpointTemplates/{endpoint_template_id}"""
+ """PUT /OS-KSCATALOG/endpointTemplates/{endpoint_template_id}"""
return self.admin_request(method='PUT',
- path='/endpointTemplates/%s' % (endpoint_template_id,),
+ path='/OS-KSCATALOG/endpointTemplates/%s'
+ % (endpoint_template_id,),
**kwargs)
def get_endpoint_template(self, endpoint_template_id, **kwargs):
- """GET /endpointTemplates/{endpoint_template_id}"""
+ """GET /OS-KSCATALOG/endpointTemplates/{endpoint_template_id}"""
return self.admin_request(method='GET',
- path='/endpointTemplates/%s' % (endpoint_template_id,),
+ path='/OS-KSCATALOG/endpointTemplates/%s'
+ % (endpoint_template_id,),
**kwargs)
def delete_endpoint_template(self, endpoint_template_id, **kwargs):
- """DELETE /endpointTemplates/{endpoint_template_id}"""
+ """DELETE /OS-KSCATALOG/endpointTemplates/{endpoint_template_id}"""
return self.admin_request(method='DELETE',
- path='/endpointTemplates/%s' % (endpoint_template_id,),
+ path='/OS-KSCATALOG/endpointTemplates/%s' %
+ (endpoint_template_id,),
**kwargs)
def get_tenant_endpoints(self, tenant_id, **kwargs):
- """GET /tenants/{tenant_id}/endpoints"""
+ """GET /tenants/{tenant_id}/OS-KSCATALOG/endpoints"""
return self.admin_request(method='GET',
- path='/tenants/%s/endpoints' % (tenant_id,),
+ path='/tenants/%s/OS-KSCATALOG/endpoints' %
+ (tenant_id,),
**kwargs)
def post_tenant_endpoint(self, tenant_id, **kwargs):
- """POST /tenants/{tenant_id}/endpoints"""
+ """POST /tenants/{tenant_id}/OS-KSCATALOG/endpoints"""
return self.admin_request(method='POST',
- path='/tenants/%s/endpoints' % (tenant_id,), **kwargs)
+ path='/tenants/%s/OS-KSCATALOG/endpoints' %
+ (tenant_id,), **kwargs)
def delete_tenant_endpoint(self, tenant_id, endpoint_id, **kwargs):
- """DELETE /tenants/{tenant_id}/endpoints/{endpoint_id}"""
+ """DELETE /tenants/{tenant_id}/OS-KSCATALOG/endpoints/{endpoint_id}"""
return self.admin_request(method='DELETE',
- path='/tenants/%s/endpoints/%s' % (tenant_id, endpoint_id,),
+ path='/tenants/%s/OS-KSCATALOG/endpoints/%s' %
+ (tenant_id, endpoint_id,),
**kwargs)
def post_service(self, **kwargs):