96ff988f2862b935ab1d2d2f35b5cfc2b0282cc1
[pti/o2.git] / o2common / service / client / base_client.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 import abc
16 # from typing import Optional, List, Set
17 # from typing import List
18
19
20 class BaseClient(abc.ABC):
21     def __init__(self):
22         pass
23
24     def list(self, **filters):
25         return self._list(**filters)
26
27     def get(self, id):
28         return self._get(id)
29
30     @abc.abstractmethod
31     def _get(self, id):
32         raise NotImplementedError
33
34     @abc.abstractmethod
35     def _list(self, **filters):
36         raise NotImplementedError