air_sdk.endpoints.os_templates

View as Markdown

Classes

NameDescription
_OSTemplateRenderFileRequiredRequired fields for OSTemplateRenderFile.
OSTemplateRenderFileA single OS template render entry: file content plus POSIX metadata.
OSTemplateAn OS template: the files injected into a node at boot.
OSTemplateEndpointAPIEndpoint API for managing OS templates.

Module Contents

class air_sdk.endpoints.os_templates._OSTemplateRenderFileRequired

Bases: typing.TypedDict

Required fields for OSTemplateRenderFile.

content: str
class air_sdk.endpoints.os_templates.OSTemplateRenderFile

Bases: air_sdk.endpoints.os_templates._OSTemplateRenderFileRequired

A single OS template render entry: file content plus POSIX metadata.

owner: str

POSIX owner — user name or numeric uid. Defaults to root

group: str

POSIX group — group name or numeric gid. Defaults to root

mode: str

POSIX octal file mode. Defaults to 0644

content

Template body, rendered with the merged vars/generate context

class air_sdk.endpoints.os_templates.OSTemplate

Bases: air_sdk.air_model.AirModel

An OS template: the files injected into a node at boot.

A template describes, for one OS type and version, which files to render onto the node and which variables feed that rendering. An OSImageManifest pins a specific template version per hardware model.

id: Unique identifier for the template created: Timestamp when the template was created modified: Timestamp when the template was last modified os_type: The OS type this template applies to os_template_version: Version of this template org: Organization owning the template render: Absolute POSIX path to render entry. Each value has a required content plus optional owner, group and mode (defaulting to root/root/0644) creator: Email of the user who created the template generate: Variable names mapped to generation strategies vars: Variable names the render templates reference, declared for upload-time verification. Must exactly match the variables used across the render bodies.

id: str
os_type: str
os_template_version: str
org: str
creator: str | None
generate: dict[str, str]
vars: list[str]
get_model_api() -> type[OSTemplateEndpointAPI]
model_api: OSTemplateEndpointAPI
delete() -> None

Delete this OS template.

Returns:

None

Example:

>>> template.delete()
class air_sdk.endpoints.os_templates.OSTemplateEndpointAPI

Bases: air_sdk.air_model.BaseEndpointAPI[air_sdk.endpoints.os_templates.OSTemplate]

Endpoint API for managing OS templates.

Provides listing, retrieval, creation, and deletion of the templates that define which files are rendered onto a booting node. The API does not support partial or full updates on this resource.

API_PATH: str
list(
*,
os_type: str = ...,
os_template_version: str = ...,
limit: int = ...,
offset: int = ...,
ordering: str = ...,
search: str = ...,
**kwargs: Any

List OS templates.

Parameters:

  • os_type – Filter by OS type
  • os_template_version – Filter by template version
  • limit – Number of results to return per page
  • offset – Initial index from which to return results
  • ordering – Order by field (prefix with ”-” for descending)
  • search – Search across template fields
  • **kwargs – Additional filter parameters

Returns:

Iterator of OSTemplate instances

Example:

>>> for template in api.os_templates.list(os_type='cumulus-linux'):
... print(template.os_template_version)
get(
pk: PrimaryKey,
**kwargs: Any

Retrieve a specific OS template.

Parameters:

  • pk – OS template UUID
  • **kwargs – Additional query parameters

Returns:

OSTemplate instance

Example:

>>> template = api.os_templates.get('template-uuid')
>>> print(template.os_type, template.os_template_version)
create(
*,
os_type: str,
os_template_version: str,
generate: dict[str, str] = ...,
vars: List[str] = ...,
**kwargs: Any

Create an OS template.

Parameters:

  • os_type – The OS type this template applies to
  • os_template_version – Version of this template
  • render – Render entries keyed by absolute POSIX path. Each value requires content; owner, group and mode are optional and default to root/root/0644
  • generate – Variable names mapped to generation strategies
  • vars – Names of the variables this template expects
  • **kwargs – Additional fields for future API compatibility

Returns:

The created OSTemplate instance

Example:

>>> template = api.os_templates.create(
... os_type='cumulus-linux',
... os_template_version='5.9',
... render={
... '/etc/hostname': {'content': '{{ hostname }}'},
... },
... vars=['hostname'],
... )
delete(
pk: PrimaryKey,
**kwargs: Any
) -> None

Delete an OS template.

Parameters:

  • pk – OS template UUID
  • **kwargs – Additional parameters

Returns:

None

Example:

>>> api.os_templates.delete('template-uuid')