summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2018-08-03 06:13:42 +0000
committerBin Yang <bin.yang@windriver.com>2018-08-03 06:13:42 +0000
commitb906025377784de4152de1963b8c7df005d8b59c (patch)
treee31501c146256af537f8c3aeefefbd171e87f5ea
parentf5718605d7aae67eb9b63e3d5fa3f2217ec9bdf2 (diff)
Upgrade API for vesagent
first try to add API v1 version Change-Id: Ic7511ce3c41792a3fa4a4ede84dd04483997033b Issue-ID: MULTICLOUD-297 Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r--windriver/titanium_cloud/urls.py21
-rw-r--r--windriver/titanium_cloud/vesagent/vesagent_ctrl.py21
2 files changed, 42 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/urls.py b/windriver/titanium_cloud/urls.py
index 51bcdd7f..cc538d63 100644
--- a/windriver/titanium_cloud/urls.py
+++ b/windriver/titanium_cloud/urls.py
@@ -44,6 +44,27 @@ urlpatterns = [
url(r'^api/multicloud-titanium_cloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)/vesagent/?$',
vesagent_ctrl.VesAgentCtrl.as_view()),
+#API upgrading
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/registry/?$',
+# registration.Registry.as_view()),
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/?$',
+# registration.Registry.as_view()),
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/exten',
+# include('titanium_cloud.extensions.urls')),
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/',
+# include('titanium_cloud.proxy.urls')),
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/tenants/?$',
+# tenants.Tenants.as_view()),
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/'
+# '(?P<tenantid>[0-9a-zA-Z_-]{20,})/', include('titanium_cloud.requests.urls')),
+ # CapacityCheck
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/capacity_check/?$',
+# capacity.CapacityCheck.as_view()),
+ # events
+# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/events_check/?$',
+# events.EventsCheck.as_view()),
+ url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/vesagent/?$',
+ vesagent_ctrl.VesAgentCtrlV1.as_view()),
]
diff --git a/windriver/titanium_cloud/vesagent/vesagent_ctrl.py b/windriver/titanium_cloud/vesagent/vesagent_ctrl.py
index 54b770bf..207ae561 100644
--- a/windriver/titanium_cloud/vesagent/vesagent_ctrl.py
+++ b/windriver/titanium_cloud/vesagent/vesagent_ctrl.py
@@ -404,3 +404,24 @@ class VesAgentCtrl(APIView):
self._logger.debug("return without backlog")
return None
+
+
+class VesAgentCtrlV1(VesAgentCtrl):
+
+ def __init__(self):
+ self._logger = logger
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
+
+ def get(self, request, cloud_owner="", cloud_region_id=""):
+ '''
+ :param request:
+ :param cloud_owner:
+ :param cloud_region_id:
+ :return:
+ '''
+ self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id))
+ self._logger.debug("with META: %s" % request.META)
+
+ #temp realization for API upgrading only, assume cloud_owner does not contains "_" , refactor it later
+ vimid = cloud_owner+"_"+cloud_region_id
+ return super(VesAgentCtrlV1,self).get(request, vimid)