manager

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package manager implements a schema manager for use in Crossplane projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a schema manager. It manages a directory of schemas, generating new schemas only when necessary.

func New

New returns an initialized manager.

func (*Manager) Add

func (m *Manager) Add(ctx context.Context, source Source) error

Add ensures schemas for resources in the given source are present in the managed directory.

func (*Manager) Generate

func (m *Manager) Generate(ctx context.Context, source Source) (map[string]afero.Fs, error)

Generate generates and returns schemas using the manager's generators, and adds them to the manager. Unlike Add, Generate will always generate schemas, regardless of whether they're already present in the manager.

type Source

type Source interface {
	// ID returns a unique identifier for this source.
	ID() string
	// Version returns a revision identifier for this source.
	Version(ctx context.Context) (string, error)
	// Resources returns a filesystem containing resources for which schemas
	// need to be generated.
	Resources(ctx context.Context) (afero.Fs, error)
	// Type returns the type of source.
	Type() SourceType
}

Source is a source of resources for which schemas can be generated.

func NewFSSource

func NewFSSource(id string, fs afero.Fs) Source

NewFSSource returns a new filesystem-backed resource source. The id should be a stable, location-independent identifier (e.g. a project-relative path) since it is persisted in the schema manager's lockfile.

func NewGitSource

func NewGitSource(dep v1alpha1.Dependency, cloner git.Cloner, authProvider git.AuthProvider) Source

NewGitSource returns a new git-backed resource source.

func NewHTTPSource

func NewHTTPSource(dep v1alpha1.Dependency) Source

NewHTTPSource returns a new HTTP-backed resource source.

func NewK8sSource

func NewK8sSource(dep v1alpha1.Dependency) Source

NewK8sSource returns a source for Kubernetes built-in APIs.

func NewXpkgSource

func NewXpkgSource(id, version string, crdFS afero.Fs) Source

NewXpkgSource returns a new xpkg-backed resource source. The crdFS should contain extracted CRD YAML files from the package.

type SourceType

type SourceType string

SourceType represents the type of source.

const (
	// SourceTypeCRD indicates a source containing CRDs/XRDs.
	SourceTypeCRD SourceType = "crd"
	// SourceTypeOpenAPI indicates a source containing OpenAPI specifications.
	SourceTypeOpenAPI SourceType = "openapi"
)

Jump to

Keyboard shortcuts

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