diff --git a/platypush/entities/__init__.py b/platypush/entities/__init__.py index 5d29d40d..4f5d46f7 100644 --- a/platypush/entities/__init__.py +++ b/platypush/entities/__init__.py @@ -11,17 +11,17 @@ from ._base import ( init_entities_db, ) from ._engine import EntitiesEngine -from ._managers import ( +from .managers import ( EntityManager, get_plugin_entity_registry, register_entity_manager, ) -from ._managers.lights import LightEntityManager -from ._managers.sensors import SensorEntityManager -from ._managers.switches import ( - SwitchEntityManager, +from .managers.lights import LightEntityManager +from .managers.sensors import SensorEntityManager +from .managers.switches import ( DimmerEntityManager, EnumSwitchEntityManager, + SwitchEntityManager, ) _engine: Optional[EntitiesEngine] = None diff --git a/platypush/entities/_managers/__init__.py b/platypush/entities/managers/__init__.py similarity index 100% rename from platypush/entities/_managers/__init__.py rename to platypush/entities/managers/__init__.py diff --git a/platypush/entities/managers/cloud.py b/platypush/entities/managers/cloud.py new file mode 100644 index 00000000..4fa947b0 --- /dev/null +++ b/platypush/entities/managers/cloud.py @@ -0,0 +1,41 @@ +from abc import ABC, abstractmethod +from typing import Union +from uuid import UUID + +from . import EntityManager + +InstanceId = Union[str, int, UUID] + + +class CloudInstanceEntityManager(EntityManager, ABC): + """ + Base class for integrations that support cloud instances (like Linode or + AWS). + """ + + @abstractmethod + def reboot(self, instance: InstanceId, **_): + """ + Reboot an instance. + + :param instance: ID or name of the instance to be rebooted. + """ + raise NotImplementedError() + + @abstractmethod + def boot(self, instance: InstanceId, **_): + """ + Boot an instance. + + :param instance: ID or name of the instance to be rebooted. + """ + raise NotImplementedError() + + @abstractmethod + def shutdown(self, instance: InstanceId, **_): + """ + Shutdown an instance. + + :param instance: ID or name of the instance to be rebooted. + """ + raise NotImplementedError() diff --git a/platypush/entities/_managers/lights.py b/platypush/entities/managers/lights.py similarity index 100% rename from platypush/entities/_managers/lights.py rename to platypush/entities/managers/lights.py diff --git a/platypush/entities/_managers/sensors.py b/platypush/entities/managers/sensors.py similarity index 100% rename from platypush/entities/_managers/sensors.py rename to platypush/entities/managers/sensors.py diff --git a/platypush/entities/_managers/switches.py b/platypush/entities/managers/switches.py similarity index 100% rename from platypush/entities/_managers/switches.py rename to platypush/entities/managers/switches.py