diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2018-08-27 15:02:03 +0800 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2018-08-28 11:24:01 +0800 |
commit | 8d094de8fdccf9cb45c8ff511bf6eab3c7b7ce34 (patch) | |
tree | 525044ea292537dcf544271770bbcb59fca4cd4f | |
parent | 2957ef709fbcc0fdc2c302910f8004e2e1c74a10 (diff) |
Update volume API to v1
This patch update volume api to v1
Change-Id: I21d57a212478f3962228c699f2fae1e75bdc1bd8
Issue-ID: MULTICLOUD-342
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r-- | vio/vio/swagger/urls.py | 10 | ||||
-rw-r--r-- | vio/vio/swagger/views/volume/views.py | 20 |
2 files changed, 30 insertions, 0 deletions
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py index 6e9b970..a4ed9a0 100644 --- a/vio/vio/swagger/urls.py +++ b/vio/vio/swagger/urls.py @@ -36,6 +36,8 @@ from vio.swagger.views.image.views import CreateListImagesViewV1 from vio.swagger.views.image.views import GetDeleteImageViewV1 from vio.swagger.views.image.views import CreateImageFileViewV1 from vio.swagger.views.image.views import GetImageFileViewV1 +from vio.swagger.views.volume.views import CreateListVolumeViewV1 +from vio.swagger.views.volume.views import GetDeleteVolumeViewV1 # proxy from vio.swagger.views.proxyplugin.identity.views import TokenView @@ -184,6 +186,14 @@ urlpatterns = [ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' r'images/file/(?P<imageid>[0-9a-zA-Z_-]+)$', GetImageFileViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'volumes$', + CreateListVolumeViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'volumes/(?P<volumeid>[0-9a-zA-Z_-]+)$', + GetDeleteVolumeViewV1.as_view()), # fake urls url(r'^api/multicloud-vio/v0/vmware_fake/identity/v3', diff --git a/vio/vio/swagger/views/volume/views.py b/vio/vio/swagger/views/volume/views.py index 4bb1ba7..6ebf624 100644 --- a/vio/vio/swagger/views/volume/views.py +++ b/vio/vio/swagger/views/volume/views.py @@ -71,6 +71,16 @@ class GetDeleteVolumeView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class GetDeleteVolumeViewV1(GetDeleteVolumeView): + def get(self, request, cloud_owner, cloud_region, tenantid, volumeid): + return super(GetDeleteVolumeViewV1, self).get( + request, cloud_owner + '_' + cloud_region, tenantid, volumeid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, volumeid): + return super(GetDeleteVolumeViewV1, self).delete( + request, cloud_owner + '_' + cloud_region, tenantid, volumeid) + + class CreateListVolumeView(APIView): def get(self, request, vimid, tenantid): @@ -146,3 +156,13 @@ class CreateListVolumeView(APIView): else: return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class CreateListVolumeViewV1(CreateListVolumeView): + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateListVolumeViewV1, self).get( + request, cloud_owner + '_' + cloud_region, tenantid) + + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateListVolumeViewV1, self).post( + request, cloud_owner + '_' + cloud_region, tenantid) |