Skip to content

Commit

Permalink
ADCM-6122: Implement ADCM object (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: astarovo <a.starovoitov@arenadata.io>
  • Loading branch information
Starovoitov and Starovoitov authored Nov 22, 2024
1 parent 8daeb7f commit dc41bd9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion adcm_aio_client/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from functools import cached_property
from typing import Self

from adcm_aio_client.core.objects.cm import ClustersNode, HostProvidersNode, HostsNode
from adcm_aio_client.core.objects.cm import ADCM, ClustersNode, HostProvidersNode, HostsNode
from adcm_aio_client.core.requesters import Requester
from adcm_aio_client.core.types import AuthToken, Cert, Credentials, Verify

Expand All @@ -34,6 +34,10 @@ def hosts(self: Self) -> HostsNode:
def hostproviders(self: Self) -> HostProvidersNode:
return HostProvidersNode(path=(), requester=self._requester)

@cached_property
def adcm(self: Self) -> ADCM:
return ADCM(requester=self._requester, data={})


async def build_client(
url: str | list[str],
Expand Down
15 changes: 15 additions & 0 deletions adcm_aio_client/core/objects/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@
from adcm_aio_client.core.types import ADCMEntityStatus, Endpoint


class ADCM(InteractiveObject, WithActions, WithConfig):
@property
def id(self: Self) -> int:
return 1

@cached_property
async def version(self: Self) -> str:
# TODO: override root_path for being without /api/v2
response = await self._requester.get("versions")
return response.as_dict()["adcm"]["version"]

def get_own_path(self: Self) -> Endpoint:
return ("adcm",)


class Bundle(Deletable, InteractiveObject): ...


Expand Down

0 comments on commit dc41bd9

Please sign in to comment.