air_sdk.types

View as Markdown

Attributes

Classes

NameDescription
SimStateSimulation state constants.
DockerRunTmpfsParameterDocker tmpfs mount configuration.
DockerRunParametersDocker run parameters for simulator containers.
ResourcesResource overhead for a simulator/platform.
PlatformEmulated platform configuration.
EmulationParamsEmulation parameters for a simulator/platform.
NodeAssignmentDataV2v2 bulk assignment payload format.
NodeAssignmentDataV3v3 bulk assignment payload format.
NodeResetPayloadPayload for resetting a node.
NodeRebuildPayloadPayload for rebuilding a node.
ResourceBudgetUsageCurrent resource usage within an organization’s budget.

Functions

NameDescription
is_typeddict(→ bool)None
union_args_are_optional(→ bool)None
is_union(→ bool)None
is_optional_union(→ bool)None
get_optional_arg(→ Type[T])None
get_list_arg(→ Type[T])None
is_typed_dict(→ bool)Determine if the expected_type provided is a subclass of TypedDict.
type_check_typed_dict(→ bool)Perform type checking when the expected_type is a subclass of TypedDict.
type_check(→ bool)Recursively check if the value matches the expected type.

Module Contents

T = TypeVar(...)
class air_sdk.types.SimState

Bases: str, enum.Enum

Simulation state constants.

Use these instead of raw strings for type safety and IDE autocomplete.

Example:

>>> from air_sdk import SimState
>>> while sim.state != SimState.ACTIVE:
... sleep(5)
... sim.refresh()
CLONING = CLONING
CREATING = CREATING
IMPORTING = IMPORTING
INVALID = INVALID
INACTIVE = INACTIVE
REQUESTING = REQUESTING
PROVISIONING = PROVISIONING
PREPARE_BOOT = PREPARE_BOOT
BOOTING = BOOTING
ACTIVE = ACTIVE
PREPARE_SHUTDOWN = PREPARE_SHUTDOWN
SHUTTING_DOWN = SHUTTING_DOWN
SAVING = SAVING
PREPARE_TEARDOWN = PREPARE_TEARDOWN
TEARING_DOWN = TEARING_DOWN
DELETING = DELETING
PREPARE_PURGE = PREPARE_PURGE
PURGING = PURGING
DEMO = DEMO
TRAINING = TRAINING
PREPARE_REBUILD = PREPARE_REBUILD
REBUILDING = REBUILDING
class air_sdk.types.DockerRunTmpfsParameter

Bases: typing.TypedDict

Docker tmpfs mount configuration.

path: str
size_gb: int
class air_sdk.types.DockerRunParameters

Bases: typing.TypedDict

Docker run parameters for simulator containers.

cap_add: list[str]
devices: list[str]
volumes: list[str]
environment: dict[str, str]
class air_sdk.types.Resources

Bases: typing.TypedDict

Resource overhead for a simulator/platform.

cpu: int
memory: int
class air_sdk.types.Platform

Bases: typing.TypedDict

Emulated platform configuration.

cpu: int
memory: int
default_port_type: str
default_port_count: int
port_count_options: list[int]
class air_sdk.types.EmulationParams

Bases: typing.TypedDict

Emulation parameters for a simulator/platform.

direct_link_emulation: bool
max_network_pci: int
UserConfigType
class air_sdk.types.NodeAssignmentDataV2

Bases: typing.TypedDict

v2 bulk assignment payload format.

simulation_node: Union[Node, PrimaryKey]
user_data: UserConfigType
meta_data: UserConfigType
class air_sdk.types.NodeAssignmentDataV3

Bases: typing.TypedDict

v3 bulk assignment payload format.

node: Node | PrimaryKey
user_data: UserConfig | PrimaryKey | None
meta_data: UserConfig | PrimaryKey | None
class air_sdk.types.NodeResetPayload

Bases: typing.TypedDict

Payload for resetting a node.

id: Node | PrimaryKey
class air_sdk.types.NodeRebuildPayload

Bases: typing.TypedDict

Payload for rebuilding a node.

id: Node | PrimaryKey
class air_sdk.types.ResourceBudgetUsage

Bases: typing.TypedDict

Current resource usage within an organization’s budget.

cpu: float

Number of CPU cores currently in use

memory: float

Memory currently in use, in MiB

disk_storage: float

Disk storage currently in use, in GB

image_storage: int

Image storage currently in use, in GB

userconfigs: int

User configs content currently in use, in bytes

air_sdk.types.is_typeddict(type_: Type[Any]) -> bool
air_sdk.types.union_args_are_optional(args: Tuple[Union[Any, Any], ...]) -> bool
air_sdk.types.is_union(type_: Type[Any]) -> bool
air_sdk.types.is_optional_union(type_: Type[Any]) -> bool
air_sdk.types.get_optional_arg(optional_type: Type[T | None]) -> Type[T]
air_sdk.types.get_list_arg(list_type: Type[List[T]]) -> Type[T]
air_sdk.types.is_typed_dict(expected_type: Type[Any]) -> bool

Determine if the expected_type provided is a subclass of TypedDict.

air_sdk.types.type_check_typed_dict(
value: Any,
expected_type: Type[Any]
) -> bool

Perform type checking when the expected_type is a subclass of TypedDict.

This currently does not work if the expected_type is also a dataclass.

air_sdk.types.type_check(
value: Any,
expected_type: Type[Any]
) -> bool

Recursively check if the value matches the expected type.