linkhelpers

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingResolvedResource is an error that is returned when a set of resource
	// changes does not contain a resolved resource.
	ErrMissingResolvedResource = errors.New("resource changes missing resolved resource")
)

Functions

func CollectChanges

func CollectChanges(
	resourceFieldPath string,
	linkFieldPath string,
	currentLinkData *core.MappingNode,
	resourceChanges *provider.Changes,
	collectIn *provider.LinkChanges,
) error

CollectChanges deals with collecting changes into the given *provider.Changes struct reference for a given field in a resource. This only supports collecting changes for scalar fields in the resource spec. scalar fields meaning strings, booleans, integers and floating point numbers.

func CollectLinkDataChanges

func CollectLinkDataChanges(
	linkFieldPath string,
	currentLinkData *core.MappingNode,
	collectIn *provider.LinkChanges,
	newValue *core.MappingNode,
) error

CollectLinkDataChanges deals with collecting changes into the given *provider.Changes struct reference for a given link data field. This should be used for any link data that is not derived directly from a resource spec field. For example, this should be used for values that are derived from configuration in resource annotations or static logic in the link implementation. This only supports collecting changes for scalar fields in the link data. Scalar fields meaning strings, booleans, integers and floating point numbers.

func GetAnnotation

func GetAnnotation(
	resourceChanges *provider.Changes,
	annotationName string,
	defaultValue *core.MappingNode,
) *core.MappingNode

GetAnnotation returns the annotation with the given name from the resolved resource contained in the given set of resource changes. If the annotation is not found, the provided default value is returned.

func GetLinkDataFromState

func GetLinkDataFromState(state *state.LinkState) *core.MappingNode

GetLinkDataFromState returns the link data from the given state, returning nil if the provided state is nil. This wraps the link data in a MappingNode with the "Fields" property populated with the link data.

func GetResolvedResource

func GetResolvedResource(resourceChanges *provider.Changes) *provider.ResolvedResource

GetResolvedResource attempts to extract the resolved resource from the given set of resource changes. If the provided resource changes are nil, this function returns nil.

func GetResourceNameFromChanges

func GetResourceNameFromChanges(changes *provider.Changes) string

GetResourceNameFromChanges returns the resource name from the given changes, returning an empty string if the provided changes are nil.

func IsFieldKnownOnDeploy

func IsFieldKnownOnDeploy(changes *provider.Changes, fieldPath string) bool

IsFieldKnownOnDeploy returns whether the given field path is known on deploy in the given set of resource changes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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