putil

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package putil contains utility functions for working with [resource.PropertyValue]s and related types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepEquals

func DeepEquals(a, b resource.PropertyValue) bool

DeepEquals checks if a and b are equal.

DeepEquals is different from a.DeepEquals(b) in two ways:

1. If does secret/computed/output folding, so secret(computed(v)) == computed(secret(v)).

2. It doesn't panic when computed values are present.

func FormatProviderReference

func FormatProviderReference(urn resource.URN, id resource.ID) string

FormatProviderReference formats the URN and ID into a string representation of a provider reference.

func FromUrns

func FromUrns(urns []urn.URN) []string

func GetPropertyDependencies

func GetPropertyDependencies(v property.Value) []urn.URN

GetPropertyDependencies gathers (deeply) the dependencies of the given property value.

func IsComputed

func IsComputed(v resource.PropertyValue) bool

IsComputed checks if v is some form of a computed/unknown value.

func IsSecret

func IsSecret(v resource.PropertyValue) bool

IsSecret checks if v should be treated as secret.

func MakeComputed

MakeComputed wraps v in a computed value if it is not already computed.

func MergePropertyDependencies

func MergePropertyDependencies(m property.Map, dependencies map[string][]urn.URN) property.Map

MergePropertyDependencies merges the given dependencies into the property map.

Apply the dependencies to the property map, only for "legacy" values that don't have output dependencies. The caller may fold the output dependencies of a value's children into the dependencies map, and we seek to avoid treating those as true dependencies of the top-level value.

func ParseProviderReference

func ParseProviderReference(s string) (resource.URN, resource.ID, error)

ParseProviderReference parses the URN and ID from the string representation of a provider reference. If parsing was not possible, this function returns an error.

func ToUrns

func ToUrns(s []string) []urn.URN

ToUrns converts a slice of strings to a slice of URNs.

func Walk

func Walk(v property.Value, f func(property.Value) (continueWalking bool)) bool

Walk traverses a property value along all paths, performing a depth first search.

Types

This section is empty.

Jump to

Keyboard shortcuts

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