1 # Copyright (c) 2017 Wind River Systems, Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 from rest_framework import status
18 from rest_framework.response import Response
19 from rest_framework.views import APIView
21 from multivimbroker.pub.exceptions import VimBrokerException
23 logger = logging.getLogger(__name__)
26 class SwaggerJsonView(APIView):
27 def get(self, request):
28 json_file = os.path.join(os.path.dirname(__file__), 'multivim.flavor.swagger.json')
30 json_data = json.JSONDecoder().decode(f.read())
32 json_file = os.path.join(os.path.dirname(__file__), 'multivim.image.swagger.json')
34 json_data_temp = json.JSONDecoder().decode(f.read())
36 json_data["paths"].update(json_data_temp["paths"])
37 json_data["definitions"].update(json_data_temp["definitions"])
38 json_file = os.path.join(os.path.dirname(__file__), 'multivim.network.swagger.json')
40 json_data_temp = json.JSONDecoder().decode(f.read())
42 json_data["paths"].update(json_data_temp["paths"])
43 json_data["definitions"].update(json_data_temp["definitions"])
44 json_file = os.path.join(os.path.dirname(__file__), 'multivim.subnet.swagger.json')
46 json_data_temp = json.JSONDecoder().decode(f.read())
48 json_data["paths"].update(json_data_temp["paths"])
49 json_data["definitions"].update(json_data_temp["definitions"])
50 json_file = os.path.join(os.path.dirname(__file__), 'multivim.server.swagger.json')
52 json_data_temp = json.JSONDecoder().decode(f.read())
54 json_data["paths"].update(json_data_temp["paths"])
55 json_data["definitions"].update(json_data_temp["definitions"])
56 json_file = os.path.join(os.path.dirname(__file__), 'multivim.volume.swagger.json')
58 json_data_temp = json.JSONDecoder().decode(f.read())
60 json_data["paths"].update(json_data_temp["paths"])
61 json_data["definitions"].update(json_data_temp["definitions"])
62 json_file = os.path.join(os.path.dirname(__file__), 'multivim.vport.swagger.json')
64 json_data_temp = json.JSONDecoder().decode(f.read())
66 json_data["paths"].update(json_data_temp["paths"])
67 json_data["definitions"].update(json_data_temp["definitions"])
68 json_file = os.path.join(os.path.dirname(__file__), 'multivim.tenant.swagger.json')
70 json_data_temp = json.JSONDecoder().decode(f.read())
72 json_data["paths"].update(json_data_temp["paths"])
73 json_data["definitions"].update(json_data_temp["definitions"])
74 json_file = os.path.join(os.path.dirname(__file__), 'multivim.host.swagger.json')
76 json_data_temp = json.JSONDecoder().decode(f.read())
78 json_data["paths"].update(json_data_temp["paths"])
79 json_data["definitions"].update(json_data_temp["definitions"])
80 json_file = os.path.join(os.path.dirname(__file__), 'multivim.limit.swagger.json')
82 json_data_temp = json.JSONDecoder().decode(f.read())
84 json_data["paths"].update(json_data_temp["paths"])
85 json_data["definitions"].update(json_data_temp["definitions"])
86 return Response(json_data)