from uncloud.common.settings import get_settings
from uncloud.common.vm import VmPool
from uncloud.common.host import HostPool
from uncloud.common.request import RequestPool
import uncloud.common.storage_handlers as storage_handlers


class Shared:
    @property
    def settings(self):
        return get_settings()

    @property
    def etcd_client(self):
        return self.settings.get_etcd_client()

    @property
    def host_pool(self):
        return HostPool(self.etcd_client, self.settings["etcd"]["host_prefix"])

    @property
    def vm_pool(self):
        return VmPool(self.etcd_client, self.settings["etcd"]["vm_prefix"])

    @property
    def request_pool(self):
        return RequestPool(self.etcd_client, self.settings["etcd"]["request_prefix"])

    @property
    def storage_handler(self):
        return storage_handlers.get_storage_handler()


shared = Shared()