X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=o2ims%2Fservice%2Fclient%2Fbase_client.py;fp=o2ims%2Fservice%2Fclient%2Fbase_client.py;h=6057ab3a7e6060a08b1fb01f2019389e164c78d4;hb=81e3575a77366f30c2049f98c48a3087db0ea992;hp=0000000000000000000000000000000000000000;hpb=8339c9a882a586578b37f44a504e21c5208611c0;p=pti%2Fo2.git diff --git a/o2ims/service/client/base_client.py b/o2ims/service/client/base_client.py new file mode 100644 index 0000000..6057ab3 --- /dev/null +++ b/o2ims/service/client/base_client.py @@ -0,0 +1,37 @@ +# 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. + +import abc +# from typing import Optional, List, Set +from typing import List +from o2ims.domain import stx_object as ocloudModel + + +class BaseClient(abc.ABC): + def __init__(self): + pass + + def list(self) -> List[ocloudModel.StxGenericModel]: + return self._list() + + def get(self, id) -> ocloudModel.StxGenericModel: + return self._get(id) + + @abc.abstractmethod + def _get(self, id) -> ocloudModel.StxGenericModel: + raise NotImplementedError + + @abc.abstractmethod + def _list(self): + raise NotImplementedError