Jiri Sveceny d8ef36d84f
Support Template.aliasExists for JavaScript and Python SDKs (#1068)
Integration tests will fail until the feature is deployed in E2B Cloud
production.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Enables checking template alias availability from both SDKs.
> 
> - JS: Implements `checkAliasExists` in `template/buildApi.ts`, exposes
`Template.aliasExists` in `template/index.ts`, adds `AliasExistsOptions`
type and tests
> - Python: Adds `Template.alias_exists` and
`AsyncTemplate.alias_exists` wired to generated
`get_templates_aliases_{alias}` client; includes sync/async tests
> - API: Regenerates schemas/clients to include `GET
/templates/aliases/{alias}`, template build logs endpoint and
parameters, and supporting models (e.g., `TemplateAliasResponse`)
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4e577fd77888478ac83b66db7537cd2355ea050b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 10:05:48 +00:00

166 lines
4.6 KiB
Python
Generated

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
from ..models.node_status import NodeStatus
if TYPE_CHECKING:
from ..models.machine_info import MachineInfo
from ..models.node_metrics import NodeMetrics
T = TypeVar("T", bound="Node")
@_attrs_define
class Node:
"""
Attributes:
cluster_id (str): Identifier of the cluster
commit (str): Commit of the orchestrator
create_fails (int): Number of sandbox create fails
create_successes (int): Number of sandbox create successes
id (str): Identifier of the node
machine_info (MachineInfo):
metrics (NodeMetrics): Node metrics
node_id (str): Identifier of the nomad node
sandbox_count (int): Number of sandboxes running on the node
sandbox_starting_count (int): Number of starting Sandboxes
service_instance_id (str): Service instance identifier of the node
status (NodeStatus): Status of the node
version (str): Version of the orchestrator
"""
cluster_id: str
commit: str
create_fails: int
create_successes: int
id: str
machine_info: "MachineInfo"
metrics: "NodeMetrics"
node_id: str
sandbox_count: int
sandbox_starting_count: int
service_instance_id: str
status: NodeStatus
version: str
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
cluster_id = self.cluster_id
commit = self.commit
create_fails = self.create_fails
create_successes = self.create_successes
id = self.id
machine_info = self.machine_info.to_dict()
metrics = self.metrics.to_dict()
node_id = self.node_id
sandbox_count = self.sandbox_count
sandbox_starting_count = self.sandbox_starting_count
service_instance_id = self.service_instance_id
status = self.status.value
version = self.version
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"clusterID": cluster_id,
"commit": commit,
"createFails": create_fails,
"createSuccesses": create_successes,
"id": id,
"machineInfo": machine_info,
"metrics": metrics,
"nodeID": node_id,
"sandboxCount": sandbox_count,
"sandboxStartingCount": sandbox_starting_count,
"serviceInstanceID": service_instance_id,
"status": status,
"version": version,
}
)
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
from ..models.machine_info import MachineInfo
from ..models.node_metrics import NodeMetrics
d = dict(src_dict)
cluster_id = d.pop("clusterID")
commit = d.pop("commit")
create_fails = d.pop("createFails")
create_successes = d.pop("createSuccesses")
id = d.pop("id")
machine_info = MachineInfo.from_dict(d.pop("machineInfo"))
metrics = NodeMetrics.from_dict(d.pop("metrics"))
node_id = d.pop("nodeID")
sandbox_count = d.pop("sandboxCount")
sandbox_starting_count = d.pop("sandboxStartingCount")
service_instance_id = d.pop("serviceInstanceID")
status = NodeStatus(d.pop("status"))
version = d.pop("version")
node = cls(
cluster_id=cluster_id,
commit=commit,
create_fails=create_fails,
create_successes=create_successes,
id=id,
machine_info=machine_info,
metrics=metrics,
node_id=node_id,
sandbox_count=sandbox_count,
sandbox_starting_count=sandbox_starting_count,
service_instance_id=service_instance_id,
status=status,
version=version,
)
node.additional_properties = d
return node
@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