internal

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Overview

Package internal provides utility functions and types for managing Crossplane composed resources within a function. It simplifies access to observed and desired resources and offers helpers for working with external names and annotations.

This package is intended for internal use by Crossplane function implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAnnotationOnDesired

func AddAnnotationOnDesired(des *resource.DesiredComposed, key string, value string)

AddAnnotationOnDesired adds a custom annotation to a desired composed resource. If the resource has no existing annotations, a new map is created. The annotation is added using the provided key and value.

This helper is useful in Crossplane functions for dynamically adding metadata to desired resources during function execution.

func GetBoolAnnotation

func GetBoolAnnotation(obs resource.ObservedComposed, key string) (bool, error)

GetBoolAnnotation retrieves a boolean value from annotations of observed composed resource. It expects the annotation values which are supported by strconv.ParseBool accepts. Returns (value, nil) if the annotation exists and is valid, otherwise (false, error).

func GetExternalNameFromDesired

func GetExternalNameFromDesired(des *resource.DesiredComposed) string

GetExternalNameFromDesired returns the external-name from a desired composed resource.

func GetExternalNameFromObserved

func GetExternalNameFromObserved(obs resource.ObservedComposed) string

GetExternalNameFromObserved returns the external-name from a observed composed resource.

func SetBoolAnnotation

func SetBoolAnnotation(des *resource.DesiredComposed, key string, value bool)

SetBoolAnnotation appends a boolean value as "true"/"false" to annotations.

func SetExternalNameOnDesired

func SetExternalNameOnDesired(des *resource.DesiredComposed, externalName string) error

SetExternalNameOnDesired sets the external-name of a desired composed resource.

func SetManagedValues

func SetManagedValues(des *resource.DesiredComposed, in *v1beta1.Input) error

SetManagedValues edits the desired composite resource to display that it has been imported and therefore is being managed and sets managementPolicies. If managementPolicies are provided within the input use them, otherwise default to observe-only.

Types

type Resources

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

Resources stores both observed and desired composed resources for ease of access.

func GetResources

func GetResources(req *fnv1.RunFunctionRequest) (Resources, error)

GetResources fetches both the observed and desired resources from a request and stores them in a type Resources for ease of access.

func (Resources) GetDesired

func (r Resources) GetDesired() map[resource.Name]*resource.DesiredComposed

GetDesired returns desired composed resources.

func (Resources) GetObserved

func (r Resources) GetObserved() map[resource.Name]resource.ObservedComposed

GetObserved returns observed composed resources.

Directories

Path Synopsis
Package gitlabclient provides utilities for creating and configuring a GitLab API client.
Package gitlabclient provides utilities for creating and configuring a GitLab API client.
Package gvkimplementation provides a flexible registry that maps Kubernetes GroupVersionKinds (GVKs) to their corresponding handler and importer implementations.
Package gvkimplementation provides a flexible registry that maps Kubernetes GroupVersionKinds (GVKs) to their corresponding handler and importer implementations.
Package handler defines a common interface for handling provider-specific resources in Crossplane functions.
Package handler defines a common interface for handling provider-specific resources in Crossplane functions.
gitlabhandler
Package gitlabhandler provides helper types and methods for interacting with GitLab resources in the context of Crossplane compositions.
Package gitlabhandler provides helper types and methods for interacting with GitLab resources in the context of Crossplane compositions.
Package importer defines a common interface for importing provider-specific resources into Crossplane compositions.
Package importer defines a common interface for importing provider-specific resources into Crossplane compositions.
gitlabimporter
Package gitlabimporter provides implementations of the Importer interface for GitLab resources in Crossplane functions.
Package gitlabimporter provides implementations of the Importer interface for GitLab resources in Crossplane functions.
Package testutils makes it easy to create moc resources for testing.
Package testutils makes it easy to create moc resources for testing.

Jump to

Keyboard shortcuts

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