Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
215 changes: 215 additions & 0 deletions robosystems_client/api/graphs/get_graph_capacity.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions robosystems_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -338,6 +340,7 @@
"GetFileInfoResponse",
"GetOperationStatusResponseGetoperationstatus",
"GetStorageUsageResponseGetstorageusage",
"GraphCapacityResponse",
"GraphInfo",
"GraphLimitsResponse",
"GraphMetadata",
Expand Down Expand Up @@ -448,6 +451,7 @@
"TableListResponse",
"TableQueryRequest",
"TableQueryResponse",
"TierCapacity",
"TokenPricing",
"TransactionSummaryResponse",
"UpcomingInvoice",
Expand Down
76 changes: 76 additions & 0 deletions robosystems_client/models/graph_capacity_response.py
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions robosystems_client/models/graph_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]:
Expand Down Expand Up @@ -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(
Expand All @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
Loading