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 typing import List
16 from o2dms.domain import dms, dms_repo
19 class NfDeploymentDescSqlAlchemyRepository(dms_repo
20 .NfDeploymentDescRepository):
22 def __init__(self, session):
24 self.session = session
26 def _add(self, nfdeployment_desc: dms.NfDeploymentDesc):
27 self.session.add(nfdeployment_desc)
29 def _get(self, nfdeployment_desc_id) -> dms.NfDeploymentDesc:
30 return self.session.query(dms.NfDeploymentDesc).filter_by(
31 nfDeploymentDescId=nfdeployment_desc_id).first()
33 def _list(self) -> List[dms.NfDeploymentDesc]:
34 return self.session.query()
36 def _update(self, nfdeployment_desc: dms.NfDeploymentDesc):
37 self.session.add(nfdeployment_desc)