Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/py/mat3ra/api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .constants import ACCESS_TOKEN_ENV_VAR, _build_base_url
from .endpoints.bank_materials import BankMaterialEndpoints
from .endpoints.bank_workflows import BankWorkflowEndpoints
from .endpoints.clusters import ClustersEndpoint
from .endpoints.jobs import JobEndpoints
from .endpoints.materials import MaterialEndpoints
from .endpoints.metaproperties import MetaPropertiesEndpoints
Expand Down Expand Up @@ -59,6 +60,7 @@ def _init_endpoints(self, timeout_seconds: int) -> None:
self.metaproperties = MetaPropertiesEndpoints(*base_args, **base_kwargs)
self.bank_materials = BankMaterialEndpoints(*base_args, **base_kwargs)
self.bank_workflows = BankWorkflowEndpoints(*base_args, **base_kwargs)
self.clusters = ClustersEndpoint(*base_args, **base_kwargs)

@staticmethod
def _resolve_config(
Expand Down
35 changes: 35 additions & 0 deletions src/py/mat3ra/api_client/endpoints/clusters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from . import BaseEndpoint
from .enums import DEFAULT_API_VERSION, SECURE


class ClustersEndpoint(BaseEndpoint):
"""
Clusters endpoints for infrastructure access.

Args:
host (str): API hostname.
port (int): API port number.
account_id (str): account ID.
auth_token (str): authentication token.
version (str): API version.
secure (bool): whether to use secure http protocol (https vs http).
kwargs (dict): a dictionary of HTTP session options.
timeout (int): session timeout in seconds.

Attributes:
name (str): endpoint name.
headers (dict): default HTTP headers.
"""

def __init__(self, host, port, account_id, auth_token, version=DEFAULT_API_VERSION, secure=SECURE, **kwargs):
super(ClustersEndpoint, self).__init__(host, port, version, secure, **kwargs)
self.headers = self.get_headers(account_id, auth_token)

def list(self):
"""
Returns a list of available clusters with their queues.

Returns:
list[Dict]: Cluster information, including queues.
"""
return self.request("GET", "infrastructure/clusters", headers=self.headers)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be other/clusters

Loading