Plugins & Endpoints¶
Plugins are adapters that parse API specification files into normalized endpoint definitions. The generated code gives you typed constants with IDE autocomplete.
How It Works¶
- A plugin adapter reads a source file (RBAC JSON, OpenAPI, custom format)
- It returns a list of
EndpointSpecobjects with path, methods, name, description - The code generator writes a Python module with frozen
Endpointconstants
Built-in Plugins¶
| Plugin | Source Format | Description |
|---|---|---|
snf-instance-rest |
rbac_access_matrix.json |
SFM Redfish API endpoints |
EndpointSpec¶
The intermediate format produced by plugin adapters:
@dataclass
class EndpointSpec:
path: str # "/redfish/v1/SFM/1/BlueprintTemplates"
methods: tuple[str, ...] # ("GET", "POST")
name: str # "BlueprintTemplates"
description: str = "" # Human-readable description
metadata: dict = field(...) # Plugin-specific extra data
Endpoint (runtime)¶
The frozen constant imported in user code:
Generated Code¶
After restful plugin load, the generated endpoints.py looks like:
# Auto-generated by restful (snf-instance-rest) — 42 endpoints
from restful.models import Endpoint
BlueprintTemplates = Endpoint(
path="/redfish/v1/SFM/1/BlueprintTemplates",
methods=("GET",),
)
Infrastructures = Endpoint(
path="/redfish/v1/SFM/1/Infrastructures",
methods=("GET", "POST"),
)