forked from platypush/platypush
Fabio Manganiello
7bbae55e44
It's better for entity managers to be stored in their own public package, instead of cluttering too much the namespace of their parent package.
41 lines
988 B
Python
41 lines
988 B
Python
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()
|