Documentation
¶
Index ¶
- Constants
- func BuildFromRequest(req *fnv1.RunFunctionRequest, log logging.Logger, targets ...any) error
- func BuildGracefulFromRequest(req *fnv1.RunFunctionRequest, log logging.Logger, targets ...any) (conversionIssues []string, err error)
- func ConvertToResponse(rsp *fnv1.RunFunctionResponse, sources ...any) error
- func CountResources(inventory ResourcesMap, resourceKey string) int
- func ExtractDesiredState(sources ...any) (*resource.Composite, map[resource.Name]*resource.DesiredComposed, error)
- func FindConflictingPrefix[T any](m map[string]T, prefix string) string
- func GetResource[T runtime.Object](inventory ResourceMap, resourceKey string) (T, fnv1.Ready, map[string][]byte, bool)
- func GetResourceMap[T runtime.Object](inventory ResourceMap, objectKey string) (map[string]T, map[string]fnv1.Ready, map[string]map[string][]byte, bool)
- func GetResources[T runtime.Object](inventory ResourcesMap, resourceKey string) ([]T, []fnv1.Ready, []map[string]byte, bool)
- func GetTyped[T runtime.Object](c runtime.Object) (T, bool)
- func HasResource(inventory ResourceMap, resourceKey string) bool
- func Inject(inv Reader, targets ...any) error
- type ConnectionDetails
- type Mapping
- type MappingFunc
- type MappingType
- type Option
- type Reader
- type Resource
- type ResourceMap
- type Resources
- type ResourcesMap
- type TypeRegistry
Constants ¶
const ( TagKey = "crossplane" TagSeparator = ":" TagTypeInput = "input" TagTypeRequired = "required" TagTypeObservedComposite = "observed-composite" TagTypeObservedComposed = "observed-composed" TagTypeDesiredComposite = "desired-composite" TagTypeDesiredComposed = "desired-composed" )
Variables ¶
This section is empty.
Functions ¶
func BuildFromRequest ¶
BuildFromRequest converts a given requests data to the inventory.
func BuildGracefulFromRequest ¶
func BuildGracefulFromRequest( req *fnv1.RunFunctionRequest, log logging.Logger, targets ...any, ) (conversionIssues []string, err error)
BuildGracefulFromRequest converts a given requests data to the inventory.
func ConvertToResponse ¶
func ConvertToResponse(rsp *fnv1.RunFunctionResponse, sources ...any) error
ConvertToResponse is a wrapper that extracts desired state and sets the response.
func CountResources ¶
func CountResources(inventory ResourcesMap, resourceKey string) int
CountResources returns the number of resources stored in the inventory for the given key. If the key is not found in the inventory, it returns 0.
func ExtractDesiredState ¶
func ExtractDesiredState( sources ...any, ) (*resource.Composite, map[resource.Name]*resource.DesiredComposed, error)
ExtractDesiredState extracts composite and composed resources from sources using reflection.
func FindConflictingPrefix ¶
FindConflictingPrefix reports whether the provided prefix matches any key in the mapping-by-prefix relationship (in either direction). It returns (ok, matchedKey).
func GetResource ¶
func GetResource[T runtime.Object]( inventory ResourceMap, resourceKey string, ) (T, fnv1.Ready, map[string][]byte, bool)
GetResource retrieves a resource with a given key of type T from the inventory map.
func GetResourceMap ¶
func GetResourceMap[T runtime.Object]( inventory ResourceMap, objectKey string, ) (map[string]T, map[string]fnv1.Ready, map[string]map[string][]byte, bool)
GetResourceMap retrieves a resource of type T from the inventory map.
func GetResources ¶
func GetResources[T runtime.Object]( inventory ResourcesMap, resourceKey string, ) ([]T, []fnv1.Ready, []map[string]byte, bool)
GetResources retrieves resources of type []T from the inventory map.
func HasResource ¶
func HasResource(inventory ResourceMap, resourceKey string) bool
HasResource checks whether the inventory has resource of the given key.
Types ¶
type ConnectionDetails ¶
type Mapping ¶
type Mapping map[string]MappingFunc
type MappingFunc ¶
type MappingType ¶
MappingType is a mapping of resource names to their types.
type Option ¶
type Option func(*builder) error
Option is a functional option for configuring BuildInventory.
func BuildInventoryOptions ¶
func WithComposite ¶
func WithComposite(m MappingFunc) Option
WithComposite sets the composite (XRD) mapping function.
type Reader ¶
type Reader interface {
// GetDesiredComposite returns the desired composite resource
GetDesiredComposite() *Resource
// GetObservedComposite returns the observed composite resource
GetObservedComposite() *Resource
// GetDesiredComposed returns the map of desired composed resources
GetDesiredComposed() ResourceMap
// GetObservedComposed returns the map of observed composed resources
GetObservedComposed() ResourceMap
// GetRequirements returns the map of extra resources
GetRequirements() ResourcesMap
// GetInput returns the input
GetInput() runtime.Object
}
Reader provides read access to inventory data.
func BuildGracefulInventory ¶
func BuildInventory ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) Connection ¶
func (r *Resource) Connection() ConnectionDetails
func (*Resource) RuntimeObject ¶
type ResourceMap ¶
type ResourcesMap ¶
type TypeRegistry ¶
type TypeRegistry struct {
// contains filtered or unexported fields
}
TypeRegistry manages type validation and storage for different field categories.