summaryrefslogtreecommitdiffstats
path: root/multivimbroker
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2018-08-22 05:45:53 +0000
committerBin Yang <bin.yang@windriver.com>2018-08-23 00:32:44 +0000
commit0502b3b6dce5b58ea6601f0658c400c619136b0f (patch)
tree9ecfd2e77334d0089b073494540be3c564202b28 /multivimbroker
parent7204293286d554d86a964a2f44f19d902cf1e47a (diff)
Expose API infra_workload
The POST,GET,DELETE action will be forwarded to specific plugin Issue-ID: MULTICLOUD-310 Change-Id: Ia010347af75b82b2d92ca214abbaf053c36243eb Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'multivimbroker')
-rw-r--r--multivimbroker/multivimbroker/forwarder/urls.py8
-rw-r--r--multivimbroker/multivimbroker/forwarder/views.py18
2 files changed, 25 insertions, 1 deletions
diff --git a/multivimbroker/multivimbroker/forwarder/urls.py b/multivimbroker/multivimbroker/forwarder/urls.py
index 5e1320e..b14333f 100644
--- a/multivimbroker/multivimbroker/forwarder/urls.py
+++ b/multivimbroker/multivimbroker/forwarder/urls.py
@@ -16,6 +16,7 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
+# API v0
from multivimbroker.forwarder.views import CheckCapacity
from multivimbroker.forwarder.views import Extension
from multivimbroker.forwarder.views import Forward
@@ -34,8 +35,10 @@ from multivimbroker.forwarder.views import APIv1Registry
from multivimbroker.forwarder.views import APIv1UnRegistry
from multivimbroker.forwarder.views import APIv1VIMTypes
from multivimbroker.forwarder.views import APIv1MultiPartView
+from multivimbroker.forwarder.views import APIv1InfraWorkload
urlpatterns = [
+ # API v0
url(r'^api/multicloud/v0/vim_types$',
VIMTypes.as_view()),
url(r'^api/multicloud/v0/check_vim_capacity$',
@@ -69,7 +72,7 @@ urlpatterns = [
url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/registry$',
APIv1Registry.as_view()),
- url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)i'
+ url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)$',
APIv1UnRegistry.as_view()),
url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
@@ -81,6 +84,9 @@ urlpatterns = [
url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)',
APIv1Forward.as_view()),
+ url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
+ r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload',
+ APIv1InfraWorkload.as_view()),
]
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py
index ef7ab95..264692e 100644
--- a/multivimbroker/multivimbroker/forwarder/views.py
+++ b/multivimbroker/multivimbroker/forwarder/views.py
@@ -307,3 +307,21 @@ class APIv1MultiPartView(MultiPartView):
vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
return super(APIv1MultiPartView, self).post(request, vimid)
+
+
+class APIv1InfraWorkload(BaseServer):
+
+ def post(self, request, cloud_owner, cloud_region_id):
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return self.send(vimid, request.get_full_path(), request.body, "POST",
+ headers=originHeaders(request))
+
+ def get(self, request, cloud_owner, cloud_region_id):
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return self.send(vimid, request.get_full_path(), request.body, "GET",
+ headers=originHeaders(request))
+
+ def delete(self, request, cloud_owner, cloud_region_id):
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return self.send(vimid, request.get_full_path(), request.body,
+ "DELETE", headers=originHeaders(request))