air_sdk.endpoints.history#
Classes#
Represents a history entry in the Air API. |
|
API for querying history entries. |
Module Contents#
- class air_sdk.endpoints.history.History[source]#
Bases:
air_sdk.air_model.AirModelRepresents a history entry in the Air API.
History entries track actions and events for Air resources (simulations, nodes, etc.). They are immutable and read-only - history is created automatically by the Air API.
- object_id#
ID of the entity this history entry is about (e.g., a simulation ID)
- model#
Type of entity being tracked (e.g., ‘simulation’)
- created#
Timestamp when the history entry was created
- actor#
Email or identifier of the user who performed the action
- description#
Human-readable description of what happened
- category#
Category of the event. Values: ‘INFO’, ‘ERROR’
Note
History entries cannot be created, updated, or deleted via the SDK. They are automatically generated by the Air API.
- created: datetime.datetime#
- classmethod get_model_api() type[HistoryEndpointAPI][source]#
Returns the respective AirModelAPI type for this model
- refresh() None[source]#
Refresh the history entry.
- Raises:
NotImplementedError – History entries are immutable and cannot be refreshed
Note
History entries are read-only and created automatically by the Air API. They cannot be modified or refreshed.
- class air_sdk.endpoints.history.HistoryEndpointAPI(
- api: air_sdk.AirApi,
- default_filters: dict[str, Any] | None = None,
Bases:
air_sdk.endpoints.mixins.ListApiMixin[History],air_sdk.air_model.BaseEndpointAPI[History]API for querying history entries.
History entries are read-only records of actions and events for Air resources. Use this endpoint to track changes and audit activity.
Note
This endpoint only supports list() operations. History entries cannot be created, updated, or deleted via the API.
- list(
- *,
- model: str,
- object_id: str | None = ...,
- actor: str | None = ...,
- category: str | None = ...,
- search: str | None = ...,
- ordering: str | None = ...,
- limit: int | None = ...,
- offset: int | None = ...,
List history entries with optional filtering and pagination.
- Parameters:
model – Entity type to get history for (required). Values: ‘simulation’
object_id – Filter by the ID of the entity being tracked (e.g., a specific simulation’s ID)
actor – Filter by actor email or identifier
category – Filter by event category. Values: ‘INFO’, ‘ERROR’
search – Search for substrings in actor or description fields
ordering – Order by field (prefix with ‘-’ for descending). Available fields: actor, category, created, model, object_id
limit – Maximum number of results to return per page
offset – Number of results to skip (for pagination)
- Yields:
History instances
Example
>>> # List all simulation history >>> for entry in api.histories.list(model='simulation'): ... print(entry.description) >>> >>> # Get history for a specific simulation >>> for entry in api.histories.list( ... model='simulation', ... object_id='3dadd54d-583c-432e-9383-a2b0b1d7f551' ... ): ... print(f'{entry.created}: {entry.description}') >>> >>> # Filter by category >>> errors = list(api.histories.list(model='simulation', category='ERROR')) >>> print(f'Found {len(errors)} errors') >>> >>> # Filter by actor >>> user_actions = list(api.histories.list( ... model='simulation', ... actor='user@nvidia.com' ... )) >>> print(f'User performed {len(user_actions)} actions') >>> >>> # Search descriptions >>> for entry in api.histories.list(model='simulation', search='started'): ... print(entry.description) >>> >>> # Order by creation time (newest first) >>> for entry in api.histories.list( ... model='simulation', ... ordering='-created', ... limit=5 ... ): ... print(f'{entry.created}: {entry.description}') >>> >>> # Pagination >>> page_1 = list(api.histories.list(model='simulation', limit=10, offset=0)) >>> page_2 = list(api.histories.list(model='simulation', limit=10, offset=10))