Loading...
Loading...
Create and manage Infrahub transforms. Use when building data transformations, config generation, or any workflow that converts Infrahub data into a different format (JSON, text, CSV, device configs) using Python or Jinja2 templates.
npx skill4agent add opsmill/infrahub-skills infrahub-transform-creator| Priority | Category | Prefix | Description |
|---|---|---|---|
| CRITICAL | Types | | Python vs Jinja2 choice |
| CRITICAL | Python | | InfrahubTransform class |
| CRITICAL | Jinja2 | | Template syntax, filters |
| HIGH | Hybrid | | Python + Jinja2 combined |
| HIGH | Artifacts | | Output files, targets |
| HIGH | API Ref | | Class attrs, methods |
| MEDIUM | Patterns | | Utilities, CSV, shared |
| LOW | Testing | | Transform/render commands |
| Type | Output | Entry Point |
|---|---|---|
| Python | JSON/dict or text | |
| Jinja2 | Text | |
from infrahub_sdk.transforms import InfrahubTransform
class MyTransform(InfrahubTransform):
query = "my_query"
async def transform(self, data: dict) -> dict:
device = data["DcimDevice"]["edges"][0]["node"]
return {"hostname": device["name"]["value"]}