summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/swagger/views.py
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2018-09-03 08:46:12 +0000
committerBin Yang <bin.yang@windriver.com>2018-09-03 08:46:12 +0000
commit0ac4f904fae7793a3909f6db34ad9b3c35a08c12 (patch)
treeac9239304a11abd8429f4f6e36ef407b51d012f5 /windriver/titanium_cloud/swagger/views.py
parent1a4ae5657da11a59bd5cbde5240450f5db69e379 (diff)
Add new namespace to workaround ISTIO hostname
ISTIO restrains the usage of _ in hostname Issue-ID: MULTICLOUD-335 Change-Id: I54c712aea1a95c6aaac7d50c3b07472730608503 Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/swagger/views.py')
-rw-r--r--windriver/titanium_cloud/swagger/views.py60
1 files changed, 58 insertions, 2 deletions
diff --git a/windriver/titanium_cloud/swagger/views.py b/windriver/titanium_cloud/swagger/views.py
index e912b751..6829714b 100644
--- a/windriver/titanium_cloud/swagger/views.py
+++ b/windriver/titanium_cloud/swagger/views.py
@@ -27,6 +27,45 @@ from newton_base.swagger import views as newton_json_view
logger = logging.getLogger(__name__)
+class SwaggerJsonViewDepreciated(newton_json_view.SwaggerJsonView):
+
+ def get(self, request):
+ '''
+ reuse newton code and update the basePath
+ :param request:
+ :return:
+ '''
+
+ resp = super(SwaggerJsonViewDepreciated,self).get(request)
+ json_data = resp.data if resp else None
+ if json_data:
+ json_data["basePath"] = "/api/multicloud-titanium_cloud/v0/"
+ json_data["info"]["title"] = "Depreciated Service NBI of MultiCloud plugin for Titanium Cloud"
+ return Response(data=json_data, status=200)
+ else:
+ return Response(data={'error':'internal error'}, status=500)
+
+
+
+class APIv1SwaggerJsonViewDepreciated(newton_json_view.SwaggerJsonView):
+
+ def get(self, request):
+ '''
+ reuse newton code and update the basePath
+ :param request:
+ :return:
+ '''
+
+ resp = super(APIv1SwaggerJsonViewDepreciated,self).get(request)
+ json_data = resp.data if resp else None
+ if json_data:
+ json_data["basePath"] = "/api/multicloud-titanium_cloud/v1/"
+ json_data["info"]["title"] = "Depreciated Service NBI v1 of MultiCloud plugin for Titanium Cloud"
+ return Response(data=json_data, status=200)
+ else:
+ return Response(data={'error':'internal error'}, status=500)
+
+
class SwaggerJsonView(newton_json_view.SwaggerJsonView):
def get(self, request):
@@ -39,10 +78,27 @@ class SwaggerJsonView(newton_json_view.SwaggerJsonView):
resp = super(SwaggerJsonView,self).get(request)
json_data = resp.data if resp else None
if json_data:
- json_data["basePath"] = "/api/multicloud-titanium_cloud/v0/"
- json_data["info"]["title"] = "Service NBI of MultiCloud plugin for Titanium Cloud"
+ json_data["basePath"] = "/api/multicloud-titaniumcloud/v0/"
+ json_data["info"]["title"] = "Service NBI v0 of MultiCloud plugin for Titanium Cloud"
return Response(data=json_data, status=200)
else:
return Response(data={'error':'internal error'}, status=500)
+class APIv1SwaggerJsonView(newton_json_view.SwaggerJsonView):
+
+ def get(self, request):
+ '''
+ reuse newton code and update the basePath
+ :param request:
+ :return:
+ '''
+
+ resp = super(APIv1SwaggerJsonView,self).get(request)
+ json_data = resp.data if resp else None
+ if json_data:
+ json_data["basePath"] = "/api/multicloud-titaniumcloud/v1/"
+ json_data["info"]["title"] = "Service NBI v1 of MultiCloud plugin for Titanium Cloud"
+ return Response(data=json_data, status=200)
+ else:
+ return Response(data={'error':'internal error'}, status=500)