air_sdk#
Submodules#
Attributes#
Exceptions#
Common base class for all non-exit exceptions. |
Classes#
A session client for managing the execution of API requests. |
|
Docker run parameters for simulator containers. |
|
Docker tmpfs mount configuration. |
|
Emulation parameters for a simulator/platform. |
|
Emulated platform configuration. |
|
Current resource usage within an organization's budget. |
|
Resource overhead for a simulator/platform. |
|
Simulation state constants. |
|
API client for marketplace demo endpoints. |
|
API client for marketplace demo tag endpoints. |
|
Represents an organization and its resource budget in the Air platform. |
|
API client for Organization / ResourceBudget endpoints. |
|
SSH Key model representing a user's SSH public key. |
|
API client for SSH key endpoints. |
|
Training model representing a training event with NGC group and cloned simulation. |
|
Endpoint API for managing training events. |
Package Contents#
- class air_sdk.Client(api_url: str)[source]#
Bases:
requests.SessionA session client for managing the execution of API requests.
- api_url#
- connect_timeout#
- read_timeout#
- pagination_page_size = 200#
- static get_telemetry_headers() dict[str, str][source]#
Return telemetry-specific headers for all requests.
- get_http_adapter() requests.adapters.HTTPAdapter[source]#
Return an HTTP adapter for all requests.
- get_retry_strategy() urllib3.util.Retry[source]#
Return a retry strategy for all requests. The following retry strategy will attempt to retry the request only if the connection fails.
- ngc_sak_login() None[source]#
Log in with Scoped API Key (SAK)
No args. Client must have directory ~/.ngc/config
- ngc_device_login(email: str, ngc_org_name: str) None[source]#
Log in with device login - does not require a NGC API Key/SAK.
- request(*args: Any, **kwargs: Any) requests.Response[source]#
Override request method to pass the timeout
- exception air_sdk.AirModelAttributeError(
- message: str = 'An error occurred while accessing an AirModel attribute.',
- status_code: int | None = None,
Bases:
AirErrorCommon base class for all non-exit exceptions.
- message = 'An error occurred while accessing an AirModel attribute.'#
- class air_sdk.DockerRunParameters[source]#
Bases:
TypedDictDocker run parameters for simulator containers.
- tmpfs: list[DockerRunTmpfsParameter]#
- class air_sdk.EmulationParams[source]#
Bases:
TypedDictEmulation parameters for a simulator/platform.
- class air_sdk.ResourceBudgetUsage[source]#
Bases:
TypedDictCurrent resource usage within an organization’s budget.
- cpu#
Number of CPU cores currently in use
- memory#
Memory currently in use, in MiB
- disk_storage#
Disk storage currently in use, in GB
- image_storage#
Image storage currently in use, in GB
- userconfigs#
User configs content currently in use, in bytes
- class air_sdk.SimState[source]#
-
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.AirApi(
- api_url: str = const.AIR_API_URL,
- authenticate: bool = True,
- api_key: str | None = None,
- username: str | None = None,
- password: str | None = None,
- bearer_token: str | None = None,
- auto_patch: bool = True,
- client#
- auto_patch = True#
- classmethod with_api_key( ) AirApi[source]#
Initialize API with an explicit NGC API Key.
The api_key is also known as a Starfleet API Key, or ‘SAK’.
- auth_with_ngc_config() None[source]#
Authenticate with a local NGC config.
This method is called by the AirApi constructor if authenticate is True.
- property histories: endpoints.HistoryEndpointAPI#
- property images: endpoints.ImageEndpointAPI#
- property simulations: endpoints.SimulationEndpointAPI#
- property systems: endpoints.SystemEndpointAPI#
- property nodes: endpoints.NodeEndpointAPI#
- property interfaces: endpoints.InterfaceEndpointAPI#
- property breakouts: None#
- Abstractmethod:
Breakouts endpoint - not supported in current API version.
- Raises:
- property services: endpoints.ServiceEndpointAPI#
- property simulation_interfaces: endpoints.InterfaceEndpointAPI#
- property node_instructions: endpoints.NodeInstructionEndpointAPI#
- property simulation_nodes: endpoints.NodeEndpointAPI#
- property ztp_scripts: endpoints.ZTPScriptEndpointAPI#
- property workers: endpoints.WorkerEndpointAPI#
- property worker_client_certificates: endpoints.WorkerClientCertificateEndpointAPI#
- property fleets: endpoints.FleetEndpointAPI#
- property marketplace_demos: endpoints.MarketplaceDemoEndpointAPI#
- property marketplace_demo_tags: endpoints.MarketplaceDemoTagEndpointAPI#
- property ssh_keys: endpoints.SSHKeyEndpointAPI#
- property trainings: endpoints.TrainingEndpointAPI#
- property manifests: endpoints.ManifestEndpointAPI#
- property cloud_inits: bc.CloudInitEndpointAPI#
Cloud-init endpoint for V2 backwards compatibility.
- property user_configs: endpoints.UserConfigEndpointAPI#
- property organizations: endpoints.OrganizationEndpointAPI#
Organization / Resource Budget endpoint.
- property resource_budgets: endpoints.OrganizationEndpointAPI#
Resource Budget endpoint (alias for organizations).
- property simulation: endpoints.SimulationEndpointAPI#
Deprecated alias for simulations (v1 backward compatibility).
- property service: endpoints.ServiceEndpointAPI#
Deprecated alias for services (v1 backward compatibility).
- set_connect_timeout(t_delta: datetime.timedelta) None[source]#
- set_read_timeout(t_delta: datetime.timedelta) None[source]#
- class air_sdk.MarketplaceDemoEndpointAPI(
- api: air_sdk.AirApi,
- default_filters: dict[str, Any] | None = None,
Bases:
air_sdk.air_model.BaseEndpointAPI[MarketplaceDemo]API client for marketplace demo endpoints.
- model: type[MarketplaceDemo]#
- create(
- *,
- name: str,
- simulation: str,
- description: str | None | dataclasses._MISSING_TYPE = ...,
- documentation: str | None | dataclasses._MISSING_TYPE = ...,
- repo: str | None | dataclasses._MISSING_TYPE = ...,
- tags: list[str] | dataclasses._MISSING_TYPE = ...,
- icon: str | None | dataclasses._MISSING_TYPE = ...,
- checkpoint: str | None | dataclasses._MISSING_TYPE = ...,
Create a new marketplace demo.
- Parameters:
name – Name for the new marketplace demo
simulation – Simulation to be used to provision the marketplace demo
description – Description of the marketplace demo
documentation – Documentation of the marketplace demo
repo – Repository of the marketplace demo
tags – Tags of the marketplace demo
icon – Icon of the marketplace demo
checkpoint – A COMPLETE checkpoint to clone from. Provided checkpoint must belong to the simulation. If not specified, latest COMPLETE checkpoint will be used.
- Returns:
The created MarketplaceDemo instance
Example
>>> marketplace_demo = api.marketplace_demos.create( ... name='My Marketplace Demo', ... simulation='sim-id', ... description='My Demo Description', ... documentation='My Demo Documentation', ... repo='My Demo Repo', ... tags=['networking', 'sonic'], ... )
- delete(pk: air_sdk.air_model.PrimaryKey) None#
Delete a marketplace demo.
- Parameters:
pk – The marketplace demo ID (string or UUID)
Example
>>> api.marketplace_demos.delete('marketplace-demo-id')
- list(
- *,
- creator: str | dataclasses._MISSING_TYPE = ...,
- published: bool | dataclasses._MISSING_TYPE = ...,
- tags: list[str] | dataclasses._MISSING_TYPE = ...,
- search: str | dataclasses._MISSING_TYPE = ...,
- ordering: str | dataclasses._MISSING_TYPE = ...,
- liked_by_client: bool | dataclasses._MISSING_TYPE = ...,
- limit: int | dataclasses._MISSING_TYPE = ...,
- offset: int | dataclasses._MISSING_TYPE = ...,
List all marketplace demos.
- Optional parameters:
creator: Filter by creator email published: Filter by published status tags: Filter by tags search: Search term to filter demos ordering: Order the response by the specified field liked_by_client: Filter by liked by client status limit: Number of results to return per page offset: The initial index from which to return the results
- Returns:
Iterator of MarketplaceDemo instances
Example
>>> # List all demos >>> for demo in api.marketplace_demos.list(): ... print(demo.name) >>> # List with filters >>> results = list( ... api.marketplace_demos.list( ... creator='test@example.com', ... published=True, ... tags=['networking'], ... ) ... )
- get(pk: air_sdk.air_model.PrimaryKey) MarketplaceDemo#
Get a specific marketplace demo by ID.
- Parameters:
pk – The marketplace demo ID (string or UUID)
- Returns:
The MarketplaceDemo instance
Example
>>> marketplace_demo = api.marketplace_demos.get('marketplace-demo-id') >>> print(marketplace_demo.name)
- publish(
- *,
- marketplace_demo: MarketplaceDemo | air_sdk.air_model.PrimaryKey,
- **kwargs: Any,
Publish a marketplace demo.
- Parameters:
marketplace_demo – The marketplace demo to publish (object or ID)
- Returns:
None
Example
>>> # Using demo object >>> api.marketplace_demos.publish(marketplace_demo=marketplace_demo) >>> # Or using ID >>> api.marketplace_demos.publish(marketplace_demo='marketplace-demo-id')
- unpublish(
- *,
- marketplace_demo: MarketplaceDemo | air_sdk.air_model.PrimaryKey,
- **kwargs: Any,
Unpublish a marketplace demo.
- Parameters:
marketplace_demo – The marketplace demo to unpublish (object or ID)
- Returns:
None
Example
>>> api.marketplace_demos.unpublish(marketplace_demo=marketplace_demo)
- provision(
- *,
- marketplace_demo: MarketplaceDemo | air_sdk.air_model.PrimaryKey,
- **kwargs: Any,
Provision a simulation from a marketplace demo.
Creates a new simulation by cloning the demo simulation.
- Parameters:
marketplace_demo – The marketplace demo to provision (object or ID)
- Returns:
The newly created simulation instance.
- Return type:
Example
>>> # Using demo object >>> marketplace_demo = api.marketplace_demos.get('marketplace-demo-id') >>> simulation = marketplace_demo.provision() >>> print(simulation.id) >>> # Or using API directly with ID >>> demo_id = 'marketplace-demo-id' >>> simulation = api.marketplace_demos.provision(marketplace_demo=demo_id) >>> print(simulation.name)
- class air_sdk.MarketplaceDemoTagEndpointAPI(
- api: air_sdk.AirApi,
- default_filters: dict[str, Any] | None = None,
Bases:
air_sdk.air_model.BaseEndpointAPI[MarketplaceDemoTag]API client for marketplace demo tag endpoints.
- model: type[MarketplaceDemoTag]#
- create(*, name: str) MarketplaceDemoTag#
Create a new marketplace demo tag.
- Parameters:
name – Name for the new tag
- Returns:
The created MarketplaceDemoTag instance
Example
>>> tag = api.marketplace_demo_tags.create(name='networking')
- list(
- *,
- limit: int | dataclasses._MISSING_TYPE = ...,
- offset: int | dataclasses._MISSING_TYPE = ...,
- search: str | dataclasses._MISSING_TYPE = ...,
- ordering: str | dataclasses._MISSING_TYPE = ...,
List all marketplace demo tags.
- Optional parameters:
limit: Number of results to return per page offset: The initial index from which to return the results search: Search term to filter tags ordering: Order the response by the specified field
- Returns:
Iterator of MarketplaceDemoTag instances
Example
>>> # List all tags >>> for tag in api.marketplace_demo_tags.list(): ... print(tag.name)
- get(pk: air_sdk.air_model.PrimaryKey) MarketplaceDemoTag#
Get a specific marketplace demo tag by ID.
- Parameters:
pk – The tag ID (string or UUID)
- Returns:
The MarketplaceDemoTag instance
Example
>>> tag = api.marketplace_demo_tags.get('tag-id') >>> print(tag.name)
- patch(
- pk: air_sdk.air_model.PrimaryKey,
- *,
- name: str | dataclasses._MISSING_TYPE = ...,
Update a marketplace demo tag.
- Parameters:
pk – The tag ID (string or UUID)
name – New name for the tag
- Returns:
The updated MarketplaceDemoTag instance
Example
>>> tag = api.marketplace_demo_tags.patch('tag-id', name='new-name')
- class air_sdk.Organization[source]#
Bases:
air_sdk.air_model.AirModelRepresents an organization and its resource budget in the Air platform.
This model combines organization metadata with resource budget information.
- id#
Unique identifier for the resource budget
- created#
Timestamp when the resource budget was created
- modified#
Timestamp when the resource budget was last modified
- org_display_name#
Display name of the organization
- org_nca_id#
NCA ID of the organization
- cpu#
Number of CPU cores allocated
- memory#
Memory allocated, in MiB
- disk_storage_total#
Total disk storage allocated, in GB
- disk_storage_per_node#
Disk storage per node, in GB
- image_storage#
Image storage allocated, in GB
- userconfigs#
Total UserConfig content allocated, in bytes
- usage#
Current resource usage
- created: datetime.datetime#
- modified: datetime.datetime#
- classmethod get_model_api() type[OrganizationEndpointAPI][source]#
Returns the respective AirModelAPI type for this model.
- property model_api: OrganizationEndpointAPI#
- class air_sdk.OrganizationEndpointAPI(
- api: air_sdk.AirApi,
- default_filters: dict[str, Any] | None = None,
Bases:
air_sdk.air_model.BaseEndpointAPI[Organization]API client for Organization / ResourceBudget endpoints.
This endpoint is read-only and provides access to organization resource budget information.
Also aliased as ResourceBudgetEndpointAPI.
- model: type[Organization]#
- list(
- *,
- limit: int = ...,
- offset: int = ...,
- ordering: str = ...,
- org_display_name: str = ...,
- org_nca_id: str = ...,
- search: str = ...,
List all organizations / resource budgets with optional filtering.
- Parameters:
limit – Maximum number of results to return per page
offset – The initial index from which to return the results
ordering – Order by field. Prefix with “-” for descending order
org_display_name – Filter by the display name of the organization
org_nca_id – Filter by the NCA ID of the organization
search – Search resource budgets by org_display_name
- Returns:
Iterator of Organization instances
Example
>>> # List all organizations >>> for org in api.organizations.list(): ... print(org.name, org.org_nca_id)
>>> # Filter by org_nca_id >>> for org in api.organizations.list(org_nca_id='nca-123'): ... print(org.name)
>>> # Search by name >>> for org in api.organizations.list(search='NVIDIA'): ... print(org.name)
- get(pk: air_sdk.air_model.PrimaryKey) Organization#
Get a specific organization / resource budget by ID.
- Parameters:
pk – The resource budget ID (string or UUID)
- Returns:
The Organization instance
Example
>>> org = api.organizations.get('b4d0480c-6f0b-4c40-b143-c141531fc14e') >>> print(org.name, org.cpu, org.memory)
- air_sdk.ResourceBudget#
- air_sdk.ResourceBudgetEndpointAPI#
- class air_sdk.SSHKey[source]#
Bases:
air_sdk.air_model.AirModelSSH Key model representing a user’s SSH public key.
The string representation shows: id, name
- id#
Unique identifier for the SSH key
- created#
Timestamp when the SSH key was created
- name#
Human-readable name for the SSH key
- fingerprint#
SSH key fingerprint (automatically generated)
- created: datetime.datetime#
- classmethod get_model_api() type[SSHKeyEndpointAPI][source]#
Returns the respective AirModelAPI type for this model.
- property model_api: SSHKeyEndpointAPI#
- class air_sdk.SSHKeyEndpointAPI(
- api: air_sdk.AirApi,
- default_filters: dict[str, Any] | None = None,
Bases:
air_sdk.air_model.BaseEndpointAPI[SSHKey]API client for SSH key endpoints.
- list( ) Iterator[SSHKey]#
List all SSH keys with optional filtering.
- Parameters:
limit – Maximum number of results to return per page
offset – The initial index from which to return the results
ordering – Order objects by field. Prefix with “-” for desc order
search – Search by name
- Returns:
Iterator of SSHKey instances
Example
>>> # List all SSH keys >>> for key in api.ssh_keys.list(): ... print(key.name, key.fingerprint)
>>> # Search by name >>> for key in api.ssh_keys.list(search='my-key'): ... print(key.name)
>>> # Order by name descending >>> for key in api.ssh_keys.list(ordering='-name'): ... print(key.name)
- create(*, name: str, public_key: str) SSHKey#
Create a new SSH key.
- Parameters:
name – Human-readable name for the SSH key
public_key – The SSH public key content (e.g., “ssh-rsa AAAA…”)
- Returns:
The created SSHKey instance
Example
>>> ssh_key = api.ssh_keys.create( name='my-laptop-key', public_key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB...' ) >>> print(ssh_key.fingerprint)
- class air_sdk.Training[source]#
Bases:
air_sdk.air_model.AirModelTraining model representing a training event with NGC group and cloned simulation.
- id#
Unique identifier for the training event
- name#
Name of the training event (also NGC user group name, must be kebab-case)
- created#
Timestamp when the training was created
- modified#
Timestamp when the training was last modified
- creator#
Email of the client that created the training
- org#
Organization UUID associated with this training
- training_simulation#
Foreign key to template simulation (lazy loaded)
- training_simulation_name#
Name of the training simulation (read-only)
- training_simulation_state#
State of the training simulation (read-only)
- event_time#
When the training event will occur (must be 5h+ in future)
- ngc_group_id#
NGC external user group ID (must be kebab-case)
- attendees#
List of validated attendee email addresses
- sim_start_time#
When workbenches are created/started (1h+ future, 4h before event_time)
- sim_end_time#
When workbenches expire/destroyed (24h+ after event_time)
- workbenches_created#
Whether workbenches have been created
- Timing Constraints:
event_time must be at least 5h in the future
sim_start_time must be at least 1h in the future and 4h before event_time
sim_end_time must be at least 24h after event_time
- Update Restrictions:
Only event_time, sim_start_time, and sim_end_time can be updated. Name, parent simulation, checkpoint, and attendees cannot be modified after creation.
Note
The training_simulation field is a lazy-loaded foreign key. Accessing it will automatically fetch the full Simulation object from the API.
- classmethod get_model_api() type[TrainingEndpointAPI][source]#
Returns the respective AirModelAPI type for this model.
- created: datetime.datetime#
- modified: datetime.datetime#
- training_simulation: air_sdk.endpoints.simulations.Simulation#
- event_time: datetime.datetime#
- sim_start_time: datetime.datetime#
- sim_end_time: datetime.datetime#
- update(
- *,
- event_time: datetime.datetime = ...,
- sim_start_time: datetime.datetime = ...,
- sim_end_time: datetime.datetime = ...,
- **kwargs: Any,
Update individual fields of the training event.
Only event_time, sim_start_time, and sim_end_time can be updated. Name, parent simulation, checkpoint, and attendees cannot be modified via this endpoint after creation.
- Timing Constraints:
event_time: Must be at least 5h in the future
sim_start_time: Must be 1h+ in future and 4h before event_time
sim_end_time: Must be at least 24h after event_time
- Parameters:
event_time – When the training event will occur
sim_start_time – When workbenches are created/started
sim_end_time – When workbenches expire/destroyed
**kwargs – Additional fields for future API compatibility
- Raises:
ValidationError – If timing constraints are violated
Example
>>> training.update( ... event_time=datetime(2026, 3, 15, 9, 0), ... sim_start_time=datetime(2026, 3, 15, 5, 0), ... sim_end_time=datetime(2026, 3, 16, 9, 0) ... )
- add_attendees(*, attendees: list[str], **kwargs: Any) None[source]#
Add attendees to the training event.
- Parameters:
attendees – List of email addresses to add as attendees
**kwargs – Additional parameters
Example
>>> training.add_attendees( ... attendees=['user1@example.com', 'user2@example.com'] ... )
- remove_attendees(*, attendees: list[str], **kwargs: Any) None[source]#
Remove attendees from the training event.
- Parameters:
attendees – List of email addresses to remove from attendees
**kwargs – Additional parameters
Example
>>> training.remove_attendees( ... attendees=['user1@example.com'] ... )
- get_external_user_group(**kwargs: Any) TrainingNGCData[source]#
Get NGC external user group information.
Makes an external API call to NGC to retrieve full details about the training’s user group, including confirmed users and pending invitations.
- Parameters:
**kwargs – Additional parameters
- Returns:
NGC user group data including members and invitation status
Example
>>> group_data = training.get_external_user_group() >>> print(f'Group: {group_data["name"]}') >>> print(f'Confirmed users: {group_data.get("confirmedUsers", [])}') >>> print(f'Pending invitations: {group_data.get("pendingInvitations", [])}')
- class air_sdk.TrainingEndpointAPI(
- api: air_sdk.AirApi,
- default_filters: dict[str, Any] | None = None,
Bases:
air_sdk.air_model.BaseEndpointAPI[Training]Endpoint API for managing training events.
Provides methods for listing, creating, retrieving, updating, and deleting training events, as well as managing attendees and retrieving NGC user group information.
- list(
- *,
- limit: int = ...,
- name: str = ...,
- ngc_group_id: str = ...,
- offset: int = ...,
- ordering: str = ...,
- search: str = ...,
- training_simulation: str | air_sdk.air_model.PrimaryKey = ...,
- workbenches_created: bool = ...,
- **params: Any,
List all training events.
- Parameters:
limit – Number of results to return per page
name – Filter by training name
ngc_group_id – Filter by NGC external user group ID
offset – Initial index from which to return results
ordering – Order by field (prefix with “-” for desc). Options: -created, -creator, -event_time, -modified, -name, -ngc_group_id, -sim_end_time, -sim_start_time, -training_simulation_name, -training_simulation_state, -workbenches_created, created, creator, event_time, modified, name, ngc_group_id, sim_end_time, sim_start_time, training_simulation_name, training_simulation_state, workbenches_created
search – Search by name, creator, training_simulation_name, training_simulation_state, event_time, sim_start_time, sim_end_time, created
training_simulation – Filter by template simulation ID
workbenches_created – Filter by workbenches creation status
**params – Additional filter parameters
- Returns:
Iterator of Training instances
Example
>>> for training in api.trainings.list(): ... print(training.name) >>> # Filter by name >>> trainings = api.trainings.list(name='network-training') >>> # Filter by simulation >>> trainings = api.trainings.list(training_simulation='sim-123')
- create(
- *,
- name: str,
- parent_simulation: str | air_sdk.air_model.PrimaryKey,
- attendees: list[str],
- event_time: datetime.datetime,
- sim_start_time: datetime.datetime,
- sim_end_time: datetime.datetime,
- parent_simulation_checkpoint: str | air_sdk.air_model.PrimaryKey = ...,
- **kwargs: Any,
Create a new training event with NGC group and cloned simulation.
The simulation will be cloned when creating the training. After cloning completes, the parent_simulation transitions to INACTIVE state and is no longer associated with the training. A dedicated training_simulation is created for the training session.
- Parameters:
name – Name of the training event (must be kebab-case, used as NGC user group name)
parent_simulation – Simulation to clone for the training (transitions to INACTIVE after cloning)
attendees – List of attendee email addresses (required, case-sensitive, no duplicates)
event_time – When the training event will occur (must be 5h+ in future, sim_end_time must be 24h+ after this)
sim_start_time – When workbenches are created/started (must be 1h+ in future and 4h before event_time)
sim_end_time – When workbenches expire/destroyed (must be 24h+ after event_time)
parent_simulation_checkpoint – Checkpoint from parent_simulation to clone onto training_simulation (optional)
**kwargs – Additional fields for future API compatibility
- Returns:
Created Training instance
Example
>>> training = api.trainings.create( ... name='network-training-101', ... parent_simulation='sim-id-123', ... attendees=['student1@example.com', 'student2@example.com'], ... event_time=datetime(2026, 3, 15, 9, 0), ... sim_start_time=datetime(2026, 3, 15, 5, 0), ... sim_end_time=datetime(2026, 3, 16, 9, 0) ... )
- get(pk: air_sdk.air_model.PrimaryKey, **params: Any) Training#
Retrieve a specific training event.
- Parameters:
pk – Training ID
**params – Additional query parameters
- Returns:
Training instance
Example
>>> training = api.trainings.get('training-id-123') >>> print(training.name)
- patch(
- pk: air_sdk.air_model.PrimaryKey,
- *,
- event_time: datetime.datetime = ...,
- sim_start_time: datetime.datetime = ...,
- sim_end_time: datetime.datetime = ...,
- **kwargs: Any,
Update individual fields of a training event.
Only event_time, sim_start_time, and sim_end_time can be updated.
- Parameters:
pk – Training ID
event_time – When the training event will occur
sim_start_time – When workbenches are created/started
sim_end_time – When workbenches expire/destroyed
**kwargs – Additional fields for future API compatibility
- Returns:
Updated Training instance
Example
>>> training = api.trainings.patch( ... 'training-id-123', ... event_time=datetime(2026, 3, 15, 9, 0), ... )
- delete(pk: air_sdk.air_model.PrimaryKey, **kwargs: Any) None#
Delete a training event and its associated NGC user group.
- Parameters:
pk – Training ID
**kwargs – Additional parameters
Example
>>> api.trainings.delete('training-id-123')
- update(
- *,
- training: Training | air_sdk.air_model.PrimaryKey,
- event_time: datetime.datetime = ...,
- sim_start_time: datetime.datetime = ...,
- sim_end_time: datetime.datetime = ...,
- **kwargs: Any,
Update individual fields of a training event.
Only event_time, sim_start_time, and sim_end_time can be updated. Name, parent simulation, checkpoint, and attendees cannot be modified after creation.
- Timing Constraints:
event_time: Must be at least 5h in the future
sim_start_time: Must be 1h+ in future and 4h before event_time
sim_end_time: Must be at least 24h after event_time
- Parameters:
training – Training instance or training ID
event_time – When the training event will occur
sim_start_time – When workbenches are created/started
sim_end_time – When workbenches expire/destroyed
**kwargs – Additional fields for future API compatibility
- Returns:
Updated Training instance
- Raises:
ValidationError – If timing constraints are violated
Example
>>> training = api.trainings.get('training-id-123') >>> api.trainings.update( ... training=training, ... event_time=datetime(2026, 3, 15, 9, 0), ... sim_start_time=datetime(2026, 3, 15, 5, 0) ... )
- add_attendees( ) None[source]#
Add attendees to an existing training event.
- Parameters:
training – Training instance or training ID
attendees – List of email addresses to add
**kwargs – Additional parameters
Example
>>> api.trainings.add_attendees( ... training='training-id-123', attendees=['newuser@example.com'] ... )
- remove_attendees( ) None[source]#
Remove attendees from an existing training event.
- Parameters:
training – Training instance or training ID
attendees – List of email addresses to remove
**kwargs – Additional parameters
Example
>>> api.trainings.remove_attendees( # fmt: skip ... training='training-id-123', attendees=['user@example.com'] ... )
- get_external_user_group(
- *,
- training: Training | air_sdk.air_model.PrimaryKey,
- **kwargs: Any,
Get NGC external user group data for a training.
Makes an external API call to NGC to retrieve full details about the training’s user group, including confirmed users and pending invitations.
Requires AIR_INSTRUCTOR, AIR_ORG_ADMIN, or USER_ADMIN roles.
- Parameters:
training – Training instance or ID
**kwargs – Additional parameters
- Returns:
NGC user group data including members and invitation status
Example
>>> group_data = api.trainings.get_external_user_group( ... training='training-id-123' ... ) >>> print(f"Group name: {group_data['name']}") >>> print(f"Organization: {group_data['orgName']}") >>> confirmed = group_data.get('confirmedUsers', []) >>> pending = group_data.get('pendingInvitations', []) >>> print(f"Total users: {len(confirmed)} confirmed, {len(pending)} pending")
- air_sdk.SimulationApi#
- air_sdk.SimulationEndpointApi#
- air_sdk.ImageApi#
- air_sdk.ImageEndpointApi#
- air_sdk.ServiceAPI#
- air_sdk.ServiceEndpointApi#
- air_sdk.MarketplaceDemoApi#
- air_sdk.MarketplaceDemoEndpointApi#
- air_sdk.MarketplaceDemoTagApi#
- air_sdk.InterfaceApi#
- air_sdk.InterfaceEndpointApi#
- air_sdk.SimulationInterfaceApi#
- air_sdk.SimulationNodeApi#
- air_sdk.NodeEndpointApi#
- air_sdk.NodeApi#
- air_sdk.UserConfigAPI#
- air_sdk.UserConfigEndpointApi#
- air_sdk.OrganizationApi#