api: each API defines its 'endpoint' name
Add a new abstract class property to `BaseAPI` called `endpoint`, meant to be implemented by deriving classes in order to identify the end point name for the API provider. Implement the new property in all existing API providers.
This commit is contained in:
parent
144019a40c
commit
bc81e68727
4 changed files with 16 additions and 0 deletions
|
|
@ -36,6 +36,12 @@ class BaseAPI(abc.ABC):
|
|||
self.event_loop = None
|
||||
self.thread = None
|
||||
|
||||
@property
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def endpoint(cls):
|
||||
"""The name of the API endpoint"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def _dispatch(self, server):
|
||||
"""Called for incoming messages on the socket"""
|
||||
|
|
@ -78,6 +84,9 @@ class BaseAPI(abc.ABC):
|
|||
|
||||
class API(BaseAPI):
|
||||
"""The main OSBuild API"""
|
||||
|
||||
endpoint = "osbuild"
|
||||
|
||||
def __init__(self, socket_address, args, monitor):
|
||||
super().__init__(socket_address)
|
||||
self.input = args
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue