From b906025377784de4152de1963b8c7df005d8b59c Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Fri, 3 Aug 2018 06:13:42 +0000 Subject: Upgrade API for vesagent first try to add API v1 version Change-Id: Ic7511ce3c41792a3fa4a4ede84dd04483997033b Issue-ID: MULTICLOUD-297 Signed-off-by: Bin Yang --- windriver/titanium_cloud/urls.py | 21 +++++++++++++++++++++ windriver/titanium_cloud/vesagent/vesagent_ctrl.py | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'windriver') 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[0-9a-zA-Z_-]+)/vesagent/?$', vesagent_ctrl.VesAgentCtrl.as_view()), +#API upgrading +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/registry/?$', +# registration.Registry.as_view()), +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/?$', +# registration.Registry.as_view()), +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/exten', +# include('titanium_cloud.extensions.urls')), +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/', +# include('titanium_cloud.proxy.urls')), +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/tenants/?$', +# tenants.Tenants.as_view()), +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/' +# '(?P[0-9a-zA-Z_-]{20,})/', include('titanium_cloud.requests.urls')), + # CapacityCheck +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/capacity_check/?$', +# capacity.CapacityCheck.as_view()), + # events +# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/events_check/?$', +# events.EventsCheck.as_view()), + url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[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) -- cgit 1.2.3-korg