How paloaltonetworks/pan-os-codegen works
This repository generates the PAN-OS Go SDK and Terraform provider from normalized schema specifications. The main workflow is CLI selection, configuration and spec loading, normalization, then generation and writing of the selected outputs. The graph preserves the schema model and the distinct SDK and Terraform translation branches. Source excerpts establish the main orchestration and generator relationships; the Terraform translation internals are represented as a subsystem because their individual call relationships were not shown.
Main entry points: generator.go Template generator · codegen.go Generation command · main.go CLI · normalized.go Spec normalization
Components 14
Entry and orchestration
- CLI
cmd/codegen/main.go - Generation command
pkg/commands/codegen/codegen.go
Specifications and schema
- Config loading
pkg/load/file.go - Spec normalization
pkg/properties/normalized.go - Schema model
pkg/schema/object/object.go - Parameter definitions
pkg/schema/parameter/parameter.go
Code translation
- SDK translation
pkg/translate - SDK struct generation
pkg/translate/struct_generation.go - Terraform translation
pkg/translate/terraform_provider
Generation output
- Generation assets
pkg/generate/assets.go - Template generator
pkg/generate/generator.go - Generated SDK
- Generated provider
Other components
- Codegen user
Connections 13
- Codegen user → CLI: runs
README.md - CLI → Generation command: creates and runs
cmd/codegen/main.go - Generation command → Config loading: loads config
pkg/commands/codegen/codegen.go - Generation command → Spec normalization: loads specs
pkg/commands/codegen/codegen.go - Spec normalization → Schema model: normalizes
pkg/properties/normalized.go - Schema model → Parameter definitions: contains definitions
pkg/schema/object/object.go - Generation command → Template generator: generates code
pkg/commands/codegen/codegen.go - Template generator → SDK translation: uses translation
pkg/generate/generator.go - Template generator → Terraform translation: uses translation
pkg/generate/generator.go - SDK translation → SDK struct generation: includes
- Template generator → Generation assets: uses assets
pkg/generate/generator.go - Template generator → Generated SDK: writes SDK
pkg/generate/generator.go - Template generator → Generated provider: writes provider
pkg/generate/generator.go