api/writability: add docstring

This commit is contained in:
Johannes Kirschbauer
2025-07-27 12:47:34 +02:00
parent abeb517a22
commit 98a0b9600b

View File

@@ -105,6 +105,18 @@ class Writeability(TypedDict):
@API.register @API.register
def get_machine_writeability(machine: Machine) -> dict[str, Writeability]: def get_machine_writeability(machine: Machine) -> dict[str, Writeability]:
"""
Get writeability information for the fields of a machine.
This function checks which fields of the 'machine' resource are writable and provides a reason for each field's writability.
Args:
machine (Machine): The machine object for which to retrieve writeability.
Returns:
dict[str, Writeability]: A map from field-names to { 'writable' (bool) and 'reason' (str or None ) }
"""
inventory_store = InventoryStore(machine.flake) inventory_store = InventoryStore(machine.flake)
write_info = inventory_store.get_writeability_of(f"machines.{machine.name}") write_info = inventory_store.get_writeability_of(f"machines.{machine.name}")