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__),
29 'multivim.flavor.swagger.json')
31 json_data = json.JSONDecoder().decode(f.read())
33 json_file = os.path.join(os.path.dirname(__file__),
34 'multivim.image.swagger.json')
36 json_data_temp = json.JSONDecoder().decode(f.read())
38 json_data["paths"].update(json_data_temp["paths"])
39 json_data["definitions"].update(json_data_temp["definitions"])
40 json_file = os.path.join(os.path.dirname(__file__),
41 'multivim.network.swagger.json')
43 json_data_temp = json.JSONDecoder().decode(f.read())
45 json_data["paths"].update(json_data_temp["paths"])
46 json_data["definitions"].update(json_data_temp["definitions"])
47 json_file = os.path.join(os.path.dirname(__file__),
48 'multivim.subnet.swagger.json')
50 json_data_temp = json.JSONDecoder().decode(f.read())
52 json_data["paths"].update(json_data_temp["paths"])
53 json_data["definitions"].update(json_data_temp["definitions"])
54 json_file = os.path.join(os.path.dirname(__file__),
55 'multivim.server.swagger.json')
57 json_data_temp = json.JSONDecoder().decode(f.read())
59 json_data["paths"].update(json_data_temp["paths"])
60 json_data["definitions"].update(json_data_temp["definitions"])
61 json_file = os.path.join(os.path.dirname(__file__),
62 'multivim.volume.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__),
69 'multivim.vport.swagger.json')
71 json_data_temp = json.JSONDecoder().decode(f.read())
73 json_data["paths"].update(json_data_temp["paths"])
74 json_data["definitions"].update(json_data_temp["definitions"])
75 json_file = os.path.join(os.path.dirname(__file__),
76 'multivim.tenant.swagger.json')
78 json_data_temp = json.JSONDecoder().decode(f.read())
80 json_data["paths"].update(json_data_temp["paths"])
81 json_data["definitions"].update(json_data_temp["definitions"])
82 json_file = os.path.join(os.path.dirname(__file__),
83 'multivim.host.swagger.json')
85 json_data_temp = json.JSONDecoder().decode(f.read())
87 json_data["paths"].update(json_data_temp["paths"])
88 json_data["definitions"].update(json_data_temp["definitions"])
89 json_file = os.path.join(os.path.dirname(__file__),
90 'multivim.limit.swagger.json')
92 json_data_temp = json.JSONDecoder().decode(f.read())
94 json_data["paths"].update(json_data_temp["paths"])
95 json_data["definitions"].update(json_data_temp["definitions"])
97 json_file = os.path.join(os.path.dirname(__file__),
98 'multivim.identity.swagger.json')
100 json_data_temp = json.JSONDecoder().decode(f.read())
102 json_data["paths"].update(json_data_temp["paths"])
103 json_data["definitions"].update(json_data_temp["definitions"])
104 return Response(json_data)