X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2dms%2Fapi%2Fdms_lcm_view.py;h=3a634e441e69ee38777cc88401c68d57f4f106bd;hb=refs%2Fchanges%2F99%2F8199%2F1;hp=9995e8ee69ee08111d8fdfe04f6fcd60a3976e56;hpb=1c5999c04742b704a3b78fe9acecba09d41f0d11;p=pti%2Fo2.git diff --git a/o2dms/api/dms_lcm_view.py b/o2dms/api/dms_lcm_view.py index 9995e8e..3a634e4 100644 --- a/o2dms/api/dms_lcm_view.py +++ b/o2dms/api/dms_lcm_view.py @@ -1,34 +1,34 @@ -# Copyright (C) 2021 Wind River Systems, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from sqlalchemy import select -from o2common.service import unit_of_work -from o2ims.adapter.orm import deploymentmanager -from o2common.helper import o2logging -logger = o2logging.get_logger(__name__) - - -def deployment_managers(uow: unit_of_work.AbstractUnitOfWork): - with uow: - res = uow.session.execute(select(deploymentmanager)) - return [dict(r) for r in res] - - -def deployment_manager_one(deploymentManagerId: str, - uow: unit_of_work.AbstractUnitOfWork): - with uow: - res = uow.session.execute(select(deploymentmanager).where( - deploymentmanager.c.deploymentManagerId == deploymentManagerId)) - first = res.first() - return None if first is None else dict(first) +# Copyright (C) 2021 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from sqlalchemy import select +from o2common.service import unit_of_work +from o2ims.adapter.orm import deploymentmanager +from o2common.helper import o2logging +logger = o2logging.get_logger(__name__) + + +def deployment_managers(uow: unit_of_work.AbstractUnitOfWork): + with uow: + res = uow.session.execute(select(deploymentmanager)) + return [dict(r) for r in res] + + +def deployment_manager_one(deploymentManagerId: str, + uow: unit_of_work.AbstractUnitOfWork): + with uow: + res = uow.session.execute(select(deploymentmanager).where( + deploymentmanager.c.deploymentManagerId == deploymentManagerId)) + first = res.first() + return None if first is None else dict(first)