overlays

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package overlays holds hand-written, per-type adjustments applied to generated Cloud Control resource schemas. Some CloudFormation constructs (free-form objects, gnarly $ref graphs, constraints expressed only in prose) do not translate cleanly, so an overlay refines the generated base for those types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

Apply runs the registered overlay for a type, if any, returning the (possibly refined) schema. Generated code calls this around its base schema builder.

func IsStabiliseRequired

func IsStabiliseRequired(blueprintType string) bool

IsStabiliseRequired reports whether a resource type is registered as slow to stabilise.

func Register

func Register(blueprintType string, overlay SchemaOverlay)

Register associates an overlay with a Bluelink resource type. It is intended to be called from per-type init functions and panics on a duplicate registration.

func RegisterBehaviour

func RegisterBehaviour(blueprintType string, behaviour *Behaviour)

RegisterBehaviour associates a behaviour overlay with a Bluelink resource type, from a per-type init function. It panics on a duplicate registration.

func RegisterMetaAdjustment

func RegisterMetaAdjustment(blueprintType string, adjustment *MetaAdjustment)

RegisterMetaAdjustment associates a meta adjustment with a Bluelink resource type. It is intended to be called from per-type init functions and panics on a duplicate registration.

func RegisterStabiliseRequired

func RegisterStabiliseRequired(blueprintType string)

RegisterStabiliseRequired marks a Bluelink resource type as slow to stabilise. This is intended to be called from per-type init functions.

func StabiliseRequiredTypes

func StabiliseRequiredTypes() []string

StabiliseRequiredTypes returns the registered stabilise-required resource types, sorted for deterministic output. Used to populate a resource's stabilised dependencies so consumers wait for these types to stabilise.

Types

type Behaviour

type Behaviour struct {
	CustomValidate func(
		context.Context,
		*provider.ResourceValidateInput,
	) (*provider.ResourceValidateOutput, error)
	Name                   *NameGeneration
	BeforeCreate           SpecTransform
	AfterReadExternalState SpecTransform
	// ValidateResolvedSpec runs against the fully resolved spec before both create
	// and update, for constraints on values that are only known once references are
	// resolved at deploy time (e.g. lists wired from another resource's computed
	// fields). Returning an error aborts the deployment with that message, giving
	// an actionable diagnostic in place of an opaque downstream AWS error.
	ValidateResolvedSpec SpecTransform
}

Behaviour carries per-type, hand-written behaviour the generic Cloud Control engine cannot derive from a schema: custom validation, unique-name generation, and transforms applied to desired/external state. It is the functionality-level equivalent to the schema and example overlays.

func BehaviourFor

func BehaviourFor(blueprintType string) *Behaviour

BehaviourFor returns the behaviour overlay for a type, or nil if none is registered.

type MetaAdjustment

type MetaAdjustment struct {
	// RemoveJSONStringFields lists field paths the overlay has re-typed as
	// structured objects, so the engine must no longer treat them as JSON strings
	// (parse/serialise) at the Cloud Control boundary.
	RemoveJSONStringFields []string
	// AddFieldNameOverrides maps camelCase field paths the overlay introduced to
	// their CloudFormation property names, for keys a first-character flip cannot
	// recover (e.g. "...principal.aws" -> "AWS").
	AddFieldNameOverrides map[string]string
}

MetaAdjustment describes changes an overlay needs applied to a type's CCResourceMeta that a schema overlay alone cannot express, since the Meta lives in the cloudcontrol package and overlays must not import it. It is expressed in primitive terms to avoid an import cycle.

func MetaAdjustmentFor

func MetaAdjustmentFor(blueprintType string) *MetaAdjustment

MetaAdjustmentFor returns the registered meta adjustment for a type, or nil.

type NameGeneration

type NameGeneration struct {
	// Field is the camelCase spec field to populate (e.g. "queueName").
	Field string
	// Generate produces the unique name; it may read the resolved spec from the
	// input (e.g. to vary behaviour for FIFO queues).
	Generate utils.UniqueNameGenerator
}

NameGeneration auto-populates a name field with a unique provenance name when the user leaves it empty, reusing the shared name generators.

type SchemaOverlay

SchemaOverlay refines a generated schema in place and returns it.

type SpecTransform

type SpecTransform func(spec *core.MappingNode) error

SpecTransform mutates a spec mapping node in place. Used for the bespoke field handling some resources need that the generic engine cannot infer.

Jump to

Keyboard shortcuts

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