diff --git a/adcm_aio_client/core/client.py b/adcm_aio_client/core/client.py index 437de02..832f951 100644 --- a/adcm_aio_client/core/client.py +++ b/adcm_aio_client/core/client.py @@ -13,7 +13,7 @@ from functools import cached_property from typing import Self -from adcm_aio_client.core.objects.cm import ClustersNode, HostsNode +from adcm_aio_client.core.objects.cm import ClustersNode, HostProvidersNode, HostsNode from adcm_aio_client.core.requesters import Requester from adcm_aio_client.core.types import AuthToken, Cert, Credentials, Verify @@ -30,6 +30,10 @@ def clusters(self: Self) -> ClustersNode: def hosts(self: Self) -> HostsNode: return HostsNode(path=(), requester=self._requester) + @cached_property + def hostproviders(self: Self) -> HostProvidersNode: + return HostProvidersNode(path=(), requester=self._requester) + async def build_client( url: str | list[str], diff --git a/adcm_aio_client/core/objects/cm.py b/adcm_aio_client/core/objects/cm.py index b9edc8e..86d5a28 100644 --- a/adcm_aio_client/core/objects/cm.py +++ b/adcm_aio_client/core/objects/cm.py @@ -123,9 +123,26 @@ class ComponentsNode(NonPaginatedChildAccessor[Service, Component, None]): class HostProvider(Deletable, WithActions, WithUpgrades, WithConfig, RootInteractiveObject): PATH_PREFIX = "hostproviders" + # data-based properties + @property + def name(self: Self) -> str: + return str(self._data["name"]) -class HostProvidersNode(PaginatedChildAccessor): ... + @property + def description(self: Self) -> str: + return str(self._data["description"]) + + @property + def display_name(self: Self) -> str: + return str(self._data["prototype"]["displayName"]) + + def get_own_path(self: Self) -> Endpoint: + return self.PATH_PREFIX, self.id + + +class HostProvidersNode(PaginatedAccessor[HostProvider, None]): + class_type = HostProvider class Host(Deletable, RootInteractiveObject): @@ -160,8 +177,6 @@ def get_own_path(self: Self) -> Endpoint: class HostsNode(PaginatedAccessor[Host, None]): class_type = Host - # TODO: define def __init__(self, hostprovider: Hostprovider, name: str, cluster: Cluster = None): ... - class HostsInClusterNode(PaginatedAccessor[Host, None]): class_type = Host