feat(backups): expose if the service can be backed up

pull/35/head
Inex Code 2023-06-29 13:45:00 +03:00
parent 21c5f6814c
commit 2c21bd2a14
3 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,7 @@ class Service:
is_movable: bool
is_required: bool
is_enabled: bool
can_be_backed_up: bool
status: ServiceStatusEnum
url: typing.Optional[str]
dns_records: typing.Optional[typing.List[DnsRecord]]
@ -124,6 +125,7 @@ def service_to_graphql_service(service: ServiceInterface) -> Service:
is_movable=service.is_movable(),
is_required=service.is_required(),
is_enabled=service.is_enabled(),
can_be_backed_up=service.can_be_backed_up(),
status=ServiceStatusEnum(service.get_status().value),
url=service.get_url(),
dns_records=[

View File

@ -44,6 +44,10 @@ class Ocserv(Service):
def is_required() -> bool:
return False
@staticmethod
def can_be_backed_up() -> bool:
return False
@staticmethod
def is_enabled() -> bool:
with ReadUserData() as user_data:

View File

@ -81,6 +81,10 @@ class Service(ABC):
def is_required() -> bool:
pass
@staticmethod
def can_be_backed_up() -> bool:
return True
@staticmethod
@abstractmethod
def is_enabled() -> bool: