config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config defines configuration structures and loading logic.

Index

Constants

View Source
const (
	// DeletePolicyCascade indicates that related items should be deleted when the source item is deleted.
	DeletePolicyCascade = "cascade"
	// DeletePolicyNone indicates that related items should not be deleted when the source item is deleted.
	DeletePolicyNone = "none"

	// ExtraRelationshipFamily indicates that the mapping is for relationships between items.
	ExtraRelationshipFamily = "relationships"

	APIVersionField   = "apiVersion"
	DeletePolicyField = "deletePolicy"
	IdentifierField   = "identifier"
	ItemFamilyField   = "itemFamily"
	SourceRefField    = "sourceRef"
	TargetRefField    = "targetRef"
	TypeField         = "type"
	TypeRefField      = "typeRef"
)

Variables

View Source
var (
	// ErrParsing reports failures that occur while decoding mapping files.
	ErrParsing = errors.New("error parsing")

	RequiredExtraFields = []string{APIVersionField, ItemFamilyField, DeletePolicyField, IdentifierField}
)

Functions

This section is empty.

Types

type Extra

type Extra map[string]any

Extra holds an extra mapping definition as a generic map after validation.

func (*Extra) UnmarshalYAML

func (e *Extra) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML decodes YAML for an extra mapping and validates required fields.

type MappingConfig

type MappingConfig struct {
	Type       string         `json:"type" yaml:"type"`
	Extra      map[string]any `json:"extra,omitempty" yaml:"extra,omitempty"`
	APIVersion string         `json:"apiVersion" yaml:"apiVersion"`
	ItemFamily string         `json:"itemFamily" yaml:"itemFamily"`
	Syncable   bool           `json:"syncable" yaml:"syncable"`
	Mappings   Mappings       `json:"mappings" yaml:"mappings"`
}

MappingConfig holds the configuration for mapping rules.

func NewMappingConfigsFromPath

func NewMappingConfigsFromPath(path string) ([]*MappingConfig, error)

NewMappingConfigsFromPath parses the file or directory at path and returns any mapping configurations it contains. It reports failures encountered while reading or decoding the data.

type Mappings

type Mappings struct {
	Identifier string            `json:"identifier" yaml:"identifier"`
	Metadata   MetadataMapping   `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Spec       map[string]string `json:"spec" yaml:"spec"`
	Extra      []Extra           `json:"extra,omitempty" yaml:"extra,omitempty"`
}

Mappings holds the identifier and specification templates for mapping rules.

type MetadataMapping

type MetadataMapping map[string]string

MetadataMapping holds a flattened representation of metadata templates.

func (*MetadataMapping) UnmarshalYAML

func (mm *MetadataMapping) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML decodes YAML metadata templates and flattens them into a map.

type MetadataTemplate

type MetadataTemplate struct {
	Annotations       string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
	CreationTimestamp string `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
	Description       string `json:"description,omitempty" yaml:"description,omitempty"`
	Labels            string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Links             string `json:"links,omitempty" yaml:"links,omitempty"`
	Name              string `json:"name,omitempty" yaml:"name,omitempty"`
	Tags              string `json:"tags,omitempty" yaml:"tags,omitempty"`
	Title             string `json:"title,omitempty" yaml:"title,omitempty"`
	UID               string `json:"uid,omitempty" yaml:"uid,omitempty"`
}

MetadataTemplate is the strongly-typed representation of the metadata section in mapping files.

Jump to

Keyboard shortcuts

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