Fix ocloudvirtualresource api typo
[pti/o2.git] / o2dms / views / dms_route.py
1 # Copyright (C) 2021 Wind River Systems, Inc.
2 #
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 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14
15 # from flask import jsonify
16 from flask_restx import Resource
17
18 from o2dms.views.dms_dto import DmsDTO
19 from o2dms.views import dms_lcm_view, api_dms_lcm_v1
20 from o2common.service.messagebus import MessageBus
21
22
23 # ----------  DeploymentManagers ---------- #
24 @api_dms_lcm_v1.route("/<deploymentManagerID>")
25 @api_dms_lcm_v1.param('deploymentManagerID', 'ID of the deployment manager')
26 @api_dms_lcm_v1.response(404, 'Deployment manager not found')
27 class DmsGetRouter(Resource):
28
29     model = DmsDTO.dms_get
30
31     @api_dms_lcm_v1.doc('Get deployment manager')
32     @api_dms_lcm_v1.marshal_with(model)
33     def get(self, deploymentManagerID):
34         bus = MessageBus.get_instance()
35         result = dms_lcm_view.deployment_manager_one(
36             deploymentManagerID, bus.uow)
37         if result is not None:
38             return result
39         api_dms_lcm_v1.abort(404, "Deployment manager {} doesn't exist".format(
40             deploymentManagerID))