Documentation
¶
Overview ¶
Package docs generates documents from YAML metadata and native Terraform objects.
Index ¶
- func ExecuteGenerate(cmd *cobra.Command, args []string) error
- func Generate(atmosConfig *schema.AtmosConfiguration, baseDir string, ...) error
- func GenerateWithHooks(atmosConfig *schema.AtmosConfiguration, cmd *cobra.Command, docType string, ...) error
- func RegisterHookRunnerFactory(factory HookRunnerFactory)
- type HookRunner
- type HookRunnerFactory
- type HookRunnerRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteGenerate ¶
ExecuteGenerate implements 'atmos docs generate <doc-type>': it loads atmos.yaml honoring the global --base-path, --config, --config-path, and --profile flags, selects the docs.generate.<doc-type> entry, and generates the document with lifecycle hooks.
func Generate ¶
func Generate(atmosConfig *schema.AtmosConfiguration, baseDir string, docsGenerate *schema.DocsGenerate) error
Generate merges YAML inputs, loads Terraform metadata, and renders the configured document.
func GenerateWithHooks ¶
func GenerateWithHooks(atmosConfig *schema.AtmosConfiguration, cmd *cobra.Command, docType string, docsGenerate *schema.DocsGenerate) error
GenerateWithHooks generates the document configured under docs.generate.<docType> and runs the before.docs.generate and after.docs.generate lifecycle hooks around it. A before hook failure (or a policy denial) aborts before any file is written. After hooks run on success and on failure, filtered by each hook's `when`.
func RegisterHookRunnerFactory ¶
func RegisterHookRunnerFactory(factory HookRunnerFactory)
RegisterHookRunnerFactory installs the factory that supplies lifecycle hooks to Generate callers. The pkg/hooks package registers it at init; a nil factory disables hooks.
Types ¶
type HookRunner ¶
type HookRunner interface {
// Run fires event. genErr is the generation result for after events and nil for before
// events. The returned error already reflects each hook's on_failure handling and any
// policy denial.
Run(event events.HookEvent, genErr error) error
}
HookRunner fires lifecycle hooks around document generation.
type HookRunnerFactory ¶
type HookRunnerFactory func(req *HookRunnerRequest) (HookRunner, error)
HookRunnerFactory builds a HookRunner for one generation.
type HookRunnerRequest ¶
type HookRunnerRequest struct {
// AtmosConfig is the active configuration.
AtmosConfig *schema.AtmosConfiguration
// DocType is the docs.generate.<doc-type> key.
DocType string
// BaseDir is the absolute docs.generate.<doc-type>.base-dir.
BaseDir string
// OutputPath is the absolute path of the document being generated.
OutputPath string
// Hooks is the untyped docs.generate.<doc-type>.hooks map.
Hooks map[string]any
// Cmd is the running command, used for --skip-hooks.
Cmd *cobra.Command
}
HookRunnerRequest describes the docs generation a HookRunner serves.