mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-08-19 15:02:58 +00:00
81 lines
1.4 KiB
Python
81 lines
1.4 KiB
Python
|
"""Abstract class for a service running on a server"""
|
||
|
from abc import ABC, abstractmethod
|
||
|
from enum import Enum
|
||
|
|
||
|
|
||
|
class ServiceStatus(Enum):
|
||
|
"""Enum for service status"""
|
||
|
|
||
|
RUNNING = "RUNNING"
|
||
|
DEGRADED = "DEGRADED"
|
||
|
ERROR = "ERROR"
|
||
|
STOPPED = "STOPPED"
|
||
|
OFF = "OFF"
|
||
|
|
||
|
|
||
|
class Service(ABC):
|
||
|
"""
|
||
|
Service here is some software that is hosted on the server and
|
||
|
can be installed, configured and used by a user.
|
||
|
"""
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_id(self) -> str:
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_display_name(self) -> str:
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_description(self) -> str:
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_svg_icon(self) -> str:
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def is_enabled(self) -> bool:
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_status(self) -> ServiceStatus:
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def enable(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def disable(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def stop(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def start(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def restart(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_configuration(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def set_configuration(self, config_items):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_logs(self):
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def get_storage_usage(self):
|
||
|
pass
|