From c61027a55ac33d5641833af2a46ab8fbbea262fb Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Thu, 30 Aug 2018 15:28:21 +0800 Subject: Update registry API to V1 This patch updates registry/unregistry/capacity_check/extensions API to V1 Change-Id: I7cef1fa53ae5dbca199d133e7bda8de70993e23f Issue-ID: MULTICLOUD-350 Signed-off-by: Ethan Lynn --- vio/vio/swagger/urls.py | 25 ++++++++++++++++++------- vio/vio/swagger/views/capacity/views.py | 6 ++++++ vio/vio/swagger/views/extensions/views.py | 6 ++++++ vio/vio/swagger/views/registry/views.py | 12 ++++++++++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py index 26f5e50..fd6d0ea 100644 --- a/vio/vio/swagger/urls.py +++ b/vio/vio/swagger/urls.py @@ -59,14 +59,14 @@ from vio.swagger.views.proxyplugin.dns.views import DesignateServer from vio.swagger.views.proxyplugin.dns.views import DesignateVersionLink # Registry -from vio.swagger.views.registry.views import Registry -from vio.swagger.views.registry.views import UnRegistry +from vio.swagger.views.registry.views import Registry, RegistryV1 +from vio.swagger.views.registry.views import UnRegistry, UnRegistryV1 # Capacity Check -from vio.swagger.views.capacity.views import CapacityCheck +from vio.swagger.views.capacity.views import CapacityCheck, CapacityCheckV1 # Extensions -from vio.swagger.views.extensions.views import Extensions +from vio.swagger.views.extensions.views import Extensions, ExtensionsV1 # fake from vio.swagger.views.fakeplugin.identity.views import FakeProjects @@ -313,10 +313,19 @@ urlpatterns = [ Registry.as_view()), url(r'^api/multicloud-vio/v0/(?P[0-9a-z-A-Z\-\_]+)$', UnRegistry.as_view()), + url(r'^api/multicloud-vio/v1/(?P[0-9a-z-A-Z\-\_]+)/' + r'(?P[0-9a-z-A-Z\-\_]+)/registry$', + RegistryV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P[0-9a-z-A-Z\-\_]+)/' + r'(?P[0-9a-z-A-Z\-\_]+)$', + UnRegistryV1.as_view()), # CapacityCheck url(r'^api/multicloud-vio/v0/(?P[0-9a-z-A-Z\-\_]+)/capacity_check$', CapacityCheck.as_view()), + url(r'^api/multicloud-vio/v1/(?P[0-9a-z-A-Z\-\_]+)/' + r'(?P[0-9a-z-A-Z\-\_]+)/capacity_check$', + CapacityCheckV1.as_view()), # proxy url(r'^api/multicloud-vio/v0/(?P[0-9a-z-A-Z\-\_]+)/identity/v3', @@ -380,10 +389,12 @@ urlpatterns = [ DesignateServer.as_view()), # Extensions - url( - (r'^api/multicloud-vio/v0/(?P[0-9a-z-A-Z\-\_]+)' - r'/extensions$'), + url(r'^api/multicloud-vio/v0/(?P[0-9a-z-A-Z\-\_]+)' + r'/extensions$', Extensions.as_view()), + url(r'^api/multicloud-vio/v1/(?P[0-9a-z-A-Z\-\_]+)/' + r'(?P[0-9a-z-A-Z\-\_]+)/extensions$', + ExtensionsV1.as_view()), ] diff --git a/vio/vio/swagger/views/capacity/views.py b/vio/vio/swagger/views/capacity/views.py index 1fdc481..f679931 100644 --- a/vio/vio/swagger/views/capacity/views.py +++ b/vio/vio/swagger/views/capacity/views.py @@ -121,3 +121,9 @@ class CapacityCheck(APIView): return Response(data={'result': True}, status=status.HTTP_200_OK) return Response(data={'result': False}, status=status.HTTP_200_OK) + + +class CapacityCheckV1(CapacityCheck): + def post(self, request, cloud_owner, cloud_region): + return super(CapacityCheckV1, self).post( + request, cloud_owner + "_" + cloud_region) diff --git a/vio/vio/swagger/views/extensions/views.py b/vio/vio/swagger/views/extensions/views.py index e590615..b3c7c5c 100644 --- a/vio/vio/swagger/views/extensions/views.py +++ b/vio/vio/swagger/views/extensions/views.py @@ -23,3 +23,9 @@ class Extensions(APIView): def get(self, request, vimid): return Response(data={'extensions': []}, status=status.HTTP_200_OK) + + +class ExtensionsV1(Extensions): + def get(self, request, cloud_owner, cloud_region): + return super(ExtensionsV1, self).get( + request, cloud_owner + "_" + cloud_region) diff --git a/vio/vio/swagger/views/registry/views.py b/vio/vio/swagger/views/registry/views.py index 6e23739..cac49e7 100644 --- a/vio/vio/swagger/views/registry/views.py +++ b/vio/vio/swagger/views/registry/views.py @@ -158,6 +158,12 @@ class Registry(APIView): return Response(data="", status=status.HTTP_200_OK) +class RegistryV1(Registry): + def post(self, request, cloud_owner, cloud_region): + return super(RegistryV1, self).post( + request, cloud_owner + "_" + cloud_region) + + class UnRegistry(APIView): def delete(self, request, vimid): @@ -170,3 +176,9 @@ class UnRegistry(APIView): return Response(data=e.message, status=status.HTTP_500_INTERNAL_SERVER_ERROR) return Response(data="", status=status.HTTP_204_NO_CONTENT) + + +class UnRegistryV1(UnRegistry): + def delete(self, request, cloud_owner, cloud_region): + return super(UnRegistryV1, self).delete( + request, cloud_owner + "_" + cloud_region) -- cgit 1.2.3-korg