Documentation
¶
Index ¶
- func BuildCenterSpec[T any](name string, modelUID string) (types.ResourceSpec, error)
- func DecodeResource[T any](resource types.ResolvedResource) (T, error)
- func DeriveSchema[T any](modelUID string) (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 CompactModelDescriptor
- type ModelDescriptor
- type ModelGroupDescriptor
- type ModelNameDescriptor
- type TargetMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCenterSpec ¶
BuildCenterSpec 基于中心节点模型结构 T 反射构建出根 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 CompactModelDescriptor ¶ added in v1.11.4
CompactModelDescriptor 允许模型结构体通过单方法自描述中文名称与所属模型分组
type ModelDescriptor ¶ added in v1.11.4
ModelDescriptor 允许模型结构体自描述其中文名称与所属模型分组
type ModelGroupDescriptor ¶ added in v1.11.4
type ModelGroupDescriptor interface {
ModelGroup() string
}
ModelGroupDescriptor 允许模型结构体仅自描述其所属模型分组
type ModelNameDescriptor ¶ added in v1.11.4
type ModelNameDescriptor interface {
ModelName() string
}
ModelNameDescriptor 允许模型结构体仅自描述其中文展示名称
type TargetMeta ¶ added in v1.11.4
type TargetMeta struct {
Schema types.Schema
Spec types.ResourceSpec
}
TargetMeta 包含目标资产经过一次内省推导产出的 Schema 和 ResourceSpec
func InspectTarget ¶ added in v1.11.4
func InspectTarget[T any](name string, modelUID string) (TargetMeta, error)
InspectTarget 基于目标资产泛型 T 完成单次内省与双向投影,零冗余分支