Skip to navigation

air_sdk.types

View as MarkdownOpen in Claude

Attributes

Classes

NameDescription
SimStateSimulation state constants.
InstructionExportChoiceWhich instructions to include when exporting a simulation.
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.
PluginManifestSecretA named secret a simulator may request.
NodeAssignmentDataV2v2 bulk assignment payload format.
NodeAssignmentDataV3v3 bulk assignment payload format.
NodeResetPayloadPayload for resetting a node.
NodeRebuildPayloadPayload for rebuilding a node.
NodeManagementInterfaceInfoPer-interface management address info returned by the Node API.
NodeBreakoutOptionInterfaceAn interface a port currently carries, as listed in its breakout options.
NodeBreakoutOptionHow one physical port of a node is split, and how else it may be.
InterfaceBreakoutEntryOne port to re-split in a bulk breakout.
ResourceBudgetUsageCurrent resource usage within an organization’s budget.
OSImageManifestPlatformPer-model platform information and OS template pins.
OSImageCapabilitiesOS image capability flags; key presence means supported.
_OSImageManifestSpecRequiredRequired fields for OSImageManifestSpec.
OSImageManifestSpecOS image manifest payload for api.images.upload() (no image).
HistoryEntryA single history entry from a resource’s nested history endpoint.
HistoryFiltersDistinct history filter values available for a single resource.
SimRequiredResourcesRequired resources for a simulation.
ZTPConfigsA simulation’s ZTP configuration, keyed by OS type.
ZTPConfigsUpdateA change to a simulation’s ZTP configuration, keyed by OS type.

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.
_evaluate_forward_ref(→ Any)Resolve a ForwardRef in a way that works across Python versions.
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.InstructionExportChoice

Bases: str, enum.Enum

Which instructions to include when exporting a simulation.

Passed as the include_instructions parameter to export. Use these instead of raw strings for type safety and IDE autocomplete. The name matches the air-api InstructionExportChoice constant.

Example:

>>> from air_sdk import InstructionExportChoice
>>> choice = InstructionExportChoice.REPEATABLE
>>> export_data = sim.export(include_instructions=choice)
NONE = NONE
REPEATABLE = REPEATABLE
REPEATABLE_OR_NOT_READY = REPEATABLE_OR_NOT_READY
DEMO_SIMULATION_STATE: TypeAlias
PAR_STATUS: TypeAlias
ACCESS_REQUEST_STATUS: TypeAlias
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
class air_sdk.types.PluginManifestSecret

Bases: typing.TypedDict

A named secret a simulator may request.

name: str
path: str
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.NodeManagementInterfaceInfo

Bases: typing.TypedDict

Per-interface management address info returned by the Node API.

ip may be None when the interface opts out of OOB-managed DHCP while remaining wired to the leaf switch.

ip: str | None
mac_address: str | None
class air_sdk.types.NodeBreakoutOptionInterface

Bases: typing.TypedDict

An interface a port currently carries, as listed in its breakout options.

id: str

The interface ID; pass it to a bulk breakout to change the port

name: str

The interface name

class air_sdk.types.NodeBreakoutOption

Bases: typing.TypedDict

How one physical port of a node is split, and how else it may be.

Breakout options are a mapping keyed by each port’s display name (e.g. ‘swp1’); this is the value. The key is a label, not an identifier.

split: str

The split factor the port is currently at (e.g. ‘1x’, ‘4x’)

split_options: list[str]

Every split factor the port supports, smallest first

The interfaces the port currently carries, in order

class air_sdk.types.InterfaceBreakoutEntry

Bases: typing.TypedDict

One port to re-split in a bulk breakout.

id: Interface | PrimaryKey

Any interface the port currently carries

split: str

The split factor to move the port to (e.g. ‘4x’); the un-split factor (e.g. ‘1x’) reverts it

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

class air_sdk.types.OSImageManifestPlatform

Bases: typing.TypedDict

Per-model platform information and OS template pins.

platform_information_version: str | None
os_template_version: str | None
class air_sdk.types.OSImageCapabilities

Bases: typing.TypedDict

OS image capability flags; key presence means supported.

vsock: dict[str, Any]
class air_sdk.types._OSImageManifestSpecRequired

Bases: typing.TypedDict

Required fields for OSImageManifestSpec.

os_type: str
class air_sdk.types.OSImageManifestSpec

Bases: air_sdk.types._OSImageManifestSpecRequired

OS image manifest payload for api.images.upload() (no image).

capabilities: OSImageCapabilities
os_template_partition: str | None
class air_sdk.types.HistoryEntry

Bases: typing.TypedDict

A single history entry from a resource’s nested history endpoint.

Read-only and immutable - returned by list_history() on simulations, images, and marketplace demos. This is distinct from the legacy History model returned by the deprecated flat histories endpoint.

object_id: str

ID of the entity this entry is about (e.g. a simulation ID)

model: str

Type of entity being tracked (e.g. ‘simulation’)

When the entry was recorded

actor: str

Email or identifier of the user who performed the action

description: str

Human-readable description of what happened

severity: str

Event severity. Values: ‘INFO’, ‘ERROR’

labels: list[str]

Backend-assigned labels (e.g. ‘publishing’), used for filtering

class air_sdk.types.HistoryFilters

Bases: typing.TypedDict

Distinct history filter values available for a single resource.

Returned by the nested history-filters endpoint on a resource (e.g. a simulation, image, or marketplace demo). The values span all of that resource’s history and are intended to populate filter dropdowns.

actors: list[str]

Distinct actor values present on the resource’s history entries

severities: list[str]

Distinct severity values (e.g. ‘INFO’, ‘ERROR’)

labels: list[str]

Distinct label values (e.g. ‘publishing’)

class air_sdk.types.SimRequiredResources

Bases: typing.TypedDict

Required resources for a simulation.

cpu: int | float
memory: int | float
storage: int | float
compute_hours: float
class air_sdk.types.ZTPConfigs

Bases: typing.TypedDict

A simulation’s ZTP configuration, keyed by OS type.

Only the configured OS types are present.

cumulus: str

The Cumulus provisioning script.

nvos: dict[str, Any]

The NVOS ZTP configuration, a JSON object.

class air_sdk.types.ZTPConfigsUpdate

Bases: typing.TypedDict

A change to a simulation’s ZTP configuration, keyed by OS type.

OS types left out are kept, and an OS type set to None is removed.

cumulus: str | None

The new Cumulus provisioning script, or None to remove it.

nvos: dict[str, Any] | None

The new NVOS ZTP configuration, a JSON object, or None to remove it.

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.

_TYPING_EVALUATE_FORWARD_REF = getattr(...)
_FORWARD_REF_EVALUATE_HAS_TYPE_PARAMS
air_sdk.types._evaluate_forward_ref(ref: ForwardRef) -> Any

Resolve a ForwardRef in a way that works across Python versions.

Names resolve in the module the reference records (TypedDict fields do, and callers resolving another module’s annotation must set it), otherwise in this one.

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

Recursively check if the value matches the expected type.