core

package
v1.0.0-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package core defines the platform-neutral contract for OPM-compiled artifacts. Each target platform — Kubernetes, docker-compose, Nomad, Terraform, Crossplane, ... — provides its own implementation of Resource that maps a Compiled output to its native identity.

The library never depends on a specific platform's vocabulary: it produces *Compiled values and lets adapters wrap them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiled

type Compiled struct {
	// Value is the CUE value produced by the transformer. Concrete and
	// fully evaluated — safe to encode directly to YAML or JSON.
	Value cue.Value

	// Instance is the name of the ModuleInstance that produced this resource.
	// Was: Release
	Instance string

	// Component is the source component name within the instance.
	Component string

	// Transformer is the FQN of the transformer that produced this resource.
	Transformer string
}

Compiled is the raw output of the OPM compile pipeline before any platform wrapping. The compile package emits *Compiled values; adapters translate them to platform-specific Resource implementations that expose Identity().

Compiled itself does NOT implement Resource — keeping the two apart stops library code from accidentally reading platform-native fields and keeps the kernel platform-neutral.

type Identity

type Identity struct {
	// Type is the resource type in the platform's taxonomy.
	Type string

	// Name is the platform-local name of the resource.
	Name string

	// Scope is the platform's optional grouping handle (k8s namespace,
	// compose project, nomad namespace, ...).
	Scope string

	// Group is the platform's optional API group / category (k8s API
	// group, terraform provider, ...).
	Group string

	// Version is the platform's optional API version.
	Version string
}

Identity is the platform-native handle for a resource: a flat tuple every platform fills with its own taxonomy. Unused fields stay zero.

Examples:

  • k8s Deployment: {Type: "Deployment", Name: "web", Scope: "default", Group: "apps", Version: "v1"}
  • compose service: {Type: "service", Name: "web", Scope: "myproject"}
  • nomad job: {Type: "job", Name: "web", Scope: "default"}
  • terraform aws_*: {Type: "aws_instance", Name: "web", Group: "aws"}
  • crossplane XR: {Type: "XPostgreSQL", Name: "db", Group: "example.org", Version: "v1"}

func (Identity) String

func (i Identity) String() string

String returns a human-readable summary using whichever fields are set. Format: "[Group/]Type[/Scope]/Name" with empty fields elided.

type Resource

type Resource interface {
	// Instance is the name of the ModuleInstance that produced this resource.
	// Was: Release
	Instance() string

	// Component is the source component name within the instance.
	Component() string

	// Transformer is the FQN of the transformer that produced this resource.
	Transformer() string

	// Value returns the underlying CUE value the transformer produced.
	// Concrete and fully evaluated — safe to encode directly.
	Value() cue.Value

	// Identity returns the platform-native identity of this resource.
	Identity() Identity
}

Resource is a platform-compiled artifact carrying both OPM provenance and platform-native identity. Adapters (k8s, compose, ...) implement this interface by wrapping a Compiled.

Jump to

Keyboard shortcuts

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