Documentation
¶
Index ¶
- func BuildCenterSpec[T any](name string, modelUID string) (types.ResourceSpec, error)
- func BuildSpecs[T any]() ([]types.ResourceSpec, error)
- func DecodeResource[T any](resource types.ResolvedResource) (T, error)
- func DeriveSchema[T any](modelUID string, opts ...DeriveOption) (types.Schema, error)
- func InputMany[T any](actionCtx types.ActionContext, name string) ([]T, error)
- func InputOne[T any](actionCtx types.ActionContext, name string) (T, error)
- func InputRootOne[T any](actionCtx types.ActionContext) (T, error)
- func RootInputName(actionCtx types.ActionContext) (string, error)
- type DeriveOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCenterSpec ¶
BuildCenterSpec 基于中心节点模型结构 T 反射构建出根 ResourceSpec
func BuildSpecs ¶
func BuildSpecs[T any]() ([]types.ResourceSpec, error)
BuildSpecs 基于顶层输入容器 T 反射解析出 types.ResourceSpec 列表
func DecodeResource ¶
func DecodeResource[T any](resource types.ResolvedResource) (T, error)
DecodeResource 将已解析资源按照 `plugin` tag 解码成强类型结构 T
func DeriveSchema ¶
DeriveSchema 基于泛型结构体 T 与入口 modelUID,自动反射推导出一套最小合法的 CMDB 元数据 Schema 自动推导模型、属性组、属性类型、安全字段标记(密码/私钥)以及模型间关联关系
func InputMany ¶
func InputMany[T any](actionCtx types.ActionContext, name string) ([]T, error)
InputMany 从动作上下文中读取多个输入,并逐个解码成调用方声明的强类型结构 T
func InputOne ¶
func InputOne[T any](actionCtx types.ActionContext, name string) (T, error)
InputOne 从动作上下文中读取单个输入,并解码成调用方声明的强类型结构 T
func InputRootOne ¶
func InputRootOne[T any](actionCtx types.ActionContext) (T, error)
InputRootOne 自动定位入口输入并解码为目标结构体 T
func RootInputName ¶
func RootInputName(actionCtx types.ActionContext) (string, error)
RootInputName 自动推断根节点输入名称
Types ¶
type DeriveOption ¶ added in v1.11.3
type DeriveOption func(*deriveOptions)
DeriveOption 用于向 DeriveSchema 传入模型级别的元数据覆写选项
func WithModelGroup ¶ added in v1.11.3
func WithModelGroup(group string) DeriveOption
WithModelGroup 设置根模型所属的 CMDB 模型分组
func WithModelName ¶ added in v1.11.3
func WithModelName(name string) DeriveOption
WithModelName 设置根模型的中文展示名称