infrahub-object-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseObject 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
规则分类
| Priority | Category | Prefix | Description |
|---|---|---|---|
| CRITICAL | File Format | | apiVersion, kind, spec structure |
| CRITICAL | Value Mapping | | Attributes, dropdowns, references |
| HIGH | Children | | Hierarchy/component nesting |
| MEDIUM | Range | | Sequential interface expansion |
| MEDIUM | Organization | | Naming, load order, multi-doc |
| LOW | Patterns | | Flat lists, devices, git repos |
| 优先级 | 分类 | 前缀 | 描述 |
|---|---|---|---|
| 关键 | 文件格式 | | apiVersion、kind、spec结构 |
| 关键 | 值映射 | | 属性、下拉菜单、引用 |
| 高 | 子项 | | 层级/组件嵌套 |
| 中 | 范围 | | 顺序接口扩展 |
| 中 | 组织 | | 命名、加载顺序、多文档 |
| 低 | 模式 | | 扁平列表、设备、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 instancesapiVersionkind: Objectspec.kindspec.dataspecyaml
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: <NodeKind> # 架构节点类型(例如:DcimDellServer)
data:
- <attribute>: <value> # 对象实例列表apiVersionkind: Objectspec.kindspec.dataspecSupporting 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/ —— 按分类前缀划分的单独规则