infrahub-object-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Object Creator

对象创建工具

Overview

概述

Expert guidance for creating Infrahub object (data) files. Objects are YAML files that populate schema nodes with actual infrastructure data -- devices, locations, organizations, modules, and more.
为创建Infrahub对象(数据)文件提供专业指导。对象是用于为架构节点填充实际基础设施数据的YAML文件——包括设备、位置、组织、模块等。

When to Use

适用场景

  • Creating new data files for infrastructure objects
  • Populating devices, locations, organizations, or other schema nodes
  • Setting up hierarchical data (location trees, tenant groups)
  • Referencing related objects across files
  • Managing component children (interfaces, modules)
  • Organizing object files for correct load order
  • 为基础设施对象创建新的数据文件
  • 填充设备、位置、组织或其他架构节点
  • 设置分层数据(位置树、租户组)
  • 跨文件引用关联对象
  • 管理组件子项(接口、模块)
  • 组织对象文件以确保正确的加载顺序

Rule Categories

规则分类

PriorityCategoryPrefixDescription
CRITICALFile Format
format-
apiVersion, kind, spec structure
CRITICALValue Mapping
value-
Attributes, dropdowns, references
HIGHChildren
children-
Hierarchy/component nesting
MEDIUMRange
range-
Sequential interface expansion
MEDIUMOrganization
organization-
Naming, load order, multi-doc
LOWPatterns
patterns-
Flat lists, devices, git repos
优先级分类前缀描述
关键文件格式
format-
apiVersion、kind、spec结构
关键值映射
value-
属性、下拉菜单、引用
子项
children-
层级/组件嵌套
范围
range-
顺序接口扩展
组织
organization-
命名、加载顺序、多文档
模式
patterns-
扁平列表、设备、Git仓库

Object File Basics

对象文件基础

yaml
---
apiVersion: infrahub.app/v1
kind: Object
spec:
  kind: <NodeKind>          # Schema node kind (e.g., DcimDellServer)
  data:
    - <attribute>: <value>  # List of object instances
apiVersion
,
kind: Object
,
spec.kind
, and
spec.data
are always required. Each
spec
block targets a single node kind.
yaml
---
apiVersion: infrahub.app/v1
kind: Object
spec:
  kind: <NodeKind>          # 架构节点类型(例如:DcimDellServer)
  data:
    - <attribute>: <value>  # 对象实例列表
apiVersion
kind: Object
spec.kind
spec.data
始终是必填项。每个
spec
块对应单个节点类型。

Supporting References

相关参考资料

  • reference.md -- Object file format specification
  • examples.md -- 15 complete object patterns from production repos
  • ../common/infrahub-yml-reference.md -- .infrahub.yml project configuration
  • ../common/rules/ -- Shared rules (git integration, caching) across all skills
  • ../schema-creator/SKILL.md -- Schema definitions these objects conform to
  • rules/ -- Individual rules by category prefix
  • reference.md —— 对象文件格式规范
  • examples.md —— 来自生产环境仓库的15个完整对象模式
  • ../common/infrahub-yml-reference.md —— .infrahub.yml项目配置
  • ../common/rules/ —— 所有技能共享的规则(Git集成、缓存)
  • ../schema-creator/SKILL.md —— 这些对象所遵循的架构定义
  • rules/ —— 按分类前缀划分的单独规则