1 # Copyright (C) 2021 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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 # from flask import jsonify
16 from flask_restx import Resource
18 from o2dms.api.dms_dto import DmsDTO
19 from o2dms.api import dms_lcm_view
20 from o2dms.api.dms_api_ns import api_dms_lcm_v1
22 from o2common.service.messagebus import MessageBus
23 from o2common.helper import o2logging
24 logger = o2logging.get_logger(__name__)
27 def configure_api_route():
31 # ---------- DeploymentManagers ---------- #
32 @api_dms_lcm_v1.route("/<deploymentManagerID>")
33 @api_dms_lcm_v1.param('deploymentManagerID', 'ID of the deployment manager')
34 @api_dms_lcm_v1.response(404, 'Deployment manager not found')
35 class DmsGetRouter(Resource):
37 model = DmsDTO.dms_get
39 @api_dms_lcm_v1.doc('Get deployment manager')
40 @api_dms_lcm_v1.marshal_with(model)
41 def get(self, deploymentManagerID):
42 logger.debug("get o2dms info:{}".format(
45 bus = MessageBus.get_instance()
46 result = dms_lcm_view.deployment_manager_one(
47 deploymentManagerID, bus.uow)
48 if result is not None:
50 api_dms_lcm_v1.abort(404, "Deployment manager {} doesn't exist".format(