ResourceTemplateBuilder

Usage

Source

ResourceTemplateBuilder(
    name,
    type_names=None,
    version="1.0",
    parent=None,
    *,
    backend,
    namespace_context,
    resource_template_id=None,
    on_existing="warn",
    command_context
)

Methods

Name Description
add_properties() Add property groups and their attributes to this resource template.
get_model() Return a pydantic model for the resource template, optionally reloading

add_properties()

Add property groups and their attributes to this resource template.

Usage

Source

add_properties(prop_def)

Parameters

prop_def

A mapping of group name → list of attribute dicts. Each attribute dict accepts the keys name, type, default, unit (optional), and metadata (optional).

Examples

:
template_builder.add_properties({
    "content": [
        {"name": "catalog_id", "type": "str", "default": ""},
        {"name": "volume", "type": "float", "default": 10.0, "unit": "uL"},
    ]
})

Returns

self, to allow method chaining.


get_model()

Return a pydantic model for the resource template, optionally reloading

Usage

Source

get_model(*, update=False)

from the backend first. Critical fields are locked against mutation.