diff --git a/robosystems_client/api/graphs/get_graph_capacity.py b/robosystems_client/api/graphs/get_graph_capacity.py new file mode 100644 index 0000000..b853f32 --- /dev/null +++ b/robosystems_client/api/graphs/get_graph_capacity.py @@ -0,0 +1,215 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.graph_capacity_response import GraphCapacityResponse +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/graphs/capacity", + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | GraphCapacityResponse | None: + if response.status_code == 200: + response_200 = GraphCapacityResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 500: + response_500 = cast(Any, None) + return response_500 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | GraphCapacityResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Any | GraphCapacityResponse]: + """Get Graph Tier Capacity + + Check current infrastructure capacity for each graph database tier. + + Returns a status per tier indicating whether instances are immediately available, + can be provisioned on demand, or are at capacity. + + **Status Values:** + - `ready` — An instance slot is available; graph creation will succeed immediately + - `scalable` — No slots right now, but a new instance can be provisioned (3-5 min) + - `at_capacity` — Tier is full and cannot auto-scale; contact support + + **Use Cases:** + - Pre-flight check before entering the graph creation wizard + - Show availability badges on tier selection cards + - Gate tier selection and show contact form for at-capacity tiers + + **Caching:** + Results are cached for 60 seconds to avoid excessive infrastructure queries. + + **Note:** + No credit consumption required. Does not expose instance counts or IPs. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | GraphCapacityResponse] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Any | GraphCapacityResponse | None: + """Get Graph Tier Capacity + + Check current infrastructure capacity for each graph database tier. + + Returns a status per tier indicating whether instances are immediately available, + can be provisioned on demand, or are at capacity. + + **Status Values:** + - `ready` — An instance slot is available; graph creation will succeed immediately + - `scalable` — No slots right now, but a new instance can be provisioned (3-5 min) + - `at_capacity` — Tier is full and cannot auto-scale; contact support + + **Use Cases:** + - Pre-flight check before entering the graph creation wizard + - Show availability badges on tier selection cards + - Gate tier selection and show contact form for at-capacity tiers + + **Caching:** + Results are cached for 60 seconds to avoid excessive infrastructure queries. + + **Note:** + No credit consumption required. Does not expose instance counts or IPs. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | GraphCapacityResponse + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Any | GraphCapacityResponse]: + """Get Graph Tier Capacity + + Check current infrastructure capacity for each graph database tier. + + Returns a status per tier indicating whether instances are immediately available, + can be provisioned on demand, or are at capacity. + + **Status Values:** + - `ready` — An instance slot is available; graph creation will succeed immediately + - `scalable` — No slots right now, but a new instance can be provisioned (3-5 min) + - `at_capacity` — Tier is full and cannot auto-scale; contact support + + **Use Cases:** + - Pre-flight check before entering the graph creation wizard + - Show availability badges on tier selection cards + - Gate tier selection and show contact form for at-capacity tiers + + **Caching:** + Results are cached for 60 seconds to avoid excessive infrastructure queries. + + **Note:** + No credit consumption required. Does not expose instance counts or IPs. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | GraphCapacityResponse] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Any | GraphCapacityResponse | None: + """Get Graph Tier Capacity + + Check current infrastructure capacity for each graph database tier. + + Returns a status per tier indicating whether instances are immediately available, + can be provisioned on demand, or are at capacity. + + **Status Values:** + - `ready` — An instance slot is available; graph creation will succeed immediately + - `scalable` — No slots right now, but a new instance can be provisioned (3-5 min) + - `at_capacity` — Tier is full and cannot auto-scale; contact support + + **Use Cases:** + - Pre-flight check before entering the graph creation wizard + - Show availability badges on tier selection cards + - Gate tier selection and show contact form for at-capacity tiers + + **Caching:** + Results are cached for 60 seconds to avoid excessive infrastructure queries. + + **Note:** + No credit consumption required. Does not expose instance counts or IPs. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | GraphCapacityResponse + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/robosystems_client/models/__init__.py b/robosystems_client/models/__init__.py index 5df050d..85e6d52 100644 --- a/robosystems_client/models/__init__.py +++ b/robosystems_client/models/__init__.py @@ -112,6 +112,7 @@ from .get_storage_usage_response_getstorageusage import ( GetStorageUsageResponseGetstorageusage, ) +from .graph_capacity_response import GraphCapacityResponse from .graph_info import GraphInfo from .graph_limits_response import GraphLimitsResponse from .graph_metadata import GraphMetadata @@ -234,6 +235,7 @@ from .table_list_response import TableListResponse from .table_query_request import TableQueryRequest from .table_query_response import TableQueryResponse +from .tier_capacity import TierCapacity from .token_pricing import TokenPricing from .transaction_summary_response import TransactionSummaryResponse from .upcoming_invoice import UpcomingInvoice @@ -338,6 +340,7 @@ "GetFileInfoResponse", "GetOperationStatusResponseGetoperationstatus", "GetStorageUsageResponseGetstorageusage", + "GraphCapacityResponse", "GraphInfo", "GraphLimitsResponse", "GraphMetadata", @@ -448,6 +451,7 @@ "TableListResponse", "TableQueryRequest", "TableQueryResponse", + "TierCapacity", "TokenPricing", "TransactionSummaryResponse", "UpcomingInvoice", diff --git a/robosystems_client/models/graph_capacity_response.py b/robosystems_client/models/graph_capacity_response.py new file mode 100644 index 0000000..b639862 --- /dev/null +++ b/robosystems_client/models/graph_capacity_response.py @@ -0,0 +1,76 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.tier_capacity import TierCapacity + + +T = TypeVar("T", bound="GraphCapacityResponse") + + +@_attrs_define +class GraphCapacityResponse: + """Response containing capacity status for all customer-facing tiers. + + Attributes: + tiers (list[TierCapacity]): Capacity status per tier + """ + + tiers: list[TierCapacity] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + tiers = [] + for tiers_item_data in self.tiers: + tiers_item = tiers_item_data.to_dict() + tiers.append(tiers_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "tiers": tiers, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.tier_capacity import TierCapacity + + d = dict(src_dict) + tiers = [] + _tiers = d.pop("tiers") + for tiers_item_data in _tiers: + tiers_item = TierCapacity.from_dict(tiers_item_data) + + tiers.append(tiers_item) + + graph_capacity_response = cls( + tiers=tiers, + ) + + graph_capacity_response.additional_properties = d + return graph_capacity_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/graph_info.py b/robosystems_client/models/graph_info.py index 8259102..2754ec1 100644 --- a/robosystems_client/models/graph_info.py +++ b/robosystems_client/models/graph_info.py @@ -27,6 +27,7 @@ class GraphInfo: is_subgraph (bool | Unset): Whether this is a subgraph (vs a main graph) Default: False. parent_graph_id (None | str | Unset): Parent graph ID if this is a subgraph graph_type (str | Unset): Type of graph: generic, entity, or repository Default: 'entity'. + status (str | Unset): Graph lifecycle status: queued, provisioning, active, suspended Default: 'active'. """ graph_id: str @@ -40,6 +41,7 @@ class GraphInfo: is_subgraph: bool | Unset = False parent_graph_id: None | str | Unset = UNSET graph_type: str | Unset = "entity" + status: str | Unset = "active" additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -75,6 +77,8 @@ def to_dict(self) -> dict[str, Any]: graph_type = self.graph_type + status = self.status + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -98,6 +102,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["parentGraphId"] = parent_graph_id if graph_type is not UNSET: field_dict["graphType"] = graph_type + if status is not UNSET: + field_dict["status"] = status return field_dict @@ -140,6 +146,8 @@ def _parse_parent_graph_id(data: object) -> None | str | Unset: graph_type = d.pop("graphType", UNSET) + status = d.pop("status", UNSET) + graph_info = cls( graph_id=graph_id, graph_name=graph_name, @@ -152,6 +160,7 @@ def _parse_parent_graph_id(data: object) -> None | str | Unset: is_subgraph=is_subgraph, parent_graph_id=parent_graph_id, graph_type=graph_type, + status=status, ) graph_info.additional_properties = d diff --git a/robosystems_client/models/tier_capacity.py b/robosystems_client/models/tier_capacity.py new file mode 100644 index 0000000..11a5489 --- /dev/null +++ b/robosystems_client/models/tier_capacity.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="TierCapacity") + + +@_attrs_define +class TierCapacity: + """Capacity status for a single tier. + + Attributes: + tier (str): Tier identifier (e.g. ladybug-standard) + display_name (str): Human-readable tier name + status (str): Capacity status: ready, scalable, or at_capacity + message (str): Human-readable status message for frontend display + """ + + tier: str + display_name: str + status: str + message: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + tier = self.tier + + display_name = self.display_name + + status = self.status + + message = self.message + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "tier": tier, + "display_name": display_name, + "status": status, + "message": message, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + tier = d.pop("tier") + + display_name = d.pop("display_name") + + status = d.pop("status") + + message = d.pop("message") + + tier_capacity = cls( + tier=tier, + display_name=display_name, + status=status, + message=message, + ) + + tier_capacity.additional_properties = d + return tier_capacity + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties