Fleet Module (FM)¶
Python API reference for the tlm_cli.fleet package.
Use this package to interact with the Fleet Manager programmatically. FMClient gives you typed access to claimed devices
and their live status — the same interfaces that power the tlm-cli fm commands.
FMClient¶
tlm_cli.fleet.client.FMClient
¶
Client interface for accessing Fleet Manager API interfaces.
This class exposes a property-based interface for accessing various Fleet Manager API model interfaces. Each property returns an interface responsible for interacting with a specific Fleet Manager model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_api
|
JsonApiProtocol | None
|
Optional resources API provider. When omitted, the models keep their
lazily built |
None
|
Examples:
>>> client = FMClient()
>>> device_interface = client.claimed_device
>>> device = device_interface.get("serial_number", "SN-001")
Source code in tlm_cli/fleet/client.py
claimed_device
property
¶
claimed_device_status
property
¶
name_claimed_device(resource_id, name, *, attempts=5, delay=3.0, on_retry=None)
¶
Name a freshly claimed device, retrying while the Fleet Manager has not indexed it yet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_id
|
str
|
Resource ID returned by the claim. |
required |
name
|
str
|
Display name to assign. |
required |
attempts
|
int
|
Maximum number of tries. |
5
|
delay
|
float
|
Seconds to wait between tries. |
3.0
|
on_retry
|
Callable[[int, int], None] | None
|
Called as |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True once the name is saved; False when every attempt failed. |
Source code in tlm_cli/fleet/client.py
FMInterfaceFactory¶
tlm_cli.fleet.client.FMInterfaceFactory
¶
Bases: BaseInterfaceFactory
Factory class for retrieving Fleet Manager API interface instances.
This class provides access to interface classes responsible for interacting with various Fleet Manager API models. It also supports data population for those models through their corresponding interfaces.
Attributes:
| Name | Type | Description |
|---|---|---|
_model_map |
dict
|
A mapping of model names to their interface classes. |
Examples: