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

This commit is contained in:
Inex Code 2023-06-29 13:45:00 +03:00
parent b480c84041
commit 15ce344bc8
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: