knot.template
The knot.template library provides template management functions. Templates define the configuration for creating spaces.
Functions
| Function | Description |
|---|---|
list() |
List all templates |
get(template_id) |
Get template by ID or name |
create(name, ...) |
Create a new template |
update(template_id, ...) |
Update template properties |
delete(template_id) |
Delete a template |
get_icons() |
Get list of available icons |
Usage
import knot.template as template
# List all templates
templates = template.list()
for t in templates:
print(f"{t['name']}: {t['platform']}")
# Get a template
t = template.get("ubuntu")
print(t['description'])
# Get available icons
icons = template.get_icons()
print(icons)Template Properties
list() returns summary objects containing:
id- Template IDname- Template namedescription- Descriptionplatform- Platform (e.g., “linux/amd64”)active- Whether the template is activeusage- Current usage countdeployed- Number of deployed spaces
get() returns the full template including all of the above plus:
job- Job definitionvolumes- Volume definitionsis_managed- Whether managed by the systemcompute_units- Compute units quotastorage_units- Storage units quotahash- Template hashwith_terminal- Terminal access enabledwith_vscode_tunnel- VS Code tunnel enabledwith_code_server- Code Server enabledwith_ssh- SSH access enabledwith_run_command- Run command enabledschedule_enabled- Schedule enabledauto_start- Auto-start enabledmax_uptime- Maximum uptime valuemax_uptime_unit- Maximum uptime uniticon_url- Icon URLgroups- List of group IDszones- List of zone namesschedule- List of schedule day dicts (enabled,from,to)custom_fields- List of custom field dicts (name,description)