catalog

package
v0.0.0-...-4704126 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package catalog is the compiled-catalog model produced by the evaluator: a graph of resources with containment and relationship edges, serializable to the Puppet catalog JSON shape.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	Name        string
	Environment string
	Version     int64
	// contains filtered or unexported fields
}

Catalog is a compiled catalog for one node.

func New

func New(name string) *Catalog

New creates an empty catalog for the named node.

func (*Catalog) Add

func (c *Catalog) Add(r *Resource) error

Add inserts r, returning an error if a resource with the same reference is already present (Puppet forbids duplicate resource declarations).

func (*Catalog) AddEdge

func (c *Catalog) AddEdge(source, target string)

AddEdge records a directed edge source -> target, de-duplicating.

func (*Catalog) Edges

func (c *Catalog) Edges() []Edge

Edges returns the edges in insertion order.

func (*Catalog) Get

func (c *Catalog) Get(ref string) (*Resource, bool)

Get returns the resource for ref (`Type[Title]`) and whether it exists.

func (*Catalog) JSON

func (c *Catalog) JSON() string

JSON renders the catalog in the Puppet catalog JSON shape. It is written by hand (no reflection) so the field order is stable and deterministic.

func (*Catalog) Resources

func (c *Catalog) Resources() []*Resource

Resources returns the resources in declaration order.

type DuplicateError

type DuplicateError struct{ Ref string }

DuplicateError reports a duplicate resource declaration.

func (*DuplicateError) Error

func (e *DuplicateError) Error() string

Error implements error.

type Edge

type Edge struct {
	Source string
	Target string
}

Edge is a directed relationship between two resource references.

type Resource

type Resource struct {
	Type       string
	Title      string
	Parameters map[string]any
	Tags       []string
	Exported   bool
	Virtual    bool
}

Resource is one catalog resource: a typed, titled bag of parameters plus its tags and virtual/exported flags.

func (*Resource) Ref

func (r *Resource) Ref() string

Ref returns the canonical Puppet reference `Type[Title]`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL